diff --git a/playlist.js b/playlist.js index 59d4630..e6ff37b 100644 --- a/playlist.js +++ b/playlist.js @@ -131,7 +131,13 @@ var $player, player; if (pandora.$ui.editPanel) { $player = $('.OxVideoPlayer').not('.OxBar'); - if($player.data('oxid') && Ox.$elements[$player.data('oxid')]) { + 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')]; } } @@ -140,7 +146,9 @@ callback(player, $player); }, 250); } else { - setTimeout(function() { waitForPlayer(callback); }, 250); + setTimeout(function() { + waitForPlayer(callback); + }, 250); } }