-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Description
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.