I believe what is happening is this:
- you are using a persistent symbol which means the youtube element will be the same across scenes
- in the first scene, the code is successfully loading the video that you request
- when you change scenes, the player is already created since it is a persistent symbol. Thus the code that sets the video id isn’t called, since this is in the onYouTubeIframeAPIReady() handler, and it is already loaded.
- The youtube video is simply reloaded by virtue on how persistent symbols move across scenes (I’d say this isn’t desired behavior, but there’s not much we can do about it).
What you’ll want to do instead is call a youtube API to change the video of the player, or simply don’t use persistent symbols and instead have a different video for each scene.