video chapter titles

This commit is contained in:
rolux 2014-02-08 07:39:10 +00:00
parent cb0ec49a13
commit 74101b1e22
2 changed files with 10 additions and 7 deletions

View file

@ -199,7 +199,7 @@ Ox.VideoEditPanel = function(options, self) {
self.$video = Ox.VideoPlayer({
chapters: self.chapters,
controlsTop: ['fullscreen', 'space', 'open'],
controlsTop: ['fullscreen', 'chapterTitle', 'open'],
controlsBottom: [
'play', 'playInToOut', 'volume', 'scale', 'timeline',
'previous', 'next', 'loop', 'position', 'settings'
@ -431,7 +431,7 @@ Ox.VideoEditPanel = function(options, self) {
return self.options.clips.map(function(clip) {
return {
position: clip.position,
title: clip.title || clip.id
title: self.options.formatTitle(clip)
};
});
}

View file

@ -1401,12 +1401,14 @@ Ox.VideoPlayer = function(options, self) {
function getChapterTitle() {
var chapterTitle = '';
self.options.chapters && Ox.forEach(self.options.chapters, function(v) {
self.options.chapters && Ox.forEach(self.options.chapters, function(v, i) {
if (
v['in'] <= self.options.position
&& v.out >= self.options.position
v.position <= self.options.position && (
i == self.options.chapters.length - 1
|| self.options.chapters[i + 1].position >= self.options.position
)
) {
chapterTitle = v.text;
chapterTitle = v.title;
return false; // break
}
});
@ -1664,7 +1666,7 @@ Ox.VideoPlayer = function(options, self) {
return (self.options.fullscreen ? window.innerWidth : self.options.width) -
self.options.controlsTop.reduce(function(prev, curr) {
return prev + (
curr == 'title' || curr == 'space' ? 0
curr == 'title' || curr == 'chapterTitle' || curr == 'space' ? 0
: Ox.startsWith(curr, 'space') ? parseInt(curr.substr(5))
: 16
);
@ -2245,6 +2247,7 @@ Ox.VideoPlayer = function(options, self) {
setSize(self.$subtitle, getCSS('subtitle'), animate);
setSize(self.$controlsTop, getCSS('controlsTop'), animate);
setSize(self.$title, getCSS('title'), animate);
setSize(self.$chapterTitle, getCSS('title'), animate);
setSize(self.$spaceTop, getCSS('spaceTop'), animate);
setSize(self.$controlsBottom, getCSS('controlsBottom'), animate);
setSize(self.$timeline, getCSS('timeline'), animate, function() {