fix(ios): handle async player access in text track selection (#4293)
* fix(ios): add null check to setSelectedTextTrack for player instance * Revert "fix(ios): add null check to setSelectedTextTrack for player instance" This reverts commit 447c83423cdd77b0cfa9cc171b231327a2cf1586. * fix(ios): ensure strong reference to player during async operation * fix: linter * fix: linter formatting * fix: revert typo
This commit is contained in:
parent
d934f214f5
commit
daaac9740a
@ -967,10 +967,16 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH
|
|||||||
guard let source = _source else { return }
|
guard let source = _source else { return }
|
||||||
if !source.textTracks.isEmpty { // sideloaded text tracks
|
if !source.textTracks.isEmpty { // sideloaded text tracks
|
||||||
RCTPlayerOperations.setSideloadedText(player: _player, textTracks: source.textTracks, criteria: _selectedTextTrackCriteria)
|
RCTPlayerOperations.setSideloadedText(player: _player, textTracks: source.textTracks, criteria: _selectedTextTrackCriteria)
|
||||||
} else { // text tracks included in the HLS playlist§
|
} else { // text tracks included in the HLS playlist
|
||||||
Task {
|
Task { [weak self] in
|
||||||
await RCTPlayerOperations.setMediaSelectionTrackForCharacteristic(player: _player, characteristic: AVMediaCharacteristic.legible,
|
guard let self,
|
||||||
criteria: _selectedTextTrackCriteria)
|
let player = self._player else { return }
|
||||||
|
|
||||||
|
await RCTPlayerOperations.setMediaSelectionTrackForCharacteristic(
|
||||||
|
player: player,
|
||||||
|
characteristic: .legible,
|
||||||
|
criteria: self._selectedTextTrackCriteria
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user