-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathcuepoints.js
More file actions
39 lines (35 loc) · 1.02 KB
/
Copy pathcuepoints.js
File metadata and controls
39 lines (35 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(function(){
'use strict';
angular.module('uk.ac.soton.ecs.videogular.plugins.cuepoints', [])
.directive(
'vgCuepoints',
[function() {
return {
restrict: 'E',
require: '^videogular',
templateUrl: 'bower_components/videogular-cuepoints/cuepoints.html',
scope: {
cuepoints: '=vgCuepointsConfig',
theme: '=vgCuepointsTheme',
},
link: function($scope, elem, attr, API) {
// shamelessly stolen from part of videogular's updateTheme function
function updateTheme(value) {
if (value) {
var headElem = angular.element(document).find("head");
headElem.append("<link rel='stylesheet' href='" + value + "'>");
}
}
$scope.calcLeft = function(cuepoint) {
if (API.totalTime === 0) return '-1000';
var videoLength = API.totalTime / 1000;
return (cuepoint.time * 100 / videoLength).toString();
};
$scope.onCuePointClick = function(cuepoint){
API.seekTime(cuepoint.time);
};
updateTheme($scope.theme);
},
};
}]);
})();