Skip to content

Stop loading uselessly YouTube iframe_api #72

@mlnor27

Description

@mlnor27

Hi everyone,

I would like to point out that src/loadYouTubeIframeApi.js loads the iframe_api script unnecessarily even though window.YT is already defined.

In line 15, there is a check
if (window.YT && window.YT.Player && window.YT.Player instanceof Function)...

and the line 36 which loads the script
load(protocol + '//www.youtube.com/iframe_api', (error) => {...

isn't in a else statement attached to the condition of line 15, and it must be in my opinion because it will prevent making a request to YouTube which is exactly what i would like because not only i have all the needed scripts being previously loaded and already exposing window.YT, but the app that i'm building lives behind a proxy restraining all external requests

I could submit a PR for that.
What do you think ?

Best regards

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions