【发布时间】:2013-07-05 10:52:49
【问题描述】:
我有多个视频在同一个 HTML5 视频播放器中一一播放
HTML
<video id="homevideo" width="100%" autoplay autobuffer>
<source src="app/video1.mp4" type='video/mp4' />
</video>
JS
video_count = 1;
videoPlayer = document.getElementById("homevideo");
videoPlayer.addEventListener("ended", function (){
video_count++;
if (video_count == 4) video_count = 1;
var nextVideo = "app/video" + video_count + ".mp4";
videoPlayer.src = nextVideo;
videoPlayer.play();
}, false);
如果我在播放前发出警报,它就会起作用。但是没有警报就不会。初始化第二个视频播放:
videoPlayer.src = nextVideo;
alert("a");
videoPlayer.play();
【问题讨论】:
标签: javascript html html5-video