Using an AVPlayer returns a “non-Multipath connection” error

跟風遠走 提交于 2020-03-21 11:24:05

问题


I'm using AVKit to play a youtube URL.

I have this code inside a button action:

 @IBAction func trailerButtonAction(_ sender: Any) {
    guard let youtubeUrl = youtubeURL else { return }
    let player = AVPlayer(url: youtubeUrl)
    let playerViewController = AVPlayerViewController()
    playerViewController.player = player

    present(playerViewController, animated: true) {
        player.play()
    }
}

The URL is valid, but when I press the button, the video doesn't stop loading and I'm getting this message on Debug area:

nw_endpoint_flow_copy_multipath_subflow_counts Called on non-Multipath connection

Edit:

I found that AVPlayer doesn't support youtube URL


回答1:


I would say this log isn't necessarily relevant. I was getting this error when trying to playback on the simulator but it wasn't happening on a real device.




回答2:


One workaround would be to use a 12.4.x simulator as it does not exhibit this issue. Only the 13.x simulators are showing this error. It happens to repeatedly that it slows down Simulator to a craw until all requested tracks have been buffered.

To combat this while testing, I am either not turning on AVPlayer or I am only buffering a short track.

To cut down on the number of errors try initing your AVPlayer like so:

var avPlayer : AVPlayer = AVPlayer()

This may cut down the errors by 30%.



来源:https://stackoverflow.com/questions/58431840/using-an-avplayer-returns-a-non-multipath-connection-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!