videojs / videojs-youtube

YouTube playback technology for Video.js
1.13k stars 549 forks source link

`YT is not defined` in a small number of cases #610

Open george-ayris opened 1 year ago

george-ayris commented 1 year ago

Thanks for your work on this library - largely it seems to be working very well!

I'm seeing an issue for a small number of users and was hoping you can point me in the right direction to investigate.

I'm seeing the following from our monitoring system:

image

It appears to be happening on first page load.

I'm using:

    "video.js": "^8.3.0",
    "videojs-youtube": "^3.0.1"

The libraries are installed from npm and packaged into a single js file as part of a vue application.

I've not been able to repo this personally and, from a brief read of the code in this repository, I can't see anything obvious that would be causing it.

Any pointers would be much appreciated.

george-ayris commented 1 year ago

To add to this, it appears to be happening when the call to https://www.youtube.com/iframe_api fails with a status code of 0, e.g.

image

My guess is this is then triggering one of the callback()s in here.

How should this library respond if https://www.youtube.com/iframe_api cannot be loaded?

theprojectfactory commented 10 months ago

We're having the same issue. 65 errors in a fortnight. Our Sentry is picking up this as an error, however I am unable to reproduce it myself manually.

bulbil commented 3 months ago

Same, while this works very well for our environment but we are also getting slammed by Sentry errors -- at the very least I was wondering if it might be possible to avoid loading the script unless the video player is initialized.

I would be happy to take a pass at this if this is something folks using this plugin in a Vue app would be interested in.