Claire.Rimel
Claire.Rimel

Reputation: 41

AVPlayer: Close button doesn't work on iOS 16

I have an issue on iOS 16, the close button doesn't dismiss the AVPlayer as usually, but it's working on iOS 12.

Do you have any idea of what I'm missing?

func didTapOnPlay(url: URL) {
    let player = AVPlayer(url: url)
    playerViewController.player = player
    
    NotificationCenter.default.addObserver(
        self,
        selector: #selector(playerDidReachEndNotificationHandler),
        name: NSNotification.Name(rawValue: "AVPlayerItemDidPlayToEndTimeNotification"),
        object: player.currentItem)
    
    router.present(playerViewController, animated: false) { [weak self] in
        self?.playerViewController.player?.play()
    }
}

Upvotes: 0

Views: 1051

Answers (1)

Claire.Rimel
Claire.Rimel

Reputation: 41

Before:

I think it's a bug from iOS 16 because when I set the animated parameter as true, it works

router.present(playerViewController, animated: true) { [weak self] in
        self?.playerViewController.player?.play()
    }

Edit:

It's fixed on iOS 16.1

Upvotes: 3

Related Questions