Externally loaded text tracks not loading properly (#3461)

* fix text tracks

* keep map

* use where

* update change log

* fix build error
This commit is contained in:
Bryan 2024-01-14 22:31:22 -08:00 committed by GitHub
parent 045f5fa008
commit 8f1bdb7c36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 2 deletions

View File

@ -86,6 +86,7 @@
## Next ## Next
- Android, iOS: add onVolumeChange event #3322 - Android, iOS: add onVolumeChange event #3322
- iOS: Externally loaded text tracks not loading properly [#3461](https://github.com/react-native-video/react-native-video/pull/3461)
### Version 6.0.0-alpha.9 ### Version 6.0.0-alpha.9
- All: add built-in typescript support [#3266](https://github.com/react-native-video/react-native-video/pull/3266) - All: add built-in typescript support [#3266](https://github.com/react-native-video/react-native-video/pull/3266)

View File

@ -18,7 +18,7 @@ enum RCTPlayerOperations {
// The first few tracks will be audio & video track // The first few tracks will be audio & video track
var firstTextIndex = 0 var firstTextIndex = 0
for i in 0 ..< trackCount where (player?.currentItem?.tracks[i].assetTrack?.hasMediaCharacteristic(.legible)) != nil { for i in 0 ..< trackCount where player?.currentItem?.tracks[i].assetTrack?.hasMediaCharacteristic(.legible) ?? false {
firstTextIndex = i firstTextIndex = i
break break
} }

View File

@ -1206,7 +1206,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
"orientation": orientation, "orientation": orientation,
], ],
"audioTracks": audioTracks, "audioTracks": audioTracks,
"textTracks": textTracks.map(\.json), "textTracks": self._textTracks?.compactMap { $0.json } ?? textTracks.map(\.json),
"target": self.reactTag as Any]) "target": self.reactTag as Any])
} }
} }