diff --git a/playlist.js b/playlist.js index 63533fc..d5ab35a 100644 --- a/playlist.js +++ b/playlist.js @@ -2,8 +2,10 @@ (function() { playlist([ - [function() { info('A'); }, 30.000], - [function() { play('B', 3); }, 10], + [function() { info('A'); }, 10.000], + [function() { edit('ashok:Photomontage'); }, 100.000], + //[function() { info('A'); }, 30.000], + //[function() { play('B', 3); }, 10], ]); //helper functions @@ -33,14 +35,42 @@ //if there is a player, pause it pandora.$ui.player && pandora.$ui.player.options('paused', true); //back to results view - pandora.UI.set({item: ''}); + pandora.UI.set({item: '', section: 'items'}); //open about page pandora.UI.set({page: page}); } + + function edit(edit, position) { + var resolution = [1920, 1080], + annotationsSize = resolution[0] - (resolution[1] * 4/3), + tvUI = { + annotationsSize: annotationsSize, + annotationsRange: 'position', + editView: 'annotations', + section: 'edits', + showAnnotations: true, + showTimeline: false, //fixme to enable recalculate aspect + showSidebar: false, + //videoLoop: true, + videoScale: 'fit' + }; + position = position || 0; + pandora.UI.set(Ox.extend({ + edit: edit + }, tvUI, 'edits.' + edit + '.position', position)); + waitForPlayer(function(player) { + player.options({ + paused: false, + position: position + }); + }); + } + function editor(item, start) { playItem(item, 'editor', start); } function info(item) { + pandora.UI.set({section: 'items'}); pandora.UI.set({page: ''}); pandora.UI.set({itemView: 'info'}); pandora.UI.set({item: item}); @@ -54,6 +84,7 @@ } function playItem(item, view, position, layers) { + pandora.UI.set({section: 'items'}); showLayers(layers); position = position || 0; if(Ox.isString(position)) { @@ -82,7 +113,7 @@ } function find(query, view) { view = view || 'grid'; - pandora.UI.set({item: '', page: '', listView: view}); + pandora.UI.set({item: '', page: '', listView: view, section: 'items'}); pandora.$ui.findInput.value(query); pandora.UI.set({find: {conditions: [{key: '*', value: query, operator: '='}], operator: '&'}}); } @@ -96,6 +127,23 @@ })); } + function waitForPlayer(callback) { + var $player, player; + if (pandora.$ui.editPanel) { + $player = $('.OxVideoPlayer').not('.OxBar'); + if($player.data('oxid') && Ox.$elements[$player.data('oxid')]) { + player = Ox.$elements[$player.data('oxid')]; + } + } + if (player) { + setTimeout(function() { + callback(player, $player); + }, 250); + } else { + setTimeout(function() { waitForPlayer(callback); }, 250); + } + } + function openDocument(id) { //if there is a player, pause it pandora.$ui.player && pandora.$ui.player.options('paused', true);