[iOS13] Fails taking current subtitle mediaSelectionGroup

Hello,


I think I just found a bug in iOS13, when setting a readable AVMediaSelectionOption.


Due to the flow that we follow in our app, in first instances we set nil to the readable .mediaSelectionGroup.

The problem comes when trying to recover the value of selectedMediaOption for the previous group.

In iOS13 it always returns the first mediaSelection that has the AVAsset. In below versions it returns nil, which is what it should be.


I have checked if the AVMediaSelectionGroup has the value of allowsEmptySelection a true and is correct.


I add an example:


guard let item = avPlayer.currentItem,
  let mediaSelectionGroup = item.asset.mediaSelectionGroup(forMediaCharacteristic: .legible)
  else { return -1 }
// Set nil for empty subtitle.
item.select(nil, in: mediaSelectionGroup)
// Get the current subtitle selected. It must be nil.
let selected = item.currentMediaSelection.selectedMediaOption(in: mediaSelectionGroup)


With that example, selected var must be nil. In iOS13, selected var is the subtitle mediaSelectionGroup that has the AVAsset, in below versions for iOS the value is nil. What could be happening?


Best regards