Youtube_player_flutter: [BUG] Error 150 on some videos

Created on 17 Nov 2019  Â·  23Comments  Â·  Source: sarbagyastha/youtube_player_flutter

This is the video: https://www.youtube.com/watch?v=GUqcY8WNTZs

Error: The owner of the requested video may not allow it to be played.

Video embedding is turned on for the video and other videos.

bug fixed

Most helpful comment

hi,
i still have this error on 6.1.0+4.

All 23 comments

Error 150 is not well documented. Couldn't figure out why its not playing the video.
Also, the thumbnail for the video is not available https://i3.ytimg.com/vi_webp/GUqcY8WNTZs/sddefault.webp

@sarbagyastha I think it's because it has copyrighted music in it.

Oh yes @EliasDeuss , tested 5 videos from the same channel and videos with no copyrighted music played without 150 , whereas videos with copyrighted music resulted with 150.

@sarbagyastha There should be option to open the video on Youtube if not available in the player.

@EliasDeuss You can implement it on your own by listening to the errors.

This error doesn't for 4.1.0 or lower version

I can confirm. I tried to upgrade from 4.1.0 to latest version and just now I get this error. Never had it using version 4.1.0. What changed?

@sarbagyastha How are we supposed to catch playback errors?

I am trying to embed YouTube videos but some of them are restricted to only play on a specific domain. I want to try to catch this error before even showing the play button and instead show that it can't be played. Is there a way to do this?

The best would be if we could play with the referrer headers. This StackOverflow post makes it seem like it's possible. Is there any way to do this with this plugin?

@sarbagyastha I think what @TheBestMoshe suggested might fix most of the Error 150 issues

@TheBestMoshe Thank you for pointing out. I will definitely look into it.

Here's what I found so far:

Error Overview

youtube_player_flutter uses Youtube IFrame API for embedding Youtube player using flutter_webview, and the IFRAME API is producing the error. Here's the link to view all the errors that the player may receive: https://developers.google.com/youtube/iframe_api_reference#Events

The ones associated with Error 150 are:
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!

Which means the video owners have disabled the videos to be played embedded.

Video Metadata
I tried checking the embeddable, restricted and other properties of videos which were not working using the YouTube Data API to get the key:

https://www.googleapis.com/youtube/v3/videos?id=[VIDEO_ID]&key=[API_KEY]&part=snippet,contentDetails,status

I couldn't find any difference in the metadata of the videos which were blocked and unblocked.

Error Reporting
In the RawYoutubePlayer widget internally used by the plugin, on error occurrence, error code (e.g. 150) is set as the value for controller.value here:
https://github.com/sarbagyastha/youtube_player_flutter/blob/6f21d8b25019394257c71b7399c9199ee5198a17/lib/src/player/raw_youtube_player.dart#L175-L181

I think controller.value could be monitored for error reporting and handling, though better handling using onError method exposed, and some info in the documentation would be very helpful too.

I have the same issue, even using my own videos

I tried using 4.1.0 but was not able to get the example to work for that version. One difference is the origin field in playerVars is no longer set. I tried setting origin in playerVars but no luck.

Weirdly enough, I experienced the same error using natiave library https://github.com/hmhv/YoutubePlayer-in-WKWebView but I was able to successfully embed the video after setting origin to https://www.youtube.com

So this seems like a fixable issue for some videos. Might be related to referer.

More info - I was able to embed the video using another flutter library https://github.com/hoanglm4/flutter_youtube_view

same error with all kind video
not special one include example video

Any update on this issue?

Fixed with Version 6.1.0

The issue is solved. Thank you!

hi,
i still have this error on 6.1.0+4.

The issue still persist-> This video

hi, from s.korea
i still have this error, too.
the video i wanna play is copyrighted video(MV).
i can play on emulator, but cannot play on real device (Pixel 3) via google play released. No error message, loading circle runs infinitely.

anyone like me?

it still persist.
even if the video contain sound cloud's music, not copyright by youtube.

With me, the problem was that I lowered all case on the video id, and it's case sensitive. Instead of YE7VzlLtp-4, I was sending ye7vzlltp-4.

Was this page helpful?
0 / 5 - 0 ratings