forked from 0x2620/oxjs
add chapter support to VideoPlayer, use for next/previous in VideoEditPanel
This commit is contained in:
parent
19b9b14dfc
commit
5b29e4348b
3 changed files with 38 additions and 23 deletions
|
|
@ -11,6 +11,7 @@ Ox.VideoPlayer <f> Generic Video Player
|
|||
censored <a|[]> Array of censored ranges
|
||||
censoredIcon <s|''> 'Censored' icon
|
||||
censoredTooltip <s|''> Tooltip for 'censored' icon
|
||||
chapters: <[o]|[]> List of chapter objects with position and title
|
||||
controlsBottom <[s]|[]> Bottom controls, from left to right
|
||||
Can be 'close', fullscreen', 'scale', 'title', 'find', 'open',
|
||||
'play', 'playInToOut', 'previous', 'next', 'loop', 'mute', 'volume',
|
||||
|
|
@ -722,7 +723,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
goToNextClip(1);
|
||||
goToNextChapter(1);
|
||||
}
|
||||
})
|
||||
.appendTo(self['$controls' + titleCase]);
|
||||
|
|
@ -845,7 +846,7 @@ Ox.VideoPlayer = function(options, self) {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
goToNextClip(-1);
|
||||
goToNextChapter(-1);
|
||||
}
|
||||
})
|
||||
.appendTo(self['$controls' + titleCase]);
|
||||
|
|
@ -1679,8 +1680,24 @@ Ox.VideoPlayer = function(options, self) {
|
|||
return symbol;
|
||||
}
|
||||
|
||||
function goToNextClip(direction) {
|
||||
self.$video[direction == 1 ? 'playNext' : 'playPrevious']();
|
||||
function goToNextChapter(direction) {
|
||||
var next,
|
||||
points = self.options.chapters.map(function(chapter) {
|
||||
return chapter.position;
|
||||
}).concat([self.options.duration]);
|
||||
if (direction == 1) {
|
||||
next = points.filter(function(point) {
|
||||
return point > self.options.position;
|
||||
})[0];
|
||||
} else {
|
||||
next = points.filter(function(point) {
|
||||
return point < self.options.position;
|
||||
}).slice(-1)[0];
|
||||
}
|
||||
if (Ox.isUndefined(next)) {
|
||||
next = direction == 1 ? self.options.duration : 0;
|
||||
}
|
||||
setPosition(next);
|
||||
}
|
||||
|
||||
function goToNextResult(direction) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue