我在swift项目中使用MobileVLCKit。我正在使用cocoapod MobileVLCKit-prod(2.7)。我想为播放器添加视频控件。这是我的代码。
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let filePath = Bundle.main.url(forResource: "bunny", withExtension: "webm")
self.mediaPlayer.media = VLCMedia(url: filePath)
self.mediaPlayer.drawable = self.view
self.addVideoControls()
self.mediaPlayer.play()
}
func addVideoControls() {
let videoControls = MPVolumeView(frame: CGRect(x: 0, y: 0, width: self.view.frame.maxX, height: 60.0))
videoControls.backgroundColor = UIColor.blue
let videoView = self.mediaPlayer.drawable as! UIView
videoView.addSubview(videoControls)
videoView.bringSubview(toFront: videoControls)
}
VLC团队提供的探索不是编译。如何自定义视频播放器。请理解我的代码中有什么问题。