如何将视频循环限制为3次然后停止?

时间:2017-09-11 11:17:42

标签: javascript html5-video

我有以下代码无限循环播放视频。如何才能将视频循环播放3次?

(lib.mc_DomElementContainer = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});
}).prototype = getMCSymbolPrototype(lib.mc_DomElementContainer, new cjs.Rectangle(-1,-1,971,251), null);

(lib.Scoota_Test = function(mode,startPosition,loop) {
    this.initialize(mode,startPosition,loop,{});

    this.frame_0 = function() {

        hiDPIFix.hiDPI_adjustment(true);    

        root = this;                                            
        var pageCanvas = document.getElementById("canvas"),                         // canvas element in html doc
            vidHolderDiv,                                                           // div element that will contain the FT video object
            wrapperDiv,                                                             // div element that will contain the canvas and video holder div element
            EJS_DomElement;                                                         // Easel JS DOMElement Object that will manage the html div element

        function ft_wrapperDiv_setUp() {
            wrapperDiv = document.createElement('div');
            document.body.appendChild(wrapperDiv);
            wrapperDiv.id = "wrapperDiv";
            wrapperDiv.style.position = "absolute";
            wrapperDiv.style.width = "970px";                                       // set to the ad width
            wrapperDiv.style.height = "250px";                                      // set to the ad height
            wrapperDiv.style.overflow = "hidden";
            wrapperDiv.appendChild(pageCanvas);
        }

        function ft_videoDiv_setup() {
            vidHolderDiv = document.createElement('div');
            vidHolderDiv.id = "vidHolder";
            // add styles 
            vidHolderDiv.style.color = '#00ff00';
            vidHolderDiv.style.backgroundColor = '#ff00ff';
            vidHolderDiv.style.width = '970px';                                     // this should be the encoded width of the source video
            vidHolderDiv.style.height = '250px';                                    // this should be the encoded height of the source video
            wrapperDiv.insertBefore(vidHolderDiv, pageCanvas);
        }

        function ft_domElementObj_setup() {
            EJS_DomElement = new createjs.DOMElement("vidHolder");
            root.domElementContainer_mc.addChild(EJS_DomElement);
        }

        function ft_setUpVideo(){
            vidHolder = myFT.$('#vidHolder');
            vid = myFT.insertVideo({
                parent: vidHolder,
                video: "video1",
                poster: "images/poster.png",
                width: 970,                                                         // this should be the encoded width of the source video
                height: 250,                                                        // this should be the encoded height of the source video
                controls: false,
                autoplay: true,
                loop: true
            });
        }   

0 个答案:

没有答案