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的时候放入,嘻嘻
var story_sources = [{
type:"video/mp4",
src:baseurl+"story1/Trainer"+uservtId+"_story1_small.mp4"
},{
type:"video/webm",
src:baseurl+"story1/Trainer"+uservtId+"_story1_small.webm"
}];
var story_player = videojs('storyVideo');
story_player.ready(function () {
var obj = this;
obj.src(story_sources);
obj.load();
});
-------------------------2016-01-30------------------
假如Html5 中的video元素添加了 loop 属性(重复播放),那么 story_player.on("ended",function(){ alert("video is done");});将执行不到。
videojs 添加ended事件