0

Flutter video_player with viewType: VideoViewType.platformView causes lag when navigating back

I am using the video_player package in my Flutter app.
My controller is initialized like this:

_controller = VideoPlayerController.networkUrl(
  Uri.parse('https://flutter.github.io/assets-for-api-docs/assets/videos/bee.mp4'),
  viewType: VideoViewType.platformView,
)..initialize().then((_) {
  setState(() {});
});

The issue happens only with viewType: VideoViewType.platformView.

When I navigate back from the screen that has the video, the widget lags/drops for a second before completing the navigation.

Here’s a short screen recording showing the problem:
Flutter video_player PlatformView causes lag when navigating back


Screenshots for better explanation

  • Navigation to video screen:
    Video Screen

  • Navigating back (video widget is still there for a few seconds, causing lag):
    Lag on Back


Why I am using PlatformView

I specifically need VideoViewType.platformView because I want to implement DRM (Digital Rights Management) content playback.


Flutter doctor output

[✓] Flutter (Channel stable, 3.35.1, on Microsoft Windows [Version 10.0.26100.4652], locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
    ! 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 Build Tools 2019 16.11.45)
[✓] Android Studio (version 2025.1.2)
[✓] Android Studio (version 2024.3)
[✓] VS Code (version 1.103.1)
[✓] Connected device (4 available)
[✓] Network resources

Question

  • Is this a known issue with viewType: VideoViewType.platformView?
  • Is there a way to avoid this navigation lag when using platformView?
  • Any workaround to smoothly dispose/detach the PlatformView video widget before navigation?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.