我正在尝试使用 Video.js 更改 HTML 5 视频的来源。
来源正在改变,我可以点击播放,它会播放视频,但我需要视频来播放事件。具体loadedalldata
事件。
我已经阅读了api 文档,它建议我所做的应该有效(根据我的理解。)。
Javascript:
var player = _V_('video'),
video = [{
"type": "video\/mp4",
"src": "http:\/\/mabuse.dev\/assets\/videos\/testVideo.mp4"
}, {
"type": "video\/webm",
"src": "http:\/\/mabuse.dev\/assets\/videos\/testVideo.webm"
}, {
"type": "video\/ogg",
"src": "http:\/\/mabuse.dev\/assets\/videos\/testVideo.ogv"
}, {
"type": "video\/flv",
"src": "http:\/\/mabuse.dev\/assets\/videos\/testVideo.flv"
}];
/* Add sources to new player */
player.src(video);
/* Remove loader & play video once loaded */
player.on("loadedalldata", function(){
console.log('test');
//app.player.play();
});
HTML:
<video class="video-js" id="video" controls preload="none" width="572" height="356" data-setup="{}"></video>