Skip to content
This repository has been archived by the owner on Jun 29, 2018. It is now read-only.

[#1428] Null wrapper double interval issue fixed. #280

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 16 additions & 5 deletions wrappers/null/popcorn.HTMLNullVideoElement.js
Expand Up @@ -26,6 +26,7 @@
this.currentTime = options.currentTime || 0; this.currentTime = options.currentTime || 0;
this.duration = options.duration || NaN; this.duration = options.duration || NaN;
this.playInterval = null; this.playInterval = null;
this.paused = true;
this.ended = options.endedCallback || Popcorn.nop; this.ended = options.endedCallback || Popcorn.nop;
} }


Expand All @@ -43,12 +44,18 @@


play: function() { play: function() {
var video = this; var video = this;
this.playInterval = setInterval( function() { nullPlay( video ); }, if ( this.paused ) {
DEFAULT_UPDATE_RESOLUTION_MS ); this.paused = false;
this.playInterval = setInterval( function() { nullPlay( video ); },
DEFAULT_UPDATE_RESOLUTION_MS );
}
}, },


pause: function() { pause: function() {
clearInterval( this.playInterval ); if ( !this.paused ) {
this.paused = true;
clearInterval( this.playInterval );
}
}, },


seekTo: function( aTime ) { seekTo: function( aTime ) {
Expand Down Expand Up @@ -245,7 +252,9 @@
return; return;
} }
player.play(); player.play();
onPlay(); if ( impl.paused ) {
onPlay();
}
}; };


function onPause() { function onPause() {
Expand All @@ -260,7 +269,9 @@
return; return;
} }
player.pause(); player.pause();
onPause(); if ( !impl.paused ) {
onPause();
}
}; };


function onEnded() { function onEnded() {
Expand Down