Skip to content

Commit

Permalink
Merge pull request #40 from dusthijsvdh/bug/statechangefix
Browse files Browse the repository at this point in the history
🐛 fixed yt bug
  • Loading branch information
dustessavdh authored Jul 5, 2021
2 parents abd3b80 + ded1c7b commit 0132fde
Show file tree
Hide file tree
Showing 3 changed files with 10,096 additions and 154 deletions.
6 changes: 2 additions & 4 deletions assets/js/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default class Player {
this.eventQueue = [];
window.onYouTubeIframeAPIReady = () => this.onIframeReady(domId)
this.youtubeScriptTag = document.createElement("script")
this.youtubeScriptTag.src = "//www.youtube.com/iframe_api"
this.youtubeScriptTag.src = "https://www.youtube.com/iframe_api"
document.head.appendChild(this.youtubeScriptTag)
}

Expand All @@ -20,7 +20,7 @@ export default class Player {
this.player = new YT.Player(domId, {
events: {
"onReady": (event => this.onPlayerReady(event)),
"onStateChange": (event => setTimeout(() => {this.onPlayerStateChange(event)}, 0)),
"onStateChange": (event => this.onPlayerStateChange(event)),
"onPlaybackRateChange": (event => this.onPlaybackRateChange(event)),
"onError": (event => this.onPlayerError(event))
}
Expand Down Expand Up @@ -125,7 +125,6 @@ export default class Player {
startEventQueue(events) {
this.eventQueue = events
this.player.l.h[5] = (event => this.queuedPlayerStateChange(event))
this.player.i.i.events.onStateChange = (event => this.queuedPlayerStateChange(event))
}

queuedPlayerStateChange(event) {
Expand All @@ -147,7 +146,6 @@ export default class Player {

resumePlayerStateChange(event) {
this.player.l.h[5] = (event => this.onPlayerStateChange(event))
this.player.i.i.events.onStateChange = (event => this.onPlayerStateChange(event))
this.onPlayerStateChange(event)
}
}
Loading

0 comments on commit 0132fde

Please sign in to comment.