我用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)
}