Closed ak545 closed 6 years ago
The one specified by the user should be executed in conjunction with the others that must be executed anyway.
Now after YTPPlayNext in the standard error handler in the user function, the VideoID is already different (not the one that caused the error), So, if I want to track the video's restricted, I do not recognize its ID because mb.YTPlayer first calls the video change method (jQuery( YTPlayer ).YTPPlayNext();), and after that calls the user function.
The solution is to execute the user callback before the others :
'onError': function( err ) {
if( typeof YTPlayer.opt.onError == "function" )
YTPlayer.opt.onError( $YTPlayer, err );
switch (err.data) {
case 2:
console.error( "video ID:: " + YTPlayer.videoID + ": The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks." );
case 5:
console.error( "video ID:: " + YTPlayer.videoID + ": The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred." );
case 100:
console.error( "video ID:: " + YTPlayer.videoID + ": The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private." );
case 101:
case 150:
console.error( "video ID:: " + YTPlayer.videoID + ": The owner of the requested video does not allow it to be played in embedded players." );
}
if( YTPlayer.isList )
jQuery( YTPlayer ).YTPPlayNext();
}
Yes exactly. Thank you!
Hi, pupunzi! This piece of code:
should be done like this:
If a user function is specified, then execute it. If not, then perform the standard. Best Regards, Andrey Klimov :)