gpt4 book ai didi

Swift AVPlayerViewController 删除音频和字幕按钮

转载 作者:行者123 更新时间:2023-11-28 06:25:18 27 4
gpt4 key购买 nike

我想在使用 AVPlayerViewController 时删除音频和字幕按钮。我按如下方式创建 Controller :

// Create the view controller and player
let moviePlayerViewController: AVPlayerViewController = AVPlayerViewController()
let moviePlayer = AVPlayer(url: videoUrl!)

// Initialize the AVPlayer
moviePlayerViewController.player = moviePlayer
moviePlayerViewController.player?.isClosedCaptionDisplayEnabled = false

// Present movie player and play when completion
self.present(moviePlayerViewController, animated: false, completion: {
moviePlayerViewController.player?.play()
})

我以为 moviePlayerViewController.player?.isClosedCaptionDisplayEnabled = false 会帮我移除按钮,但我错了。谁能帮我找到隐藏音频和字幕按钮的正确设置?

最佳答案

根据 official doc ,您无法在默认播放器布局上隐藏音频和字幕按钮。如果您坚持删除该按钮,请尝试自定义您自己的播放器,或修改 .m3u8 文件以删除多余的字幕选项。

关于Swift AVPlayerViewController 删除音频和字幕按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42096661/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com