How to detect blocked YouTube videos using javascript

How to determine if a video from YouTube is being played?

I know that there is a way by calling a request on youtube api, however it will take too much time to check each video, since the videos are played at the user's request.

Is there a way to check the status of the YouTube player and if it does not play, then proceed accordingly?

I know that there are several statuses, such as ready, stopped, playing, qued. Could not find status for this particular thing.

Thanks in advance

ok I found a solution. But that did not allow me to publish it, because I am not cool enough like you guys. Here he is:

onYouTubePlayerReady = function() { player.addEventListener("onError", "onPlayerError"); } function onPlayerError(errorCode) { playnext(); } 

if you want to check for a specific error, the error codes are on the youtube website. However, that was enough for me.

+8
javascript youtube
source share
2 answers

If "blocked" means that you have been deleted by the user or deleted due to copyright infringement, your answer will be in this thread ....

+2
source share

I don’t know how you did it, but I did it like this:

  ... events{ ... 'onError': onPlayerError } ... function onPlayerError(errorCode) { playnext(); } ... 
-one
source share

All Articles