Search code examples
swifttvos

Disable time seek in AVPlayer


I am using the AVPlayer for playing very short videos in tvOS. At the moment, when I touch the remote, the timeline of the videos shows up and I am able to fast forward and backward. Is there a way to completely disable this, i.e. force the user to see the clip from beginning to end without being able to forward/backward/pause/...?


Solution

  • Found an easy solution for the problem: from the AVPlayerViewController, one can set the property showsPlaybackControls to false. So for example in the constructor:

    class PlayerViewController: AVPlayerViewController, AVPlayerViewControllerDelegate {
        override func viewDidLoad() {
            super.viewDidLoad()
            self.showsPlaybackControls = false
        }
    }
    

    Then the controls don't appear anymore and forward/backward/play/pause don't work anymore as well.