The onError event handler returns event.data = 0, generally for removed or private videos (although I haven't tested all cases yet), rather than the documented error values on the YouTube IFrame API Reference (https://developers.google.com/youtube/iframe_api_reference#Events)
onError
This event fires if an error occurs in the player. The API will pass an event object to the event listener function. That object's data property will specify an integer that identifies the type of error that occurred. Possible values are:
2 – 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. 5 – The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred. 100 – The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private. 101 – The owner of the requested video does not allow it to be played in embedded players. 150 – This error is the same as 101. It's just a 101 error in disguise!
This is happening on Mac OS X, in Chrome, Firefox and Safari, latest versions. Here is a link to a removed video that returns this error code when embedded using the IFrame API: http://www.youtube.com/watch?v=-TefH2gu9-o
Testing this video in the Player API Demo also returns 0 (for the AS3 player; when selecting IFrame, it returns [object Object]
and is not inspectable).
The expected error code would be 100 or greater.
[object Object]
because the code in onPlayerError doesn't expect or defend against a value of 0 being returned. So I can only assume that this is a bug that was introduced into the API some time recently and has yet to be resolved. Given that this is the only way to report these issues for the YouTube API now, I'd appreciate a response on this. – Mina Mikhail