add playedit.js

This commit is contained in:
j 2017-04-18 11:29:28 +02:00
parent 6a8fca06cc
commit 5dd19505ba
2 changed files with 73 additions and 3 deletions

70
playedit.js Normal file
View file

@ -0,0 +1,70 @@
//open User->Preferences->Advanced->Run Script on Load and paste this script
(function() {
edit('user:example');
// settings and helper functions below
var resolution = [window.innerWidth, window.innerHeight],
outerHeight = 24 + 16 + 16 + 96, // menu bars + timeline bottom
sidebarSize = resolution[0] - ((resolution[1] - outerHeight) * 4/3),
tvUI = {
clipSize: sidebarSize,
annotationsRange: 'position',
editView: 'annotations',
section: 'edits',
showAnnotations: true,
showTimeline: true,
showSidebar: false,
videoLoop: true,
videoScale: 'fit'
};
function edit(edit, position) {
pandora.UI.set({
page: ''
});
position = position || 0;
pandora.UI.set(Ox.extend({
edit: edit
}, tvUI, 'edits.' + edit + '.position', position));
waitForPlayer(function(player) {
//fixGUI();
player.options({
paused: false,
position: position
});
});
}
function waitForPlayer(callback) {
var $player, player;
if (pandora.$ui.editPanel) {
$player = $('.OxVideoPlayer').not('.OxBar');
var readyState = 0;
if($player.find('video').length) {
$player.find('video').each(function() {
readyState = Math.max(readyState, this.readyState);
});
}
if(readyState && $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 fixGUI() {
// hide menu
pandora.$ui.appPanel.resizeElement(0, 0);
}
})();

View file

@ -41,10 +41,10 @@
} }
function edit(edit, position) { function edit(edit, position) {
var resolution = [1920, 1080], var resolution = [window.innerWidth, window.innerHeight],
annotationsSize = resolution[0] - (resolution[1] * 4/3), clipSize = resolution[0] - (resolution[1] * 4/3),
tvUI = { tvUI = {
annotationsSize: annotationsSize, clipSize: clipSize,
annotationsRange: 'position', annotationsRange: 'position',
editView: 'annotations', editView: 'annotations',
section: 'edits', section: 'edits',