play edit

This commit is contained in:
j 2017-04-15 19:44:57 +02:00
parent 00d1aa8485
commit a98831bb26

View file

@ -2,8 +2,10 @@
(function() { (function() {
playlist([ playlist([
[function() { info('A'); }, 30.000], [function() { info('A'); }, 10.000],
[function() { play('B', 3); }, 10], [function() { edit('ashok:Photomontage'); }, 100.000],
//[function() { info('A'); }, 30.000],
//[function() { play('B', 3); }, 10],
]); ]);
//helper functions //helper functions
@ -33,14 +35,42 @@
//if there is a player, pause it //if there is a player, pause it
pandora.$ui.player && pandora.$ui.player.options('paused', true); pandora.$ui.player && pandora.$ui.player.options('paused', true);
//back to results view //back to results view
pandora.UI.set({item: ''}); pandora.UI.set({item: '', section: 'items'});
//open about page //open about page
pandora.UI.set({page: 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) { function editor(item, start) {
playItem(item, 'editor', start); playItem(item, 'editor', start);
} }
function info(item) { function info(item) {
pandora.UI.set({section: 'items'});
pandora.UI.set({page: ''}); pandora.UI.set({page: ''});
pandora.UI.set({itemView: 'info'}); pandora.UI.set({itemView: 'info'});
pandora.UI.set({item: item}); pandora.UI.set({item: item});
@ -54,6 +84,7 @@
} }
function playItem(item, view, position, layers) { function playItem(item, view, position, layers) {
pandora.UI.set({section: 'items'});
showLayers(layers); showLayers(layers);
position = position || 0; position = position || 0;
if(Ox.isString(position)) { if(Ox.isString(position)) {
@ -82,7 +113,7 @@
} }
function find(query, view) { function find(query, view) {
view = view || 'grid'; 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.findInput.value(query);
pandora.UI.set({find: {conditions: [{key: '*', value: query, operator: '='}], operator: '&'}}); 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) { function openDocument(id) {
//if there is a player, pause it //if there is a player, pause it
pandora.$ui.player && pandora.$ui.player.options('paused', true); pandora.$ui.player && pandora.$ui.player.options('paused', true);