Skip to content

[Android][Impeller]we need to be notified before destroying the surface #152839

@xxoo

Description

@xxoo

Use case

I've read the migration guide and the migrated source of video_player.
Solution for the image loss problem in video_player:

In onSurfaceDestroyed, save and destroy the state of ExoPlayer, and then restore it in onSurfaceCreated. However, I believe this is a rather expensive operation, especially since the restoration process may cause noticeable pauses for the user. More importantly, it requires the video to stop playing, which may not be acceptable for some apps.
Therefore, I think a more efficient method should be used to solve this problem.

Proposal

Introduce an onSurfaceDestroying event.
In this event, we can remove the destroying surface from ExoPlayer to prevent errors. Then just call SetVideoSurface() in onSurfaceCreated (or even onSurfaceDestroyed). That should be able to avoid the steps of saving, destroying and restoring the state of ExoPlayer.

Metadata

Metadata

Assignees

Labels

P3Issues that are less important to the Flutter projectc: proposalA detailed proposal for a change to Fluttere: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.platform-androidAndroid applications specificallyr: invalidIssue is closed as not validteam-engineOwned by Engine teamtriaged-engineTriaged by Engine team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions