

The function indicates that when playing a video (state=1), The API calls this function when the player's state changes. The API will call this function when the video player is ready. This function creates an (and YouTube player) Var firstScriptTag = document.getElementsByTagName('script') į(tag, firstScriptTag)

Var tag = document.createElement('script') You can use this library, which both initially sizes your iframe correctly and also keeps it at the right size by detecting whenever the size of the iframes content changes (either via regular checking in a setInterval or via MutationObserver) and resizing it. This code loads the IFrame Player API code asynchronously.
(and video player) will replace this tag. An