Skip to content

Commit

Permalink
Externally loaded text tracks not loading properly (#3461)
Browse files Browse the repository at this point in the history
* fix text tracks

* keep map

* use where

* update change log

* fix build error
  • Loading branch information
brycnguyen authored Jan 15, 2024
1 parent 045f5fa commit 8f1bdb7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ios/Video/Features/RCTPlayerOperations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion ios/Video/RCTVideo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
}
Expand Down

0 comments on commit 8f1bdb7

Please sign in to comment.