From 679dc7b7a1504bc8bec405b23e93512304264053 Mon Sep 17 00:00:00 2001 From: rolux Date: Tue, 27 Aug 2013 12:53:37 +0000 Subject: [PATCH] embed player: add code for improved timelines (not yet enabled) --- static/js/embedPlayer.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/static/js/embedPlayer.js b/static/js/embedPlayer.js index a958124f9..3699570bb 100644 --- a/static/js/embedPlayer.js +++ b/static/js/embedPlayer.js @@ -108,6 +108,10 @@ pandora.ui.embedPlayer = function() { + '/timelineantialias' + size + 'p' + i + '.jpg' } : '/' + options.item + '/' + 'timeline16p.png', + /* + timeline: options.playInToOut ? getSmallTimelineURL() + : '/' + options.item + '/' + 'timeline16p.png', + */ timelineType: options.showTimeline ? options.timeline : '', timelineTypes: options.showTimeline @@ -181,7 +185,7 @@ pandora.ui.embedPlayer = function() { }) .bindEvent({ mousedown: that.gainFocus, - position: changeTimeline + position: dragTimeline }) .appendTo($controls); } @@ -249,7 +253,7 @@ pandora.ui.embedPlayer = function() { }); - function changeTimeline(data) { + function dragTimeline(data) { var position = options.playInToOut ? Ox.limit(data.position, options['in'], options.out) : data.position; @@ -308,6 +312,22 @@ pandora.ui.embedPlayer = function() { return {innerHeight: innerHeight, videoHeight: videoHeight}; } + function getSmallTimelineFPS() { + return Math.floor((options.out - options['in']) * 25) < 32768 ? 25 : 1; + } + + function getSmallTimelineURL() { + var fps = getSmallTimelineFPS(), + width = Math.ceil((options.out - options['in']) * fps), + height = fps == 1 ? 16 : 64; + pandora[ + fps == 1 ? 'getSmallClipTimelineURL' : 'getLargeClipTimelineURL' + ](options.item, options['in'], options.out, options.timeline, function(url) { + $player.options({timeline: url}); + }); + return Ox.$('').attr({width: width, height: height})[0].toDataURL(); + } + function selectAnnotation(data) { if (data.id) { setPosition(Math.max(data['in'], options['in'] || 0));