'Is YouTube IFrame API already loaded

I want to know if the API has already been loaded. I can't find anything about it here:

YouTube Player API Reference for iframe Embeds https://developers.google.com/youtube/iframe_api_reference

Is there anyone here who knows how to find out? (There is a global variable YT, but that does not seem to be an official way to check it.)



Solution 1:[1]

There is nothing in the documentation, but looking at the code this is what is used:

window["YT"]

Solution 2:[2]

Currently I am using undocumented solution to check if onYouTubeIframeAPIReady was reached:

if (typeof YT !== 'undefined' && YT.loaded) {
    //API is ready
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Leo
Solution 2