Skip to content

Commit

Permalink
Merge pull request #74 from hyperaudio/72-add-youtube-example
Browse files Browse the repository at this point in the history
71/72 add youtube example and fix youtube bug
  • Loading branch information
maboa authored Oct 20, 2021
2 parents 3c0a7d3 + ef3673f commit db12ed5
Show file tree
Hide file tree
Showing 4 changed files with 909 additions and 699 deletions.
8 changes: 4 additions & 4 deletions js/hyperaudio-lite.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*! (C) The Hyperaudio Project. MIT @license: en.wikipedia.org/wiki/MIT_License. */
/*! Version 2.0.6 */
/*! Version 2.0.7 */

'use strict';

Expand Down Expand Up @@ -78,15 +78,15 @@ class HyperaudioLite {
const firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

window.onYouTubeIframeAPIReady = function () {
window.onYouTubeIframeAPIReady = () => {
this.player = new YT.Player(mediaElementId, {
events: {
onStateChange: onPlayerStateChange,
},
});
};

onPlayerStateChange = event => {
let onPlayerStateChange = event => {
if (event.data === 1) {
// playing
this.checkPlayHead();
Expand Down Expand Up @@ -135,7 +135,7 @@ class HyperaudioLite {
} else {
// Assume YouTube

window.onYouTubeIframeAPIReady = function () {
window.onYouTubeIframeAPIReady = () => {
this.player = new YT.Player(mediaElementId, {
playerVars: { autoplay: 1 },
events: {
Expand Down
Loading

0 comments on commit db12ed5

Please sign in to comment.