YouTube video as DOM element in Phaser

Hi there everyone,

I have been hard at work here working with the new DOM elements from the Phaser 3.17 update. What I’m trying to do is use the new DOM elements to have YouTube injected onto an IFrame DOM element that is made in Phaser. What I have read from the YouTube API references is that you need to load the API from YouTube onto the top-most level of the web page you want the embedded video to be used on. In our application, Phaser is being nested away a couple of scripts under the injected YouTube API. So when I actually inject the new IFrame from YouTube, Phaser loses it’s reference and I can’t manipulate it anymore. Anyone has any ideas on how to go about this?

I am making a Youtube player plugin. Here is a demo of current result.