Search code examples
iosswiftavplayer

Customize AVPlayerViewController


I'm using AVPlayerViewController to play video in my application, I don't want to make the player from scratch. is there a way to add some other extra UI components and functionality to the AVPlayerViewController?

class AVKitViewController: AVPlayerViewController {

    private let url =
        URL(string:
            "https://www.digikala.com/mag/wp-content/uploads/2019/09/Call-of-Duty-Modern-Warfare-Story-Trailer.mp4")

    override func viewDidLoad() {
        super.viewDidLoad()

        let video = AVPlayer(url: url!)
        player = video

        player?.play()
    }
}

Solution

  • It looks like there is no way to do such thing. the only way possible, is to use AVFoundation to create our own AVPlayer from scratch.