17

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

Alex Giatrakis
  • 365
  • 3
  • 16

2 Answers2

6

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.

CMash
  • 1,987
  • 22
  • 35
3

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%.

CodeChanger
  • 7,953
  • 5
  • 49
  • 80
StarPlayrX
  • 33
  • 3