连续播放视频 [英] running video in sequence

查看:76
本文介绍了连续播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想按顺序播放视频.

这是我的代码.它正在播放播放列表中的第一个视频,但不接受第二个视频.

我通过获取播放列表进行了检查.它运行得很好.请帮我连续播放视频吗?

I want to play video in sequence.

Here is my code. It is running the first video in the playlist but not accepting the second video.

I checked by fetching the playlist. Its running perfectly fine. Please help me run the videos in sequece?

<head>
<script type="text/javascript">

var e=0;
  var playlist = [
  {
    //name: "Bleeding Love",
    file_name: "video/aw01.webm"
  },
  {
    //name: "Don't Forget",
    file_name: "video/teacch_640_1.webm"
  }
  ,
  {
   // name: "Bleeding Love",
    file_name: "video/aw01.webm"
  },
  {
   // name: "Don't Forget",
    file_name: "video/teacch_640_1.webm"
  }
]


function myEndedListener()
	 {	 
		myNewSrc();	
	 }

function myNewSrc() 
{
	
	while(e<playlist.length)>
	{
			 for (var k in playlist[e])
			 {    
				 var myVideo = document.getElementsByTagName('video')[0];
				 if(e!=0)
		{myVideo.removeEventListener('ended',myEndedListener(),false);}
				 myVideo.src=playlist[e][k];
				 myVideo.load();
				 myVideo.play();
				 e++;
				myVideo.addEventListener('ended',myEndedListener(),false);
				
			}
		  		
	   
	}
}

</script>
</head>
<body>
<div id="one">
<video width="960" height="540" controls="controls" onplay="this.play()" önclick="myEndedListener()">
</video></div>
</body>
</html>

推荐答案

在这里我找到了一个例子

带有播放列表的YouTube JavaScript API播放器 [ ^ ]
Here I found an example

YouTube JavaScript API Player with Playlist[^]


这篇关于连续播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆