AVPlayer Closed Captions turn on/off

两盒软妹~` 提交于 2019-12-12 12:26:22

问题


I'm creating custom video player, and i want to create toggle button for CC.

I saw this post : IOS AVPlayer cannot disable closed captions

So I tried :

AVMediaSelectionGroup *group = [self.avPlayer.currentItem.asset mediaSelectionGroupForMediaCharacteristic:AVMediaCharacteristicLegible];

[self.avPlayer.currentItem  selectMediaOption:nil inMediaSelectionGroup:group];

Didn't work.. cc still visible.

also tried :

AVPlayerItemLegibleOutput *output = [[AVPlayerItemLegibleOutput alloc] init];
[output setDelegate:self queue:dispatch_get_main_queue()];
[output setSuppressesPlayerRendering:true];
[self.avPlayer.currentItem addOutput:output];

It's hide the the cc, but how can I unhide them? ,I tried:

[output setSuppressesPlayerRendering:true];

but the cc freeze on the screen.

thanks!

来源:https://stackoverflow.com/questions/46569048/avplayer-closed-captions-turn-on-off

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!