swift AVPlayer:关闭按钮在iOS 16上不起作用

vof42yt1  于 2022-10-31  发布在  Swift
关注(0)|答案(1)|浏览(196)

我在iOS16上有一个问题,关闭按钮没有像往常一样关闭AVPlayer,但它在iOS12上工作。
你知道我错过了什么吗?

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

waxmsbnn1#

之前:
我认为这是iOS 16的一个bug,因为当我将动画参数设置为true时,它就可以工作了

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

编辑:
在iOS 16.1上已修复

相关问题