Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect blocked youtube videos through javascript

Tags:

People also ask

How do you check if a YouTube video is blocked?

Once on the "Video Rules" screen, paste URL of YouTube video in the top box and hit "Check". This will tell you if the video will be accessible to students or not. If the video is blocked and you'd like to request that it be whitelisted, <do this> (process to be determined).


How to detect if a youtube video is not playable?

I am aware there is a way by calling a request to the youtube api however this would take too much time to check for each video since the videos are playing on user request.

Is there a way to check on the status of the youtube player and if it does not play then act accordingly?

I know there a few status like ready, stopped, playing, qued. Couldnt find a status for this specific thing.

Thanks in advance

ok I have found the solution. But it wouldnt let me post it because im not cool enough like you guys. Here it is:

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

function onPlayerError(errorCode) {
    playnext();
}

if you want to check for a certain error the error codes are on the youtube site. However this was enough for me.