Javascript 如果没有未定义的对象错误,画布中的视频将无法播放

Javascript 如果没有未定义的对象错误,画布中的视频将无法播放,javascript,html5-canvas,easeljs,createjs,Javascript,Html5 Canvas,Easeljs,Createjs,我在尝试使用新的AdobeFlashHTML5Canvas项目构建HTML5视频播放器时遇到了一个相当奇怪的情况 我已经在flash中将视频添加到画布中,但是视频仅在出现未捕获的引用错误时播放。如果没有错误,视频将不会在画布中播放 我想知道是否有人有任何洞察为什么会发生这种情况,或者如果你有更好的方式来添加视频到这个flash画布项目 我在下面包含了我所有的代码 this.stop(); var mainStage = this; var movieWidth = 640;//Choose S

我在尝试使用新的AdobeFlashHTML5Canvas项目构建HTML5视频播放器时遇到了一个相当奇怪的情况

我已经在flash中将视频添加到画布中,但是视频仅在出现未捕获的引用错误时播放。如果没有错误,视频将不会在画布中播放

我想知道是否有人有任何洞察为什么会发生这种情况,或者如果你有更好的方式来添加视频到这个flash画布项目

我在下面包含了我所有的代码

this.stop();
var mainStage = this;

var movieWidth = 640;//Choose Scaled Width of Video
var movieHeight = 360;//Choose Scaled Height of Video
var autoplayVideo = true;//Make it Autoplay

var vidya = document.createElement('video');//Creates the Video Element that is referenced later

var canvasEle = document.getElementById('canvas');//Identify the Canvas element
ctx = canvasEle.getContext('2d');//get canvas's context

canvasEle.parentNode.insertBefore(vidya, canvasEle);//insert video element before canvas element

vidya.setAttribute("src", "testing.mp4");//Place URL of the Video here (Local in this Example)
vidya.setAttribute("type","video/mp4");//What type of Video it is, Should be MP4
vidya.setAttribute("width", movieWidth);//scales the video to the width you had set above
vidya.setAttribute("controls","");//Turns on the default generic video controls
vidya.setAttribute("id","VIDEO");//gives the element an id for reference(Not Used yet)
if (autoplayVideo == true){ vidya.setAttribute("autoplay","");};

createjs.Ticker.addEventListener("tick", handleTick);

function handleTick(event){
    ctx.drawImage(vidya, 30, 70, movieWidth, movieHeight);
    console.log(ctx + " "+v);//here is where the uncaught reference is the "v"
}

在您的实际代码中,错误行下方是否没有任何内容?可能这条线以下的某个东西正在破坏某个东西,抛出一个错误会阻止JS引擎到达导致这条线的问题。例如,如果您只返回,该怎么办?对我来说似乎没问题:@apsillers之后有很多东西,但是我没有太多的控制权,因为它是在发布HTML5画布项目时生成的。它本身似乎工作得很好,但当它在flash项目中时,它只在导致错误时才工作。我唯一的想法是,它可能与可变范围有关,因为这个代码嵌套在发布的对象中,或者Flash可以在视频的顶部绘制空白的画布。这很令人费解。