Как использовать AVPlayer в UIAlertController в Swift 4 - PullRequest
1 голос
/ 19 апреля 2020

Это мой код AVPlayer:

    let video = AVPlayer(url: URL(string: "MY_URL_VIDEO")!)
    let videoPlayer = AVPlayerViewController()
    videoPlayer.player = video
    present(videoPlayer, animated: true, completion: {
        video.play()
    })

А это мой код UIAlertController:

    let ac = UIAlertController(title: "Select", message: nil, preferredStyle: .actionSheet)
    ac.addAction(UIAlertAction(title: "Full HD 1080p", style: .default, handler: video.play()))
    ac.addAction(UIAlertAction(title: "cancel", style: .cancel))
    ac.popoverPresentationController?.barButtonItem = self.navigationItem.rightBarButtonItem
    present(ac, animated: true)

А вот и моя ошибка: (

enter image description here

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...