如何使用一个按钮在AVplayerController中切换显示隐藏播放控件?

时间:2018-10-01 12:28:29

标签: ios swift avplayer

我用AVplayer制作了我的应用,并通过功能来控制视频计时

当我点击按钮进行搜索时,播放器控件将不会显示,但是当我点击视频图层时,它将显示。

如何使按钮切换以显示播放器控件?

这是我的代码:

override func viewDidLoad() {
    super.viewDidLoad()
    self.player = AVPlayer(url: videoUrl)
    self.avpController = AVPlayerViewController()
    self.avpController.player = self.player
    avpController.view.frame = viewPlayer.frame
    self.addChild(avpController)
    self.view.addSubview(avpController.view)
    self.player.play()
}

@IBAction func btnSeek(_ sender: Any) {
    let seconds : Int64 = Int64(20)
    let targetTime:CMTime = CMTimeMake(value: seconds, timescale: 1)
    player.seek(to: targetTime)
}

0 个答案:

没有答案