html5播放器api有多个来源

时间:2014-10-29 15:54:52

标签: javascript html5 video html5-video

我找到了这个脚本

脚本:

var vid = document.getElementById('video');
vid.controls = true;

var source = document.createElement('source');
source.setAttribute('src', 'https://googledrive.com/host/0B_4b_1HlxqypYmlncHBEUE03aU0/%5Bhttp:%2F%2Fan1me.info%5D%20Gintama%20001');
vid.appendChild(source);

html:<video id="video"> <script src="video.js"></script> </video>

但我想做出类似的东西

var vid = document.getElementById('video');
vid.controls = true;

var source = document.createElement('source');
source[1].setAttribute('src', 'https://googledrive.com/host/0B_4b_1HlxqypYmlncHBEUE03aU0/%5Bhttp:%2F%2Fan1me.info%5D%20Gintama%20001');
source[2].setAttribute('src', 'https://googledrive.com/host/0B_4b_1HlxqypYmlncHBEUE03aU0/%5Bhttp:%2F%2Fan1me.info%5D%20Gintama%20002');
source[3].setAttribute('src', 'https://googledrive.com/host/0B_4b_1HlxqypYmlncHBEUE03aU0/%5Bhttp:%2F%2Fan1me.info%5D%20Gintama%20003');
source[4].setAttribute('src', 'https://googledrive.com/host/0B_4b_1HlxqypYmlncHBEUE03aU0/%5Bhttp:%2F%2Fan1me.info%5D%20Gintama%20004');
vid.appendChild(source);

并在html中显示来自源(没有播放列表)的一个

<video id="video"> 
<script id="1" src="video.js"></script> 
</video>

和视频两个id&#34; 2&#34;和所有这样的视频?

0 个答案:

没有答案