问题描述
我正在使用自定义播放器来播放带有webvtt字幕的HLS流,并希望我的字幕始终显示白色,带有黑色轮廓边框,并带有特定字体的清晰背景。 我在AVPlayer中使用以下代码在字幕/字幕上应用样式
AVTe
xtStyleRule *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];
}
即使在字幕上应用了样式,它仍然显示用户在辅助功能设置中选择的选项。 您可以通过忽略设备的辅助功能设置中选择的内容来帮助我了解如何始终以这种格式显示电影字幕吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)