fix(ios): ensure we don't disable tracks when not necessary (causes black screen) (#4130)

This commit is contained in:
Olivier Bouillet
2024-09-02 19:08:27 +02:00
committed by GitHub
parent fbe570d62f
commit 89df9d69ff
2 changed files with 9 additions and 1 deletions

View File

@@ -15,11 +15,15 @@ enum RCTPlayerOperations {
let trackCount: Int! = player?.currentItem?.tracks.count ?? 0
// The first few tracks will be audio & video track
var firstTextIndex = 0
var firstTextIndex = -1
for i in 0 ..< trackCount where player?.currentItem?.tracks[i].assetTrack?.hasMediaCharacteristic(.legible) ?? false {
firstTextIndex = i
break
}
if firstTextIndex == -1 {
// no sideLoaded text track available (can happen with invalid vtt url)
return
}
var selectedTrackIndex: Int = RCTVideoUnset