Skip to content

[BUG] WebView stays visible briefly after closing the player (ghost overlay) + "AndroidInAppWebViewController used after being disposed" #1143

@maysam-ite

Description

@maysam-ite

Is there an existing issue for this?

  • I have searched the existing issues

Package

youtube_player_flutter

What happened?

I’m experiencing a UI issue when using youtube_player_flutter on Android.
When I navigate back from the video screen (Get.back() or Navigator.pop()), the video WebView does not disappear immediately.

What happens

  • The app navigates back normally.

  • But the video continues to render for ~0.2–0.5 seconds on top of the new screen.

  • A “ghost frame” of the YouTube video appears temporarily and then disappears.

  • During this moment, the UI lags/stutters.

What is the expected behaviour?

The WebView should be immediately destroyed.

No video frame should remain briefly visible.

No asynchronous dispose errors should appear.

How to reproduce?

  • make the video play
  • navigate back to prev screen

Flutter Doctor Output

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.35.7, on Microsoft Windows [Version 10.0.26200.7019], locale en-US)
[√] Windows Version (11 Home 64-bit, 25H2, 2009)
[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0-rc5)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.11.5)
[√] Android Studio (version 2024.1)
[√] VS Code (version 1.106.1)
[√] Connected device (4 available)
[√] Network resources

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions