Avoid crash when text track doesn't have a title or language
This commit is contained in:
parent
20aae509db
commit
9ad11dd569
@ -702,13 +702,16 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
|
mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
|
||||||
for (int i = 0; i < group.options.count; ++i) {
|
for (int i = 0; i < group.options.count; ++i) {
|
||||||
AVMediaSelectionOption *currentOption = [group.options objectAtIndex:i];
|
AVMediaSelectionOption *currentOption = [group.options objectAtIndex:i];
|
||||||
NSString *title = [[[currentOption commonMetadata]
|
NSString *title = @"";
|
||||||
valueForKey:@"value"]
|
NSArray *values = [[currentOption commonMetadata] valueForKey:@"value"];
|
||||||
objectAtIndex:0];
|
if (values.count > 0) {
|
||||||
|
title = [values objectAtIndex:0];
|
||||||
|
}
|
||||||
|
NSString *language = [currentOption extendedLanguageTag] ? [currentOption extendedLanguageTag] : @"";
|
||||||
NSDictionary *textTrack = @{
|
NSDictionary *textTrack = @{
|
||||||
@"index": [NSNumber numberWithInt:i],
|
@"index": [NSNumber numberWithInt:i],
|
||||||
@"title": title,
|
@"title": title,
|
||||||
@"language": [currentOption extendedLanguageTag]
|
@"language": language
|
||||||
};
|
};
|
||||||
[textTracks addObject:textTrack];
|
[textTracks addObject:textTrack];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user