videojs-youtube
videojs-youtube copied to clipboard
unstarted state events fired twice
As per youtube iframe API documentation: "When the player first loads a video, it will broadcast an unstarted (-1) event. When a video is cued and ready to play, the player will broadcast a video cued (5) event." In videojs-youtube code, 4 events (loadstart, loadedmetadata, durationchange, ratechange) are fired each time state changes to unstarted. However, for some reason, when starting the video, it moves from cued (5) to unstarted (-1) again before moving to buffering (3) and then playing (1). That means these events will always be fired twice - first time before the video moves to cued state, and second when you start the video. Is this intended? Not sure what is the reason for the second change to unstarted before play, and if it's a youtube iframe thing, maybe the events should not be fired when moving from cued to unstarted?
P.S. Also, in the referenced line of code, case -1:
line should probably be changed to case YT.PlayerState.UNSTARTED:
. It's not documented in the iframe docs, but it does exist in the scope.
I'm also hitting this issue.
Same here :/
Same...