[video_player_android] Fix rendering freeze after full-screen transit…#11416
Open
moepanda wants to merge 1 commit intoflutter:mainfrom
Open
[video_player_android] Fix rendering freeze after full-screen transit…#11416moepanda wants to merge 1 commit intoflutter:mainfrom
moepanda wants to merge 1 commit intoflutter:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the video_player_android package to version 2.9.6 and addresses a bug where videos freeze after returning from full-screen transitions. The changes introduce a custom VideoSurfaceView that re-binds the ExoPlayer to the surface upon visibility changes and refactors surface management to use a manual binding process with a seek-based workaround for Android 9 rendering issues. Review feedback suggests optimizing the seek operation by checking if the player is already playing to avoid performance stutters and refining the visibility check in onVisibilityChanged with isShown() to prevent redundant surface bindings.
...oid/android/src/main/java/io/flutter/plugins/videoplayer/platformview/PlatformVideoView.java
Outdated
Show resolved
Hide resolved
...oid/android/src/main/java/io/flutter/plugins/videoplayer/platformview/PlatformVideoView.java
Outdated
Show resolved
Hide resolved
bb099a6 to
a04a4f7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes flutter/flutter#184241
Description
When using
PlatformViewmode on Android, the video freezes (frozen on a specific frame) after returning from a full-screen dialog or route transition. This happens because theSurfaceis destroyed when the view is hidden, andExoPlayerdoes not automatically re-attach to the newSurfacewhen it becomes visible again.Changes
VideoSurfaceViewsubclass that overridesonVisibilityChangedto re-bindExoPlayerto the currentSurfacewhenever the view becomes visible again.bindPlayerToSurfacehelper to centralize surface binding and the Android 9 seek workaround.clearVideoSurface(surface)insurfaceDestroyedto safely unbind only the current surface.PlatformVideoViewTestto use Robolectric'sShadowSurfaceViewAPI for lifecycle simulation.Pre-Review Checklist
[shared_preferences]///).