Guard against setting text tracks before player is initialized

This commit is contained in:
Jesse Sessler 2022-11-28 15:15:50 -06:00
parent 95b297df62
commit a39dca28a8

View File

@ -132,6 +132,8 @@ enum RCTPlayerOperations {
let type = criteria?.type let type = criteria?.type
let group:AVMediaSelectionGroup! = player?.currentItem?.asset.mediaSelectionGroup(forMediaCharacteristic: characteristic) let group:AVMediaSelectionGroup! = player?.currentItem?.asset.mediaSelectionGroup(forMediaCharacteristic: characteristic)
var mediaOption:AVMediaSelectionOption! var mediaOption:AVMediaSelectionOption!
guard group != nil else { return }
if (type == "disabled") { if (type == "disabled") {
// Do nothing. We want to ensure option is nil // Do nothing. We want to ensure option is nil