Skip to content

Android 16 (Samsung) - embedded player never becomes ready (onReady not called), black screen #1287

Description

@bbratu

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

  1. Install on Samsung Android 16 (WebView ~134)
  2. Create YouTubePlayerView with app:enableAutomaticInitialization="false"
  3. 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.)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions