diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a532c3b..d5027c63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,6 +86,7 @@ ## Next - 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 - All: add built-in typescript support [#3266](https://github.com/react-native-video/react-native-video/pull/3266) diff --git a/ios/Video/Features/RCTPlayerOperations.swift b/ios/Video/Features/RCTPlayerOperations.swift index 9f7b66a5..809ea4ee 100644 --- a/ios/Video/Features/RCTPlayerOperations.swift +++ b/ios/Video/Features/RCTPlayerOperations.swift @@ -18,7 +18,7 @@ enum RCTPlayerOperations { // The first few tracks will be audio & video track 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 break } diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index 57f0f96f..c16dcfcd 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -1206,7 +1206,7 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH "orientation": orientation, ], "audioTracks": audioTracks, - "textTracks": textTracks.map(\.json), + "textTracks": self._textTracks?.compactMap { $0.json } ?? textTracks.map(\.json), "target": self.reactTag as Any]) } }