Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Flutter and app store releases

Embedded YouTube video shows Video unavailable (Error 153) in a Flutter app

ErrorVideo unavailable

Short answer

Error 153 means the embedded player got no HTTP Referer header or other client identification. A WebView sends an empty Referer by default, so set one that is an https URL of your app ID. On Flutter web, do not suppress the Referer. Errors 101 and 150 are different: the owner blocks embedding.

  • Applies to Flutter 3.35, Dart 3.9
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Note the exact error code on the player. 153 is about your app's request. 100, 101 and 150 are about the video itself.

    flutter run -v
  2. 2Match what you see, then jump to its fix

    1. 1Error 153 on Android or iOS, while the same video plays in a desktop browserThe player runs in a WebView that sends no RefererFix
    2. 2Error 153 only in the web buildFlutter web: the page suppresses the RefererFix
    3. 3Error 101 or 150 (or 100 for a removed or private video)The video owner does not allow embeddingFix

What does the error look like?

  • Video unavailable
  • Error 153
  • Error 101

Cause 1 of 3

The player runs in a WebView that sends no Referer

1Check

WebViews and apps send an empty Referer by default. YouTube requires embedded clients to identify themselves through the HTTP Referer header.

flutter pub deps | grep -i "webview\|youtube"

2Fix

Set the Referer yourself. It should be a fully qualified https URL whose domain is your app ID, in reverse-DNS form such as the package name, and it should stay stable across app versions. On Android the documented routes are the baseUrl of loadDataWithBaseURL or a Referer header on loadUrl. On iOS they are loadHTMLString with a baseURL or a Referer header on loadRequest. Check your player package for the matching option.

# Example Referer for an app with the id com.example.myapp
https://com.example.myapp

3Verify

Reload the screen. The player starts instead of showing the error.

flutter run

Confirmed by developers.google.com

Did this fix it?

Cause 2 of 3

Flutter web: the page suppresses the Referer

1Check

A Referrer-Policy that removes the Referer, or links opened with noreferrer, strips the client identity. YouTube recommends strict-origin-when-cross-origin.

curl -sI https://example.com | grep -i referrer-policy

2Fix

Send the recommended policy as a response header from the server that hosts the Flutter web app, and do not open the video link with noreferrer.

# response header to send with the Flutter web files
Referrer-Policy: strict-origin-when-cross-origin

3Verify

Reload the page and check that the response carries the header.

curl -sI https://example.com | grep -i referrer-policy

Confirmed by developers.google.com

Did this fix it?

Cause 3 of 3

The video owner does not allow embedding

1Check

101 and 150 mean the owner does not allow playback in embedded players. 100 means the video was removed or is private.

# open the video on youtube.com and look for an embed or privacy restriction

2Fix

Use a video that allows embedding, or ask the owner to allow it.

# no code change: use another video ID

3Verify

The new video plays in the player.

flutter run

Confirmed by developers.google.com

Did this fix it?

How do I stop it coming back?

  • Test the player on a real device and in a release build, not only in a desktop browser.
  • Keep one stable app ID and use it for the Referer in every release.
  • Add the origin parameter to the embed URL, as the IFrame API reference recommends.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine built on the same technologies:

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.