-
Notifications
You must be signed in to change notification settings - Fork 998
Description
Is there an existing issue for this?
- I have searched the existing issues
Package
youtube_player_flutter
What happened?
YouTube Error 153 on Windows Desktop
Problem
YouTube videos fail to play in the app on Windows desktop (and maybe Android) with Error 153: "Video player configuration error". The same videos work fine when embedded in a regular web browser.
Environment
- Platform: Windows Desktop
- Package Version: youtube_player_flutter ^9.0.0
- Flutter Version: (3.38.3)
- WebView: flutter_inappwebview (WebView2 on Windows)
Error Details
Console shows:
[WindowsInAppWebViewController] (windows) WebView ID calling "Errors" using [153]
Root Cause
YouTube now requires the referrerpolicy="strict-origin-when-cross-origin" attribute on embedded iframes. The youtube_player_flutter package uses flutter_inappwebview internally, which on Windows uses WebView2. The package doesn't expose a way to configure the referrer policy, so YouTube's embedded player cannot verify the request and returns Error 153.
Expected Behavior
Videos should play on Windows desktop just like they do on Android/iOS/macOS or in a regular web browser.
Actual Behavior
Videos fail to load with Error 153 on Windows desktop only.
Additional Context
- Videos work fine in browser embeds with
referrerpolicyattribute - Videos work on other platforms (Android/iOS/macOS)
- This is specifically a Windows desktop issue with WebView2
Proposed Solution
The package needs to configure the WebView/iframe to send proper referrer information, or expose a way for developers to configure the referrer policy for Windows desktop builds.
What is the expected behaviour?
YouTube videos should play successfully on Windows desktop platform, matching the behavior on other platforms (Android/iOS/macOS) and in regular web browsers. The embedded YouTube player should initialize and play videos without Error 153.
How to reproduce?
- Create a Flutter app with
youtube_player_flutter: ^9.0.0 - Initialize a
YoutubePlayerControllerwith any valid YouTube video ID - Build and run the app on Windows desktop platform
- Attempt to play a YouTube video
Expected Result: Video plays successfully
Actual Result: Video fails to load with Error 153 ("Video player configuration error")
Console Output:
[WindowsInAppWebViewController] (windows) WebView ID calling "Errors" using [153]
Additional Notes:
- The same videos work fine when embedded in a regular web browser
- The same code works on Android/iOS/macOS platforms
- This issue is specific to Windows desktop (WebView2)
Flutter Doctor Output
[√] Flutter (Channel stable, 3.38.3, on Microsoft Windows [Version 10.0.26200.7462], locale en-GB) [240ms]
• Flutter version 3.38.3 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 19074d12f7 (7 weeks ago), 2025-11-20 17:53:13 -0500
• Engine revision 13e658725d
• Dart version 3.10.1
• DevTools version 2.51.1
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging
[√] Windows Version (Windows 11 or higher, 25H2, 2009) [559ms]
[√] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [1,542ms]
• Android SDK at C:\Users\marke\AppData\Local\Android\sdk
• Emulator version 36.3.10.0 (build_id 14472402) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• Java binary at: C:\Users\marke\AppData\Local\Programs\Android Studio\jbr\bin\java
This is the JDK bundled with the latest Android Studio installation on this machine.
To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 21.0.8+-14196175-b1038.72)
• All Android licenses accepted.
[√] Chrome - develop for the web [58ms]
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.20) [57ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.14.36705.20
• Windows 10 SDK version 10.0.26100.0
[√] Connected device (3 available) [128ms]
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.26200.7462]
• Chrome (web) • chrome • web-javascript • Google Chrome 143.0.7499.193
• Edge (web) • edge • web-javascript • Microsoft Edge 143.0.3650.139
[√] Network resources [336ms]
• All expected network resources are available.
• No issues found!