2

(This might be a bug in the library, so also filed as a github issue here.)

I would like to detect when react-player fails to play a youtube video due to privacy settings or age restrictions. It seems that sometimes a play failure will result in onError getting called with error value 150 (corresponding to these sorts of restrictions) but it is not consistent. (See below.)

Is there a recommended way to detect this failure condition?

The following steps show why the onError callback is insufficient for these purposes:

  1. Go to the react player demo and enter url of a video that is age-restricted (example) or private (example) into the custom URL text input, then click load. Content heads-up: both examples contain footage from the U.S. Capitol on January 6, 2021; neither load in the player at the time of writing this question.)

  2. Check the browser's javascript console. Observe from the console log that onReady, onDuration and onProgress have fired, but onError is not present.

  3. Now get the URL of a public video (example), enter it into the custom URL field and click load. Observe the player successfully plays the video.

  4. Finally, re-enter the URL of the video in step 2 and press load once more. This time, in the javascript console the message onError 150 appears.

The goal is to get onError to fire in step 2 (or some equivalently reliable method of failure detection).

0 Answers0