如何修改让点击后,再开始播放视频 ,就是改成手动播放 20
现在是打开就自动播放,如何修改成点击后,开始播放,改成手动播放<divid="playervideo"class="portfolio-slideshowflexslid...
现在是打开就自动播放,如何修改成点击后,开始播放 ,改成手动播放
<div id="playervideo" class="portfolio-slideshow flexslider animate-onscroll">
<!-- Video player -->
<!--poster is 缩略图-->
<video id="example_video_1" class="video-js vjs-default-skin" controls="true" preload="none" poster="chen.jpg" data-setup="{}" height="500" width="100%">
</video>
<script language="javascript">
var vList = ['2.mp4', '2.mp4', 'video//demo.mp4']; // 初始化播放列表
var vLen = vList.length; // 播放列表的长度
var curr = 0; // 当前播放的视频
var video = document.getElementById("example_video_1");
/*var video = document.createElement("VIDEO");
video.setAttribute("width", "100%");
video.setAttribute("height", "500");
video.setAttribute("id", "example_video_1");
video.setAttribute("class", "video-js vjs-default-skin");
video.setAttribute("preload", "none");
video.setAttribute("poster", "video//demo.jpg");
video.setAttribute("data-setup", "{}");
video.setAttribute("controls", "yes");
document.getElementById("playervideo").appendChild(video);*/
//document.body.appendChild(video);
video.addEventListener('ended', play);
play();
function play(e) {
video.src = vList[curr];
video.load();
video.play();
curr++;
if(curr >= vLen){
curr = 0; // 播放完了,重新播放
}
}
</script>
<!-- /Video player -->
</div> 展开
<div id="playervideo" class="portfolio-slideshow flexslider animate-onscroll">
<!-- Video player -->
<!--poster is 缩略图-->
<video id="example_video_1" class="video-js vjs-default-skin" controls="true" preload="none" poster="chen.jpg" data-setup="{}" height="500" width="100%">
</video>
<script language="javascript">
var vList = ['2.mp4', '2.mp4', 'video//demo.mp4']; // 初始化播放列表
var vLen = vList.length; // 播放列表的长度
var curr = 0; // 当前播放的视频
var video = document.getElementById("example_video_1");
/*var video = document.createElement("VIDEO");
video.setAttribute("width", "100%");
video.setAttribute("height", "500");
video.setAttribute("id", "example_video_1");
video.setAttribute("class", "video-js vjs-default-skin");
video.setAttribute("preload", "none");
video.setAttribute("poster", "video//demo.jpg");
video.setAttribute("data-setup", "{}");
video.setAttribute("controls", "yes");
document.getElementById("playervideo").appendChild(video);*/
//document.body.appendChild(video);
video.addEventListener('ended', play);
play();
function play(e) {
video.src = vList[curr];
video.load();
video.play();
curr++;
if(curr >= vLen){
curr = 0; // 播放完了,重新播放
}
}
</script>
<!-- /Video player -->
</div> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询