在舞台

时间:2016-04-02 09:41:49

标签: createjs

我跟着门票。 Easiest way to load a video in CreateJS? 但问题是它在我的createjs阶段之外加载视频。为了便于理解,我在这里上传了代码: http://graphicscoder.org/stackover/video/yes.html

<script>

var canvas, stage, exportRoot;

function init() {
    canvas = document.getElementById("canvas");
    exportRoot = new lib.yes();

    stage = new createjs.Stage(canvas);
    stage.addChild(exportRoot);

var videoDom = $('<video width="320" height="240" autoplay><source src="movie.mp4" type="video/mp4"></video>').appendTo(document.body)[0];
var cjsVideo = new createjs.DOMElement(videoDom);
stage.addChild(cjsVideo);

    stage.update();
    createjs.Ticker.setFPS(24);
    createjs.Ticker.addEventListener("tick", stage);
}
</script>

1 个答案:

答案 0 :(得分:1)

最后我找到了答案,你可以在没有jquery / js的情况下在createjs canvas中加载视频

只需将代码粘贴到flash cc

中即可
/* js
video = document.createElement(‘video’);
video.src = ‘http://graphicscoder.org/video/small.mp4’;
video.autoplay =true;
video.controls=true;
video.volume = 0;
var Video = new createjs.Bitmap(video);
stage.addChild(Video);
*/

获取来源:http://graphicscoder.org/my-createjs/load-video-in-canvas-createjs/