forked from 0x2620/oxjs
fix issues with automatically opening annotation folders; add annotations option to video player to make find work for all layers
This commit is contained in:
parent
61402492c6
commit
94cfbdb45c
7 changed files with 108 additions and 30 deletions
|
|
@ -74,6 +74,7 @@ Ox.VideoPanel = function(options, self) {
|
|||
});
|
||||
|
||||
self.$video = Ox.VideoPlayer({
|
||||
annotations: getAnnotations(),
|
||||
censored: self.options.censored,
|
||||
controlsTop: ['fullscreen', 'title', 'find'],
|
||||
controlsBottom: ['play', 'volume', 'scale', 'timeline', 'position', 'settings'],
|
||||
|
|
@ -127,6 +128,7 @@ Ox.VideoPanel = function(options, self) {
|
|||
scale: function(data) {
|
||||
that.triggerEvent('scale', data);
|
||||
},
|
||||
select: selectAnnotation,
|
||||
subtitles: function(data) {
|
||||
that.triggerEvent('subtitles', data);
|
||||
},
|
||||
|
|
@ -269,6 +271,14 @@ Ox.VideoPanel = function(options, self) {
|
|||
that.triggerEvent('position', {position: self.options.position});
|
||||
}
|
||||
|
||||
function getAnnotations() {
|
||||
return Ox.flatten(Ox.merge(self.options.layers.map(function(layer) {
|
||||
return layer.items.map(function(item) {
|
||||
return {id: item.id, 'in': item['in'], out: item.out, text: item.value};
|
||||
});
|
||||
}))).sort(sortAnnotations);
|
||||
}
|
||||
|
||||
function getPlayerHeight() {
|
||||
return self.options.height -
|
||||
self.options.showTimeline * 80 - 1;
|
||||
|
|
@ -330,6 +340,7 @@ Ox.VideoPanel = function(options, self) {
|
|||
setPoint('in', data['in']);
|
||||
setPoint('out', data.out);
|
||||
}
|
||||
self.$annotationPanel.options({selected: self.options.selected});
|
||||
that.triggerEvent('select', {id: self.options.selected});
|
||||
}
|
||||
|
||||
|
|
@ -347,6 +358,24 @@ Ox.VideoPanel = function(options, self) {
|
|||
self.$annotationPanel.options({position: self.options.position});
|
||||
}
|
||||
|
||||
function sortAnnotations(a, b) {
|
||||
var ret = 0;
|
||||
if (a['in'] < b['in']) {
|
||||
ret = -1;
|
||||
} else if (a['in'] > b['in']) {
|
||||
ret = 1;
|
||||
} else if (a.out < b.out) {
|
||||
ret = -1;
|
||||
} else if (a.out > b.out) {
|
||||
ret = 1;
|
||||
} else if (a.value < b.value) {
|
||||
ret = -1;
|
||||
} else if (a.value > b.value) {
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function toggleAnnotations(data) {
|
||||
self.options.showAnnotations = !data.collapsed;
|
||||
self.$video.options({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue