The iframe_api is just a loader script and inserts another node for the actual API. Including YouTube's iframe_api script effectively loads 2 scripts instead of one. ![]() There could be a reason for this on some untested edge cases or mobile platforms, but none have been found yet. Testing seems to indicate that this message is needed only once, so this custom script only sends it once. YouTube's API repeatedly postMessage's a listening event to the iframe every 250ms. ![]() With more events available for use, a poll loop is no longer required for state update. YouTube's API provides a limited amount of events for checking state updates.Īs such, things like load progress or current time would require a poll loop. This makes it very difficult (or impossible) to use their API inside of a userscript, because the event (and subsequently the YT object) will exist on the main window object and not inside the userscript. YouTube's API requires a function called onYouTubeIframeAPIReady to exist somewhere in a tag on the page.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |