Fix Potential Race Condition in Video Player Text Track Selection
Description
Potentially fixed a crash that happens when text tracks get selected while the player is being destroyed. Super hard to reproduce but shows up in crash logs. Basically the player exists when we start the async operation but might be gone by the time we try to use it.
Changes
Added weak self in async block
Added guard check for player instance
Made sure we have strong reference to player during async operation
Steps to Maybe Reproduce
Really hard to get this consistently, but here's what might trigger it:
Switch videos really fast
Change text tracks while video is loading
Background the app during text track changes
Type of Change
[x] Bug fix (non-breaking change that fixes an issue)
[ ] New feature (non-breaking change that adds functionality)
[ ] Breaking change (fix or feature that would break existing functionality)
Fix Potential Race Condition in Video Player Text Track Selection
Description
Potentially fixed a crash that happens when text tracks get selected while the player is being destroyed. Super hard to reproduce but shows up in crash logs. Basically the player exists when we start the async operation but might be gone by the time we try to use it.
Changes
Steps to Maybe Reproduce
Really hard to get this consistently, but here's what might trigger it:
Type of Change
Screenshots
Checklist