Subviews are not displaying on videoplayer in swift project.
I am using MobileVLCKit in my swift project. I am using cocoapods. I want to add video controls to player. This is my code.
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)
}
The above code is not showing any subviews in video player drawable. Please help me how to add the custom controls.