tvOS 中使用 AVPlayerViewController 的 Seekbar 可见性回调

Not*_*rno 3 avplayer avplayerviewcontroller tvos

我正在研究一种解决方案,在搜索栏可见时在屏幕上显示一些元素。

我有一个 AVPlayerViewController 和一个播放视频的 AVPlayer。我想在搜索栏可见时显示一些组件,并在隐藏搜索栏时隐藏它们。

当搜索栏可见/隐藏时,有没有办法得到通知?

提前致谢。

小智 5

AVPlayerViewControllerDelegate具体看一下这个方法:

optional func playerViewController(_ playerViewController: AVPlayerViewController, willTransitionToVisibilityOfTransportBar visible: Bool, with coordinator: AVPlayerViewControllerAnimationCoordinator)
Run Code Online (Sandbox Code Playgroud)

更多信息可以在这里找到:https : //developer.apple.com/documentation/avkit/avplayerviewcontrollerdelegate/2876484-playerviewcontroller