Ios 如何从AVPlayer中提取ClosedCaption/字幕
由于AVPlayer呈现的闭路字幕有时会与其他UI组件重叠,因此我希望在单独的视图中呈现cc 我可以通过将closedCaptionDisplayEnabled设置为NO来关闭AVPlayer的cc渲染,但我没有找到提取要渲染的闭合字幕的方法 有人知道有没有办法从AVPlayer/AVPlayerItem中提取CC字符串吗?我可以用AVMediaTypeClosedCaption识别AVAssetTrack,但我不确定在特定时间内如何提取字符串。提取字幕字符串的关键步骤是Ios 如何从AVPlayer中提取ClosedCaption/字幕,ios,avplayer,avplayeritem,closed-captions,Ios,Avplayer,Avplayeritem,Closed Captions,由于AVPlayer呈现的闭路字幕有时会与其他UI组件重叠,因此我希望在单独的视图中呈现cc 我可以通过将closedCaptionDisplayEnabled设置为NO来关闭AVPlayer的cc渲染,但我没有找到提取要渲染的闭合字幕的方法 有人知道有没有办法从AVPlayer/AVPlayerItem中提取CC字符串吗?我可以用AVMediaTypeClosedCaption识别AVAssetTrack,但我不确定在特定时间内如何提取字符串。提取字幕字符串的关键步骤是 创建输出:让capti
让captionOutput=avplayerItemCleableOutput()
captionOutput.setDelegate(self,queue:DispatchQueue.main)
player.currentItem?.add(captionOutput)
扩展视图控制器:AVPlayerItemLeableOutputPushDelegate{
func易读输出(u输出:AvPlayerItem易读输出,
DidOutputAttributedString字符串:[NSAttributedString],
nativeSampleBuffers nativeSamples:[任何],
forItemTime项目时间:CMTime){
//您的标题字符串将在此处交付!
}
}
captionOutput.suppressPlayerRendering=true