我将 PhoneGap 用于 android 应用程序,HTML5 视频标签用于在应用程序中播放视频。视频正在从手机 SD 卡播放
HTML:
<video id="homevideo" width="100%" controls>
<source type="video/m4v" src="file:///mnt/ext_card/app/test1.m4v" >
</video>
脚本:
var videoPlayer;
var video_count = 1;
document.addEventListener("deviceready", videoplay, false);
function videoplay(){
videoPlayer = document.getElementById("homevideo");
videoPlayer.play();
}
videoPlayer.onended = function(e) {
video_count++;
if (video_count == 4) video_count = 1;
var nextVideo = "file:///mnt/ext_card/app/test"+video_count+".m4v";
videoPlayer.src = nextVideo;
videoPlayer.play();
}
我也用于addEventListener
循环
videoPlayer.addEventListener("ended", function (){
video_count++;
if (video_count == 4) video_count = 1;
var nextVideo = "file:///mnt/ext_card/app/advertisements/test"+video_count+".m4v";
videoPlayer.src = nextVideo;
videoPlayer.play();
}, false);
只播放了一个视频,但没有循环播放...如何在上一个视频完成后一个接一个地循环播放视频?