2

When I try to load certain videos (such as popular songs), the API returns the error code 150 (video requested does not allow playback in the embedded players). However, it works if I load the video in an iframe or embed tag.

This works:

<iframe width="560" height="315" src="http://www.youtube.com/embed/j5-yKhDd64s" frameborder="0" allowfullscreen></iframe>

This also works:

<object width="560" height="315"><param name="movie" value="http://www.youtube.com/v/j5-yKhDd64s?version=3&amp;hl=en_GB"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/j5-yKhDd64s?version=3&amp;hl=en_GB" type="application/x-shockwave-flash" width="560" height="315" allowscriptaccess="always" allowfullscreen="true"></embed></object>

This alerts the 150 error:

var defaultVideo = 'j5-yKhDd64s';
var player;
function onYouTubePlayerAPIReady() {
 player = new YT.Player('player-wrap', {
 height: '390',
 width: '640',
 videoId: defaultVideo,
 events: {
 'onError': onPlayerError
 }
 });
}
function onPlayerError(event) {
 alert('Error: '+event.data);
 player.stopVideo();
 player.loadVideoById('');
}

Why is this?

Here's the reference for the API: http://code.google.com/apis/youtube/js_api_reference.html#Events

asked Nov 11, 2011 at 1:53
1

3 Answers 3

1

This error code dates back from 2009+, If you get error code 150, the video won't work on any browser or any player.

Error code 150: The video can only be player with advertisements at youtube.

answered Jul 11, 2012 at 10:28
Sign up to request clarification or add additional context in comments.

Comments

1

Look at https://developers.google.com/youtube/js_api_reference#onError

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!

answered Dec 5, 2014 at 1:17

Comments

0

I've had a similar issue when embedding some protected videos using the Iframe API. The videos were playing on Chrome, but resulting in a error 150 when browsing with Firefox and Safari.

The only workaround I found was to switch back to the Javascript API that relies on a Flash embed. For some reason, all video embeds now work on every browser, I have not seen any error 150 since then.

answered Jun 14, 2012 at 10:02

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.