YouTube video works in browser but fails inside Flutter app with error 152-4


I am developing a Flutter app (Android 12 and Android 14 tested) and embedding YouTube videos using youtube_player_iframe (or youtube_player_flutter).

The videos:

  • Work perfectly in Chrome on the phone
  • Are set to "Unlisted"
  • Embedding is allowed
  • No age restrictions
  • No copyright claims

However, inside the Flutter app, the video does not load and shows:

Error code: 152-4
"This video is unavailable. Watch on YouTube."

Environment:

  • Flutter SDK: 3.x

  • Android device: Moto G60 / Android 12

  • Another test device: Android 14

  • WebView updated

Example initialization code:

YoutubePlayerController(
  initialVideoId: videoId,
  params: const YoutubePlayerParams(
    autoPlay: false,
    showFullscreenButton: true,
  ),
);

Questions:
Why would a video work in browser but fail inside a Flutter embedded player?
Is error 152-4 related to YouTube embed restrictions?
Is this a recent YouTube policy change?
Any help would be appreciated.

1
Feb 27 at 2:32 PM
User AvatarMegatron
#android#flutter#youtube#youtube-api

No answer found for this question yet.