iOS 13, subtitle selection not working

Hi,


We have an issue only happens on iOS 13, after select a subtitle for a video, but the selectedMediaOption function still return nil. Even we can

see the subtitle is showing on the video. and It's only happens on iOS 13, same code works fine on iOS 12.


Here is the code:


extension AVPlayerItem {


func subtitlesSelected() -> AVMediaSelectionOption? {

guard let legibleOptions = asset.mediaSelectionGroup(forMediaCharacteristic: .legible),

!legibleOptions.options.isEmpty else {

return nil

}


let selected = currentMediaSelection.selectedMediaOption(in: legibleOptions)

return selected

}

}


The return value for this method will always nil on iOS13, even selected subtitle is showing on the video.


Is it a iOS 13 bug?


Environment:

XCode 11

iOS 13

Catalina


Matthew