From e323abd366a2d465b59b859180e2d6c1510d2033 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 19 Aug 2011 17:14:04 +0000 Subject: [PATCH 1/5] trigger mousedown on video icon list openpreview --- static/js/pandora/ui/list.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index b9bc5d39..7974b3ae 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -214,7 +214,7 @@ pandora.ui.list = function() { // fixme: remove view argument }, openpreview: function(data) { var $video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer'); - $video && $video.trigger('click'); + $video && $video.trigger('mousedown'); $video && Ox.print('OPENPREVIEW!!!@!') that.closePreview(); }, From b7314110a63b6827664661df62fca44849574e07 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 19 Aug 2011 17:16:45 +0000 Subject: [PATCH 2/5] debugging --- static/js/pandora/ui/list.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 7974b3ae..ee2a03f9 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -245,6 +245,11 @@ pandora.ui.list = function() { // fixme: remove view argument }) }) .addClass('OxTarget') + .bind({ + mousedown: function() { + Ox.print('MOUSEDOWN...') + } + }) .bindEvent({ // doubleclick opens item singleclick: function() { From 524052790c1c7bee4511f3eba9f246f7d29c73b3 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 19 Aug 2011 17:34:36 +0000 Subject: [PATCH 3/5] fix video icon list openpreview --- static/js/pandora/ui/list.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index ee2a03f9..931761f1 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -214,7 +214,11 @@ pandora.ui.list = function() { // fixme: remove view argument }, openpreview: function(data) { var $video = $('.OxItem.OxSelected > .OxIcon > .OxVideoPlayer'); - $video && $video.trigger('mousedown'); + if ($video) { + // trigger singleclick + $video.trigger('mousedown'); + Ox.UI.$window.trigger('mouseup'); + } $video && Ox.print('OPENPREVIEW!!!@!') that.closePreview(); }, @@ -245,11 +249,6 @@ pandora.ui.list = function() { // fixme: remove view argument }) }) .addClass('OxTarget') - .bind({ - mousedown: function() { - Ox.print('MOUSEDOWN...') - } - }) .bindEvent({ // doubleclick opens item singleclick: function() { From a815b3119ef91a85530f784c50224b5bede1b510 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 19 Aug 2011 17:45:16 +0000 Subject: [PATCH 4/5] some more fixes --- static/js/pandora/ui/item.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/static/js/pandora/ui/item.js b/static/js/pandora/ui/item.js index 8d2cfe84..830e1125 100644 --- a/static/js/pandora/ui/item.js +++ b/static/js/pandora/ui/item.js @@ -206,6 +206,16 @@ pandora.ui.item = function() { .bindEvent('resize', function() { pandora.$ui.map.resizeMap(); })); + } else if (pandora.user.ui.itemView == 'statistics') { + var stats = Ox.Container(); + Ox.TreeList({ + data: result.data, + width: pandora.$ui.mainPanel.size(1) - Ox.UI.SCROLLBAR_SIZE + }).appendTo(stats); + + pandora.$ui.contentPanel.replaceElement(1, stats); + + } else if (pandora.user.ui.itemView == 'player') { // fixme: duplicated var layers = [], @@ -223,7 +233,7 @@ pandora.ui.item = function() { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.player = Ox.VideoPanelPlayer({ annotationsSize: pandora.user.ui.annotationsSize, cuts: result.data.cuts || [], - duration: video.duration, + duration: result.data.duration, getTimelineImageURL: function(i) { return '/' + pandora.user.ui.item + '/timeline64p' + i + '.png'; }, @@ -260,18 +270,9 @@ pandora.ui.item = function() { pandora.UI.set('volume', data.volume); }, })); - } else if (pandora.user.ui.itemView == 'statistics') { - var stats = Ox.Container(); - Ox.TreeList({ - data: result.data, - width: pandora.$ui.mainPanel.size(1) - Ox.UI.SCROLLBAR_SIZE - }).appendTo(stats); - - pandora.$ui.contentPanel.replaceElement(1, stats); - } else if (pandora.user.ui.itemView == 'timeline') { var layers = [], - video = result.data.stream; + video = {}; $.each(pandora.site.layers, function(i, layer) { layers[i] = $.extend({}, layer, {items: result.data.layers[layer.id]}); }); @@ -284,7 +285,7 @@ pandora.ui.item = function() { pandora.$ui.contentPanel.replaceElement(1, pandora.$ui.editor = Ox.VideoEditor({ annotationsSize: pandora.user.ui.annotationsSize, cuts: result.data.cuts || [], - duration: video.duration, + duration: result.data.duration, find: '', getFrameURL: function(position) { return '/' + pandora.user.ui.item + '/' + Ox.last(pandora.site.video.resolutions) + 'p' + position + '.jpg'; From 5b49168890493e19fb2a52d9b0ae3b9514520706 Mon Sep 17 00:00:00 2001 From: rolux Date: Fri, 19 Aug 2011 18:08:51 +0000 Subject: [PATCH 5/5] load less videos per clip --- static/js/pandora/pandora.js | 29 +++++++++++++++++++---------- static/js/pandora/ui/list.js | 14 +++++++------- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/static/js/pandora/pandora.js b/static/js/pandora/pandora.js index f6967bd4..1170bee0 100644 --- a/static/js/pandora/pandora.js +++ b/static/js/pandora/pandora.js @@ -144,17 +144,26 @@ pandora.getListData = function() { return data; }; -pandora.getVideoPartAndPosition = function(durations, position) { - var duration = 0, ret; - Ox.forEach(durations, function(d, i) { - if (duration + d > position) { - ret = { - part: i, - position: position - duration +pandora.getVideoPartsAndPoints = function(durations, points) { + var parts = durations.length, + offsets = Ox.range(parts).map(function(i) { + return Ox.sum(Ox.sub(durations, 0, i)); + }), + ret = { + parts: [], + points: [] + }; + points.forEach(function(point, i) { + Ox.loop(parts - 1, -1, -1, function(i) { + if (offsets[i] <= point) { + ret.parts[i] = i; + return false; } - return false; - } - duration += d; + }); + }); + ret.parts = Ox.unique(ret.parts); + ret.points = points.map(function(point) { + return point - offsets[ret.parts[0]]; }); return ret; }; diff --git a/static/js/pandora/ui/list.js b/static/js/pandora/ui/list.js index 931761f1..cf146f32 100644 --- a/static/js/pandora/ui/list.js +++ b/static/js/pandora/ui/list.js @@ -233,18 +233,18 @@ pandora.ui.list = function() { // fixme: remove view argument if ($img.length) { var width = parseInt($img.css('width')), height = parseInt($img.css('height')); - pandora.api.get({id: item, keys: ['parts']}, function(result) { - var inPoint = that.value(id, 'in'), - outPoint = that.value(id, 'out'), + pandora.api.get({id: item, keys: ['durations']}, function(result) { + var points = [that.value(id, 'in'), that.value(id, 'out')], + partsAndPoints = pandora.getVideoPartsAndPoints(result.data.durations, points), $player = Ox.VideoPlayer({ height: height, - 'in': inPoint, - out: outPoint, + 'in': partsAndPoints.points[0], + out: partsAndPoints.points[1], paused: true, playInToOut: true, - poster: '/' + item + '/' + height + 'p' + that.value(id, 'in') + '.jpg', + poster: '/' + item + '/' + height + 'p' + points[0] + '.jpg', width: width, - video: Ox.range(result.data.parts).map(function(i) { + video: partsAndPoints.parts.map(function(i) { return '/' + item + '/96p' + (i + 1) + '.' + pandora.user.videoFormat }) })