Hi, thanks for the library.
We’re using android-youtube-player:
com.pierfrancescosoffritti.androidyoutubeplayer:core:13.0.0
com.pierfrancescosoffritti.androidyoutubeplayer:custom-ui:13.0.0
com.pierfrancescosoffritti.androidyoutubeplayer:chromecast-sender:0.32
Problem
On some Samsung devices running Android 16, the embedded player shows a black area and never calls onReady. Playback works when opening the same video in the YouTube app and on other devices.
Environment (example)
- Device: Samsung SM-F766B / SM-F766U
- Android: 16
- WebView:
com.google.android.webview 134.0.6998.135
What we observed
The internal HTML loads (baseUrl https://<appPackage>/) and the WebView requests:
https://www.youtube.com/iframe_api
But inside the WebView:
typeof window.YouTubePlayerBridge === "object"
typeof window.onYouTubeIframeAPIReady === "function"
window.YT stays undefined even after several seconds
JS probe result:
{"location":"https:///","bridge":"object","callbacks":"object","YT":"undefined","YTPlayer":"missing","onYouTubeIframeAPIReady":"function","hasDOM":true}So the script is requested but window.YT never becomes available, therefore new YT.Player(...) is never reached and onReady is never fired.
Steps to reproduce
- Install on Samsung Android 16 (WebView ~134)
- Create
YouTubePlayerView with app:enableAutomaticInitialization="false"
- Initialize with:
IFramePlayerOptions options = new IFramePlayerOptions.Builder(context)
.controls(0)
.fullscreen(0)
.rel(0)
.ivLoadPolicy(1)
.ccLoadPolicy(1)
.build();
youTubePlayerView.initialize(new AbstractYouTubePlayerListener() {}, true, options);4. Call YouTubePlayerUtils.loadOrCueVideo(...)
5. Result: black screen, onReady never called.
Expected
onReady is called and playback works.
Actual
onReady is never called (black screen).
Workaround
We implemented a timeout + fallback (open video in YouTube app) and a “Retry” that recreates the YouTubePlayerView. We’d prefer a library-side fix or recommended configuration.
Question
Is this a known issue with Android 16 / Samsung WebView? Any recommended workaround (different baseUrl/origin, iframe_api loading strategy, required WebView settings/cookies, etc.)?
Hi, thanks for the library.
We’re using
android-youtube-player:com.pierfrancescosoffritti.androidyoutubeplayer:core:13.0.0com.pierfrancescosoffritti.androidyoutubeplayer:custom-ui:13.0.0com.pierfrancescosoffritti.androidyoutubeplayer:chromecast-sender:0.32Problem
On some Samsung devices running Android 16, the embedded player shows a black area and never calls
onReady. Playback works when opening the same video in the YouTube app and on other devices.Environment (example)
com.google.android.webview 134.0.6998.135What we observed
The internal HTML loads (baseUrl
https://<appPackage>/) and the WebView requests:https://www.youtube.com/iframe_apiBut inside the WebView:
typeof window.YouTubePlayerBridge === "object"typeof window.onYouTubeIframeAPIReady === "function"window.YTstaysundefinedeven after several secondsJS probe result:
{"location":"https:///","bridge":"object","callbacks":"object","YT":"undefined","YTPlayer":"missing","onYouTubeIframeAPIReady":"function","hasDOM":true}So the script is requested but
window.YTnever becomes available, thereforenew YT.Player(...)is never reached andonReadyis never fired.Steps to reproduce
YouTubePlayerViewwithapp:enableAutomaticInitialization="false"IFramePlayerOptions options = new IFramePlayerOptions.Builder(context)
.controls(0)
.fullscreen(0)
.rel(0)
.ivLoadPolicy(1)
.ccLoadPolicy(1)
.build();
youTubePlayerView.initialize(new AbstractYouTubePlayerListener() {}, true, options);4. Call
YouTubePlayerUtils.loadOrCueVideo(...)5. Result: black screen,
onReadynever called.Expected
onReadyis called and playback works.Actual
onReadyis never called (black screen).Workaround
We implemented a timeout + fallback (open video in YouTube app) and a “Retry” that recreates the
YouTubePlayerView. We’d prefer a library-side fix or recommended configuration.Question
Is this a known issue with Android 16 / Samsung WebView? Any recommended workaround (different baseUrl/origin, iframe_api loading strategy, required WebView settings/cookies, etc.)?