Get automatic system track selection working
This commit is contained in:
parent
9764fe3be4
commit
b44ae2c0c2
@ -640,11 +640,10 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
- (void)setSelectedTextTrack:(NSDictionary *)selectedTextTrack {
|
- (void)setSelectedTextTrack:(NSDictionary *)selectedTextTrack {
|
||||||
_selectedTextTrack = selectedTextTrack;
|
_selectedTextTrack = selectedTextTrack;
|
||||||
NSString *type = selectedTextTrack[@"type"];
|
NSString *type = selectedTextTrack[@"type"];
|
||||||
|
|
||||||
AVMediaSelectionGroup *group = [_player.currentItem.asset
|
AVMediaSelectionGroup *group = [_player.currentItem.asset
|
||||||
mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
|
mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];
|
||||||
|
|
||||||
AVMediaSelectionOption *option;
|
AVMediaSelectionOption *option;
|
||||||
|
|
||||||
if ([type isEqualToString:@"disabled"]) {
|
if ([type isEqualToString:@"disabled"]) {
|
||||||
// Do nothing. We want to ensure option is nil
|
// Do nothing. We want to ensure option is nil
|
||||||
} else if ([type isEqualToString:@"language"] || [type isEqualToString:@"title"]) {
|
} else if ([type isEqualToString:@"language"] || [type isEqualToString:@"title"]) {
|
||||||
@ -664,6 +663,8 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//} else if ([type isEqualToString:@"default"]) {
|
||||||
|
// option = group.defaultOption; */
|
||||||
} else if ([type isEqualToString:@"index"]) {
|
} else if ([type isEqualToString:@"index"]) {
|
||||||
if ([selectedTextTrack[@"value"] isKindOfClass:[NSNumber class]]) {
|
if ([selectedTextTrack[@"value"] isKindOfClass:[NSNumber class]]) {
|
||||||
int index = [selectedTextTrack[@"value"] intValue];
|
int index = [selectedTextTrack[@"value"] intValue];
|
||||||
@ -672,12 +673,11 @@ static NSString *const timedMetadata = @"timedMetadata";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else { // default. invalid type or "system"
|
} else { // default. invalid type or "system"
|
||||||
// _player.appliesMediaSelectionCriteriaAutomatically = YES;
|
[_player.currentItem selectMediaOptionAutomaticallyInMediaSelectionGroup:group];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a match isn't found, option will be nil and text tracks will be disabled
|
// If a match isn't found, option will be nil and text tracks will be disabled
|
||||||
// _player.appliesMediaSelectionCriteriaAutomatically = NO;
|
|
||||||
[_player.currentItem selectMediaOption:option inMediaSelectionGroup:group];
|
[_player.currentItem selectMediaOption:option inMediaSelectionGroup:group];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user