Hi All,
I am using a custom AvPlayer for HLS streaming with webvtt subtitles and want my subtitles should alway display white color with black outline border with clear background with specific font.
I used below code to in AVPlayer to apply style on captions/subtitles
AVTextStyleRule *rule1 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeCharacterBackgroundColorARGB : [self getARBB:[UIColor blackColor]]}];
AVTextStyleRule *rule2 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeForegroundColorARGB : [self getARBB:[UIColor whiteColor]]}];
AVTextStyleRule *rule3 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeBackgroundColorARGB : [self getARBB:[UIColor clearColor]]}];
AVTextStyleRule *rule4 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeGenericFontFamilyName : (NSString*)kCMTextMarkupGenericFontNameSansSerif}];
AVTextStyleRule *rule5 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeBaseFontSizePercentageRelativeToVideoHeight : @(10),
(id)kCMTextMarkupAttributeCharacterEdgeStyle : (NSString*)kCMTextMarkupCharacterEdgeStyleUniform}];
item.textStyleRules = @[rule1,rule2,rule3,rule4,rule5];
}
Even after applying style on captions it still display option selected by user in accessibility settings.
Could you please help me understanding how i can always display movie subtitles in this format by ignoring what is selected in accessibility settings of device.
I am using a custom AvPlayer for HLS streaming with webvtt subtitles and want my subtitles should alway display white color with black outline border with clear background with specific font.
I used below code to in AVPlayer to apply style on captions/subtitles
AVTextStyleRule *rule1 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeCharacterBackgroundColorARGB : [self getARBB:[UIColor blackColor]]}];
AVTextStyleRule *rule2 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeForegroundColorARGB : [self getARBB:[UIColor whiteColor]]}];
AVTextStyleRule *rule3 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeBackgroundColorARGB : [self getARBB:[UIColor clearColor]]}];
AVTextStyleRule *rule4 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeGenericFontFamilyName : (NSString*)kCMTextMarkupGenericFontNameSansSerif}];
AVTextStyleRule *rule5 = [[AVTextStyleRule alloc] initWithTextMarkupAttributes:@{
(id)kCMTextMarkupAttributeBaseFontSizePercentageRelativeToVideoHeight : @(10),
(id)kCMTextMarkupAttributeCharacterEdgeStyle : (NSString*)kCMTextMarkupCharacterEdgeStyleUniform}];
item.textStyleRules = @[rule1,rule2,rule3,rule4,rule5];
}
Even after applying style on captions it still display option selected by user in accessibility settings.
Could you please help me understanding how i can always display movie subtitles in this format by ignoring what is selected in accessibility settings of device.