mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

When the AdTagLoader is deactivated because of a player error, the error callback is already pending on the app's main thread, but not yet executed. This means the VideoAdPlayerCallback instances registered in AdTagLoader won't receive this error event if the Player.Listener is immediately removed from AdTagLoader. This can be fixed by postponing the deregistration until after already pending messages have been handled. As this means other callbacks can be triggered now with player==null, this check needs to be added to other callbacks to avoid handling stale events. Issue: androidx/media#1334 PiperOrigin-RevId: 630068222