fix(FEC-11655): System highlights 2 options (captions) after clicking the "Change media" button on Safari #612
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the Changes
issue: look at _getParsedTextTracks() on https://github.com/kaltura/playkit-js/blob/master/src/engines/html5/media-source/adapters/native-adapter.js#L696
when this method called at the second time (like after calling changeMedie() in this case) the textTracks including the external text trcak.
and the first condition evaluates to false and therefore the indexes start from 1 instead of 0 which leads to an incorrect index value (that is - same index for two different tracks) on the getExternalTracks() method in (https://github.com/kaltura/playkit-js/blob/master/src/track/external-captions-handler.js#L118) since it is relying on the textTracks.langth.
and that bring the method the _markActiveTrack(track: Track) method on https://github.com/kaltura/playkit-js/blob/master/src/player.js#L2414 to mark both tracks as active
fix: in the native adapter not relying on the for index which progresses regardless of actual track index
solves: FEC-11655
CheckLists