【问题标题】:HLS m3u8 Download takes a lot of timeHLS m3u8下载需要很多时间
【发布时间】:2020-08-15 12:30:42
【问题描述】:

我正在尝试使用此处提到的苹果文档 - https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/MediaPlaybackGuide/Contents/Resources/en.lproj/HTTPLiveStreaming/HTTPLiveStreaming.html

将 HLS 流下载到我的 iPhone 上

即使是 2 分钟的小视频也需要大约 3-4 分钟才能下载,我的互联网连接速度很快,所以这不是问题。

我想知道在下载时是否需要下载或指定任何特定的流?我的 m3u8 中的流是 320p、720p、1080p。是不是全部都下载了,所以要花那么多时间?

这就是我设置代码以下载 hls 的方式 -

let urlConfiguration = URLSessionConfiguration.background(withIdentifier: downloadIdentifier)

 // Create a new AVAssetDownloadURLSession with background configuration, delegate, and queue
let   assetDownloadSession = AVAssetDownloadURLSession(configuration:   urlConfiguration,
                                                    assetDownloadDelegate: self,
                                                    delegateQueue: OperationQueue.main)

let asset = AVURLAsset(url: URL(string: assetUrl)!)

 // Create new AVAssetDownloadTask for the desired asset
let avAssetDownloadTask = assetDownloadSession?.makeAssetDownloadTask(asset: asset,
                                                                    assetTitle: title,
                                                                    assetArtworkData: nil,
                                                                    options: nil)
 // Start task and begin download
avAssetDownloadTask?.resume()

【问题讨论】:

    标签: ios swift http-live-streaming m3u8 urlsession


    【解决方案1】:

    您可以考虑使用 Charles Proxy 或 Wireshark 等工具来确定底层网络请求的吞吐量。您的服务器可能很慢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-03-19
      • 2018-05-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多