3

I am building a radio/podcast streaming app and have been getting the following note in the output terminal. I have been ignoring it as it didn't seem to effect anything but it now seems to be effecting my use of a UISlider as a seekbar to skip further or earlier in the track. I am aware that Multipath is to help the stream go seamlessly from wifi to 4G but i can't work out how to implement it into my player.

my player is as follows and takes in the URL of the audio as the argument

func loadRadio(radioURL: String) {


        guard let url = URL.init(string: radioURL) else { return }


        if let playerItem = self.playerItem {
            playerItem.removeObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), context: &playerItemContext)
        }

        let playerItem = AVPlayerItem.init(url: url)
        self.playerItem = playerItem
        playerItem.addObserver(self, forKeyPath: #keyPath(AVPlayerItem.status), options: [NSKeyValueObservingOptions.old, .new], context: &playerItemContext)
        AudioService.shared.player = AVPlayer.init(playerItem: playerItem)
        AudioService.shared.player?.automaticallyWaitsToMinimizeStalling = false;
        AudioService.shared.player?.play()


    }

the docs for it are here: https://developer.apple.com/documentation/foundation/urlsessionconfiguration/improving_network_reliability_using_multipath_tcp

but the implementation of it is beyond me.

What do i need to add to the code to enable the handover type of multipath service type?

highrankin
  • 87
  • 9

2 Answers2

4

See: Using an AVPlayer returns a "non-Multipath connection" error

This is a bug in the iOS 13 simulator that Apple needs to fix

stevendesu
  • 15,753
  • 22
  • 105
  • 182
-2

By Looking at the docs, it seems that you should: 1) Make sure the multipath entitlement is on in your project settings. 2) Change the multipathServiceType of your URLSessionConfiguration to .handover (they said something else than none).

URLSessionConfiguration.default.multipathServiceType = .handover

Definition of the MultipathServiceType.handover:

https://developer.apple.com/documentation/foundation/urlsessionconfiguration/multipathservicetype

A Multipath TCP service that provides seamless handover between Wi-Fi and cellular in order to preserve the connection.

Warning: I haven't tested it, just following the docs.

Miroslav Kuťák
  • 1,875
  • 1
  • 18
  • 24
  • 1
    "nw_endpoint_flow_copy_multipath_subflow_counts Called on non-Multipath connection" seems to me like an issue with the iOS 13 simulator. It doesn't happen for me on real devices, but it happens consistently in the simulator when using AVPlayer – stevendesu Feb 06 '20 at 21:15