1

我的要求是我必须将 N 个视频放在同一个地方,如果一个视频结束,那么下一个视频必须以同样的方式开始......

在这里,我尝试了四个视频,它没有开始第二个视频。

请你帮助我好吗

<script>
video_count =1;
videoPlayer = document.getElementById("ss");
function run(){
        video_count++;
        if (video_count == 4) video_count = 1;
        var nextVideo = "video"+video_count+".mp4";
        videoPlayer.src = nextVideo;
        videoPlayer.play();
        };
</script>

<video id="homevideo" width="100%" autoplay onended="run()">
    <source id="ss" src="video1.mp4" type='video/mp4'/>
</video>
4

2 回答 2

0

尝试删除 onended-tag 并添加 javascript 事件。它有帮助吗?

videoPlayer.onended(function(e) {
 run();
};
于 2013-08-13T10:58:52.577 回答
0

尝试使用它对你有帮助吗?

**In Head tag:**     
        <script type="text/javascript" language="javascript"> 
            video_count = 1; 
            function run() { 
                video_count++; 
                var videoPlayer = document.getElementById("homevideo"); 
                if (video_count == 4) 
                    video_count = 1; 
                var nextVideo = "ModelVideo/1/video" + video_count + ".mp4"; 
                videoPlayer.src = nextVideo; 
                videoPlayer.load(); 
                videoPlayer.play();        
            }; 
        </script> 

    In Body tag: 
    <div style="width: 30%;"> 
            <video id="homevideo" width="100%" controls autoplay onended="run()"> 
            <source id="ss" src="ModelVideo/1/video1.mp4" type='video/mp4'/></video> 
        </div> 
于 2014-01-27T14:17:04.040 回答