Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On the homepage of www.cityvision.edu, I'm attempting to use the YouTube Javascript API with the Media: Youtube module's embedded videos, using SWFObject API (drupal.org/project/swfobject_api) to handle the rendering of the videos.
Here's my code:
window.onYouTubePlayerReady = function(playerId) {
alert("YouTube player ready.");
ytplayer1 = $("#media-youtube-default-external-1");
console.log(ytplayer1);
ytplayer2 = $("#media-youtube-default-external-2");
console.log(ytplayer2);
ytplayer3 = $("#media-youtube-default-external-3");
console.log(ytplayer3);
ytplayer1.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer2.addEventListener("onStateChange", "onytplayerStateChange");
ytplayer3.addEventListener("onStateChange", "onytplayerStateChange");
}
function onytplayerStateChange(newState) {
alert("Player's new state: " + newState);
}
Could someone help me figure out why none of this code appears to be firing?