iOS AVPlayer无法禁用隐藏式字幕 [英] IOS AVPlayer cannot disable closed captions

查看:90
本文介绍了iOS AVPlayer无法禁用隐藏式字幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用AVPlayer创建了自己的视频播放器,除了隐藏式字幕外,其他所有功能都可以正常工作.我有一个正在测试的视频,而且事实上我知道隐藏式字幕没有嵌入.我可以在其他视频查看器中将其禁用.

I've created my own video player using AVPlayer and have gotten everything to work properly except for closed captions. I have a video I'm testing and I know for a fact the closed captions are not baked in. I can disable them in other video viewers.

closedCaptionDisplayEnabled

我将AVPlayer上的该属性设置为NO,并对其进行了记录,以确保将其设置为no,但标题仍会出现.有人知道为什么会这样吗?

I have that property on the AVPlayer set to NO and have logged it to make sure it is set to no but the captions still appear. Does anyone know why this might be?

推荐答案

我通过以下代码段禁用了字幕

I disable subtitle by below code snippet

let output = AVPlayerItemLegibleOutput.init()
    output.setDelegate(self, queue:DispatchQueue.main)
    output.suppressesPlayerRendering = true
    playerItem?.add(output)

您可以在此处检查 suppressesPlayerRendering API

You can check suppressesPlayerRendering api there

这篇关于iOS AVPlayer无法禁用隐藏式字幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆