1
0
Fork 0
forked from 0x2620/oxjs

add chapter support to VideoPlayer, use for next/previous in VideoEditPanel

This commit is contained in:
j 2013-07-14 18:52:26 +00:00
commit 5b29e4348b
3 changed files with 38 additions and 23 deletions

View file

@ -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;