在我的ember应用程序中,我已经安装了videojs npm install --save-dev video.js bower安装video.js
我的hbs代码中的是:
要观看此视频,请启用JavaScript,并考虑升级到该网络浏览器 支持HTML5视频
javascript代码是: var player = videojs('my-player');
var options = {};
var player = videojs('my-player',options,function onPlayerReady(){
videojs.log('你的播放器准备就绪!');
this.play();
this.on('ends',function(){
videojs.log('Awww...over so soon?!');
});
});
如何在控制器中添加此javascript代码..
答案 0 :(得分:0)
videojs https://github.com/IvyApp/ivy-videojs
有一个Ember插件也许考虑使用它?
安装:
ember install ivy-videojs
模板:
{{ivy-videojs
canplay='canplay'
controls=true
ended='ended'
fluid=true
pause='pause'
playing='playing'
src=src}}
控制器:
import Ember from 'ember';
export default Ember.Controller.extend({
src: 'http://jell.yfish.us/media/jellyfish-3-mbps-hd-h264.mkv',
controls: true,
actions: {
canplay() {
console.log('video ready');
},
ended() {
console.log('video ended');
},
pause() {
console.log('video is paused');
},
playing() {
console.log('video is playing');
}
}
});