Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does YouTube IFrame API onError value of 0 mean?

Tags:

youtube-api

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.

like image 707
Mina Mikhail Avatar asked Mar 24 '13 00:03

Mina Mikhail


People also ask

What is YouTube iFrame API?

The IFrame player API lets you embed a YouTube video player on your website and control the player using JavaScript. Using the API's JavaScript functions, you can queue videos for playback; play, pause, or stop those videos; adjust the player volume; or retrieve information about the video being played.

What is iFrame API?

Developers can use the iFrame API to programmatically create and interact with an Embed or with multiple Embeds in the same web app. The iFrame API includes methods that you can use to start playback, change the content rendering in an Embed, or stop playback.

How do I unmute an iFrame video?

Until and unless you have allow="autoplay;" in your iframe tag you wont be able to unmute the video. Add this attribute and further unMute function will work. Show activity on this post. Usually, you can just click the mute button to unmute it.


1 Answers

The error code of 100 is returned when HTML5 playback is used for video id "-TefH2gu9-o", but yes, when Flash playback is used, 0 is returned incorrectly. I'll follow up with the internal engineering team about that.

Re:

Given that this is the only way to report these issues for the YouTube API now...

We would very much encourage people to use the public issue tracker for bug reports related to the YouTube API, and only ask programming/technical questions on Stack Overflow (in keeping with Stack Overflow's larger mission). There are details about how to report bugs/feature requests at http://apiblog.youtube.com/2012/09/the-youtube-api-on-stack-overflow.html

like image 123
Jeff Posnick Avatar answered Nov 01 '22 11:11

Jeff Posnick