bitmovin / bitmovin-player-ui

The Bitmovin Adaptive Streaming Player UI
MIT License
126 stars 87 forks source link

Fix no subtitle on switching tracks #621

Closed mukulmishra18 closed 5 months ago

mukulmishra18 commented 5 months ago

Description

When switching between different subtitle track, sometime it does not show the subtitle cue anymore.

We are clearing subtitle label component on SubtitleEnabled and SubtitleDisabled. This should be added again on CueEnter event.

The event sequence coming from Player is sometime off. When enabling subtitle, the sequence of event looks like, SubtitleEnable, CueEnter and SubtitleEnabled. This makes the Label component added and removed again, causing no subtitle being shown.

We are now not removing the component on SubtitleEnabled but just on SubtitleDisabled. This should be enough as a previous subtitle is disabled when a new one is enabled.

Checklist (for PR submitter and reviewers)

mukulmishra18 commented 5 months ago

Did some manual testing and the changes looks okay. The only thing I can see is that we are getting 2 CueEnter events when PlayerSubtitleAPI.enable is called with exclusive is false. Both of the cues are shown in the UI when second subtitle is enabled. This is also same with old implementation, we get 2 CueEnter events and those are shown in the UI.