From 5dd19505ba0f329a115c4bc5b43120ee968cc27b Mon Sep 17 00:00:00 2001 From: j Date: Tue, 18 Apr 2017 11:29:28 +0200 Subject: [PATCH] add playedit.js --- playedit.js | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ playlist.js | 6 ++--- 2 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 playedit.js diff --git a/playedit.js b/playedit.js new file mode 100644 index 0000000..20f79e0 --- /dev/null +++ b/playedit.js @@ -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); + + + } +})(); diff --git a/playlist.js b/playlist.js index e6ff37b..8c006a9 100644 --- a/playlist.js +++ b/playlist.js @@ -41,10 +41,10 @@ } function edit(edit, position) { - var resolution = [1920, 1080], - annotationsSize = resolution[0] - (resolution[1] * 4/3), + var resolution = [window.innerWidth, window.innerHeight], + clipSize = resolution[0] - (resolution[1] * 4/3), tvUI = { - annotationsSize: annotationsSize, + clipSize: clipSize, annotationsRange: 'position', editView: 'annotations', section: 'edits',