最近我开始学习Videogular的提示点。
我的目标是在给定时间(这里是第 5 秒)暂停视频。
这是我的角度控制器:
angular.module('myApp',[
"ngSanitize",
"com.2fdevs.videogular",
"com.2fdevs.videogular.plugins.controls"
])
.controller('HomeCtrl', [
'$sce',
function ($sce) {
this.API = null;
this.onPlayerReady = function(API){
this.API = API;
};
this.init = function init(){
var timePoint = [];
var start = 5;
var end = 6;
var result = {};
result.timeLapse = {
start: start,
end: end
};
result.onLeave = function onLeave(currentTime, timeLapse, params) {
console.log('onleave');
};
result.onUpdate = function onComplete(currentTime, timeLapse, params) {
console.log('completed');
};
result.onComplete = function onUpdate(currentTime, timeLapse, params) {
console.log('update');
};
timePoint.push(result);
this.config = {
preload: "none",
sources: [
{src: $sce.trustAsResourceUrl(hv.url), type: "video/mp4"}
],
theme: {
url: "http://www.videogular.com/styles/themes/default/latest/videogular.css"
},
cuePoints: {
timePoint: timePoint
},
plugins: {
controls: {
autoHide: true,
autoHideTime: 5000
}
}
};
};
this.init();
}]
);
该控制器大部分工作正常,但onLeave
, onUpdate
,onComplete
回调都不起作用,6 秒后控制台中没有打印日志。
我的代码里面有什么问题吗?谢谢。
我的 Angular 版本是 1.3.17,Videogular 版本是 1.2.4。