videojs 动态加载视频
VideoJS dynamic source change via RESTful API
'Undefined' issue with changing RTMP source on compressed video.js build #1612
Dynamically change RTMP source #1399
根据这些问题,处理好了动态加载视频部分,src使用对象数据的方式存放,动态资源在ready的时候放入,嘻嘻
1 var story_sources = [{ 2 type:"video/mp4", 3 src:baseurl+"story1/Trainer"+uservtId+"_story1_small.mp4" 4 },{ 5 type:"video/webm", 6 src:baseurl+"story1/Trainer"+uservtId+"_story1_small.webm" 7 }]; 8 var story_player = videojs('storyVideo'); 9 story_player.ready(function () { 10 var obj = this; 11 obj.src(story_sources); 12 obj.load(); 13 });
-------------------------2016-01-30------------------
假如Html5 中的video元素添加了 loop 属性(重复播放),那么 story_player.on("ended",function(){ alert("video is done");});将执行不到。
videojs 添加ended事件