Skip to content

Commit

Permalink
[#888930] Fixes for vimeo paused state
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottDowne committed Mar 13, 2014
1 parent c265a58 commit 45830ef
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions wrappers/vimeo/popcorn.HTMLVimeoVideoElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
playerReady = false,
playerUID = Popcorn.guid(),
player,
playerPaused = true,
playerReadyCallbacks = [],
timeUpdateInterval,
currentTimeInterval,
Expand Down Expand Up @@ -164,6 +165,7 @@
}

self.play = function() {
impl.paused = false;
if( !playerReady ) {
addPlayerReadyCallback( function() { self.play(); } );
return;
Expand Down Expand Up @@ -196,6 +198,7 @@
}

self.pause = function() {
impl.paused = true;
if( !playerReady ) {
addPlayerReadyCallback( function() { self.pause(); } );
return;
Expand All @@ -206,8 +209,11 @@

function onPause() {
impl.paused = true;
clearInterval( timeUpdateInterval );
self.dispatchEvent( "pause" );
if ( !playerPaused ) {
playerPaused = true;
clearInterval( timeUpdateInterval );
self.dispatchEvent( "pause" );
}
}

function onTimeUpdate() {
Expand All @@ -232,8 +238,9 @@
timeUpdateInterval = setInterval( onTimeUpdate,
self._util.TIMEUPDATE_MS );

if( impl.paused ) {
impl.paused = false;
impl.paused = false;
if( playerPaused ) {
playerPaused = false;

// Only 1 play when video.loop=true
if ( !impl.loop ) {
Expand Down Expand Up @@ -359,10 +366,6 @@
case "seek":
onCurrentTime( parseFloat( data.data.seconds ) );
onSeeked();
// Deal with Vimeo playing when paused after a seek
if( impl.paused ) {
self.pause();
}
break;
}
}
Expand Down

0 comments on commit 45830ef

Please sign in to comment.