需要在AVPlayerView for tvOS上添加按钮和覆盖

问题描述 投票:0回答:1

我们可以在AVPlayerViewController上添加按钮并在其上显示叠加,或者我们需要自定义控件。

swift avplayer tvos apple-tv avplayerview
1个回答
1
投票

您可以使用View Controller ContainmentAVPlayerViewControllers视图添加到UIViewController,然后您可以在AVPlayerViewControllers视图中添加任何内容,因为它只是视图层次结构中的另一个视图...

let avPlayerVC = AVPlayerViewController()
//configure the playerVC
addChildViewController(avPlayerVC)
avPlayerVC.view.frame = frame//or use autolayout to constran the view properly
view.addSubview(avPlayerVC.view)
avPlayerVC.didMove(toParentViewController: self)

//add controls over it -> I called it ControlsView
let controls = ControlsView()
view.addSubview(controls)
© www.soinside.com 2019 - 2024. All rights reserved.