iosavplayer

Get default audio stream with multiple language video stream


AVMediaSelectionGroup *group  = _availableLanguages;
AVMediaSelectionOption *option = group.options;

In option there is 3 languages:

<AVMediaSelectionKeyValueOption: 0x1d931bb0, mediaType = soun, locale = fr, title = lang, option ID = 0>,
<AVMediaSelectionKeyValueOption: 0x1d931ce0, mediaType = soun, locale = en, title = lang, option ID = 1, default = YES>,
<AVMediaSelectionKeyValueOption: 0x1d931d10, mediaType = soun, locale = de, title = lang, option ID = 2>

)

Could somebody tell me how can I get AVMediaSelectionKeyValueOption: 0x1d931ce0, mediaType = soun, locale = en, title = lang, option ID = 1, default = YES? Default is not a property, so I don't know to find out if the default is yes or no.

Thanks


Solution

  • I ran into exactly the same issue, so I'll post here my solution for other people looking for it.

    It seems you cannot get the information from AVMediaSelectionKeyValueOption. However, you can get default option directly from AVMediaSelectionGroup. So all you need to do is this:

    AVMediaSelectionOption *defaultOption = [group defaultOption];