Skip to content

Commit

Permalink
Add unstarted state
Browse files Browse the repository at this point in the history
  • Loading branch information
Arnaud BRETON committed Sep 27, 2013
1 parent 8ffacba commit 484e9c9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion popcorn.js
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@
Popcorn.Events = {
UIEvents: "blur focus focusin focusout load resize scroll unload",
MouseEvents: "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave click dblclick",
Events: "loadstart progress suspend emptied stalled play pause error " +
Events: "unstarted loadstart progress suspend emptied stalled play pause error " +
"loadedmetadata loadeddata waiting playing canplay canplaythrough " +
"seeking seeked timeupdate ended ratechange durationchange volumechange"
};
Expand Down
8 changes: 8 additions & 0 deletions wrappers/youtube/popcorn.HTMLYouTubeVideoElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@
ytCallbacks[ i ]();
delete ytCallbacks[ i ];
}

if(YT && YT.PlayerState && !YT.PlayerState.UNSTARTED) {
YT.PlayerState.UNSTARTED = -1;
}
};

function HTMLYouTubeVideoElement( id ) {
Expand Down Expand Up @@ -198,6 +202,10 @@

function onPlayerStateChange( event ) {
switch( event.data ) {
case YT.PlayerState.UNSTARTED:
impl.src = player.getVideoUrl();

self.dispatchEvent("unstarted");

// ended
case YT.PlayerState.ENDED:
Expand Down

0 comments on commit 484e9c9

Please sign in to comment.