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
|
|
@ -89,7 +89,10 @@ Ox.VideoEditPanel = function(options, self) {
|
|||
self.$timeline.options({type: self.options.timeline});
|
||||
},
|
||||
video: function() {
|
||||
self.$video.options({video: self.options.video});
|
||||
self.$video.options({
|
||||
chapters: getChapters(),
|
||||
video: self.options.video
|
||||
});
|
||||
},
|
||||
width: function() {
|
||||
self.$video.options({width: getPlayerWidth()});
|
||||
|
|
@ -133,6 +136,7 @@ Ox.VideoEditPanel = function(options, self) {
|
|||
self.$player = Ox.Element().css({overflowX: 'hidden'});
|
||||
|
||||
self.$video = Ox.VideoPlayer({
|
||||
chapters: getChapters(),
|
||||
controlsTop: ['fullscreen', 'space', 'open'],
|
||||
controlsBottom: [
|
||||
'play', 'playInToOut', 'volume', 'scale', 'timeline',
|
||||
|
|
@ -312,6 +316,18 @@ Ox.VideoEditPanel = function(options, self) {
|
|||
return Ox.getObjectById(self.options.clips, id);
|
||||
}
|
||||
|
||||
function getChapters() {
|
||||
var currentTime = 0;
|
||||
return self.options.clips.map(function(clip) {
|
||||
var chapter = {
|
||||
position: currentTime,
|
||||
title: clip.title || clip.id
|
||||
};
|
||||
currentTime += clip.duration;
|
||||
return chapter;
|
||||
});
|
||||
}
|
||||
|
||||
function getPlayerHeight() {
|
||||
return self.options.height - 24
|
||||
- self.options.showTimeline * 80 - 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue