简体   繁体   中英

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()
    }
}

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM