embed player: add code for improved timelines (not yet enabled)

This commit is contained in:
rolux 2013-08-27 12:53:37 +00:00
parent 9ebf8140ed
commit 679dc7b7a1

View file

@ -108,6 +108,10 @@ pandora.ui.embedPlayer = function() {
+ '/timelineantialias' + '/timelineantialias'
+ size + 'p' + i + '.jpg' + size + 'p' + i + '.jpg'
} : '/' + options.item + '/' + 'timeline16p.png', } : '/' + options.item + '/' + 'timeline16p.png',
/*
timeline: options.playInToOut ? getSmallTimelineURL()
: '/' + options.item + '/' + 'timeline16p.png',
*/
timelineType: options.showTimeline timelineType: options.showTimeline
? options.timeline : '', ? options.timeline : '',
timelineTypes: options.showTimeline timelineTypes: options.showTimeline
@ -181,7 +185,7 @@ pandora.ui.embedPlayer = function() {
}) })
.bindEvent({ .bindEvent({
mousedown: that.gainFocus, mousedown: that.gainFocus,
position: changeTimeline position: dragTimeline
}) })
.appendTo($controls); .appendTo($controls);
} }
@ -249,7 +253,7 @@ pandora.ui.embedPlayer = function() {
}); });
function changeTimeline(data) { function dragTimeline(data) {
var position = options.playInToOut var position = options.playInToOut
? Ox.limit(data.position, options['in'], options.out) ? Ox.limit(data.position, options['in'], options.out)
: data.position; : data.position;
@ -308,6 +312,22 @@ pandora.ui.embedPlayer = function() {
return {innerHeight: innerHeight, videoHeight: videoHeight}; 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.$('<canvas>').attr({width: width, height: height})[0].toDataURL();
}
function selectAnnotation(data) { function selectAnnotation(data) {
if (data.id) { if (data.id) {
setPosition(Math.max(data['in'], options['in'] || 0)); setPosition(Math.max(data['in'], options['in'] || 0));