There needs to be a check in our code that the YT/Vimeo APIs are loaded before we start interacting with them. For Youtube, here is the code we had before, but were not using:
// This seems to be a requirement of the YouTube Player API for iframe embeds
// https://developers.google.com/youtube/iframe_api_reference#Requirements
window.onYouTubeIframeAPIReady = () => {
};
There needs to be a check in our code that the YT/Vimeo APIs are loaded before we start interacting with them. For Youtube, here is the code we had before, but were not using: