So, I work with video with subtitle tracks, and I'm trying to access the code of the name and language of each of them for display in the menu. I am currently doing:
AVMediaSelectionGroup *selectionGroup = [self.currentAsset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
NSArray *subtitles = selectionGroup.options;
self.subtitlesOptions = [NSMutableArray arrayWithObject:@{ @"label": @"Off", @"value": @"off" }];
for(AVMediaSelectionOption *track in subtitles) {
NSString *title = track.displayName;
NSString *language = track.locale.localeIdentifier;
[self.subtitlesOptions addObject:@{ @"label":title, @"value":language }];
}
When I print each object track, I get something like below.
<AVMediaSelectionKeyValueOption: 0x171c79c40, language = engcc, mediaType = 'sbtl', title = English Closed Captions>
I can get the language correctly, but the problem is that it displayNamedoes not correlate with title, in which case it actually returns "engcc" instead of "English closed captions". Is there any way to get title?
source
share