ios - AVPlayer 不播放 HLS 流

标签 ios swift avplayer http-live-streaming

我正在尝试从苹果示例直播中播放 HLS 流 URl .

我在 info.plist 中添加了 ATS 异常。

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSAllowsArbitraryLoads</key><true/>
    </dict>

当 AVPlayer 开始准备播放时应用程序崩溃。除了以下异常(exception)。

2016-09-19 16:15:32.562 AVPlayer[4630:268295] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array'
*** First throw call stack:
........
libc++abi.dylib: terminating with uncaught exception of type NSException

最佳答案

检查您尝试从您的代码中加载的数组您正在尝试访问不存在的索引,键“NSAllowsArbitraryLoads”在您的情况下无关紧要。

关于ios - AVPlayer 不播放 HLS 流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39571967/

相关文章:

ios - 错误您的帐户已有有效的 iOS 分发证书

objective-c - 类方法在 iOS 中如何工作?

ios - UIPanGestureRecognizer - 仅垂直或水平

ios - 按删除按钮时功能不删除数组项

ios - 如何使用 AVPlayer addperiodictimeobserverforinterval 函数更新 uilabel?

ios - glClear 上的 "invalid framebuffer operation"- 在 OpenGL ES3 中使用 sRGB

ios - 圆形功能无法按预期工作

ios - Swift 4 - 以编程方式在 AutoLayout UITableViewCell 中切碎多行标签

ios - 如何使用 fileURL 播放视频

ios - AVFoundation中,如何同步录制和播放