子视图重叠时移动AVPlayer标题

如果子视图(非本机,自定义播放器控件)出现在video上,是否可以移动显示video的系统标题? 显示的标题是文本WebVTT标题。

在某些屏幕尺寸上,当我切换到横向时,我们的自定义搜索栏控件重叠显示在播放器底部的字幕。

对于它的价值,这可能的。 您需要访问AVPlayer的当前项并为其设置AVTextStyleRule。

// currentPlayer is our instance of the AVPlayer if let currItem = currentPlayer?.currentItem { let rule = AVTextStyleRule(textMarkupAttributes: [kCMTextMarkupAttribute_OrthogonalLinePositionPercentageRelativeToWritingDirection as String: 93]) // 93% from the top of the video currItem.textStyleRules = [rule!] }