我正在构建一个广播/播客流媒体应用程序,并且在输出终端中得到了以下注释。我一直忽略它,因为它似乎没有影响任何事情,但现在它似乎影响了我使用UISlider作为搜索栏,以便在曲目中跳过更远或更早。我知道多路径是为了帮助数据流从wifi无缝传输到4G,但我不知道如何在我的播放器中实现它。
我的播放器如下所示,它接受音频的URL作为参数
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()
}但它的实现超出了我的能力范围。
要启用multipath service type的handover类型,我需要在代码中添加什么
发布于 2020-02-07 05:16:13
请参阅:Using an AVPlayer returns a "non-Multipath connection" error
这是iOS 13模拟器中的一个错误,苹果需要修复它
发布于 2019-11-21 01:27:08
通过查看文档,您似乎应该: 1)确保在您的项目设置中启用了多路径授权。2)将您的URLSessionConfiguration的multipathServiceType更改为.handover (他们说了一些其他的东西,而不是什么也没有)。
URLSessionConfiguration.default.multipathServiceType = .handoverMultipathServiceType.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.警告:我还没有测试它,只是按照文档的说明。
https://stackoverflow.com/questions/58909866
复制相似问题