From 74101b1e22acdc77ef517197d731b13d42de7b32 Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 8 Feb 2014 07:39:10 +0000 Subject: [PATCH] video chapter titles --- source/Ox.UI/js/Video/VideoEditPanel.js | 4 ++-- source/Ox.UI/js/Video/VideoPlayer.js | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/source/Ox.UI/js/Video/VideoEditPanel.js b/source/Ox.UI/js/Video/VideoEditPanel.js index 6f7bb4a1..4365195c 100644 --- a/source/Ox.UI/js/Video/VideoEditPanel.js +++ b/source/Ox.UI/js/Video/VideoEditPanel.js @@ -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) }; }); } diff --git a/source/Ox.UI/js/Video/VideoPlayer.js b/source/Ox.UI/js/Video/VideoPlayer.js index 040a1b11..1f2bb671 100644 --- a/source/Ox.UI/js/Video/VideoPlayer.js +++ b/source/Ox.UI/js/Video/VideoPlayer.js @@ -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() {