【问题标题】:AVPlayer not playing HLS streamAVPlayer 不播放 HLS 流
【发布时间】:2016-09-19 11:21:23
【问题描述】:

我正在尝试从 Apple 示例直播流 URl 播放 HLS 流。

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

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

当 AVPlayer 开始准备播放时应用崩溃。除了以下例外。

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

【问题讨论】:

    标签: ios swift avplayer http-live-streaming


    【解决方案1】:

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

    【讨论】:

    • Without NSAppTransportSecurityNSAllowsArbitraryLoads Xcode 显示异常。
    • 好的,但是你需要 http 并不影响你得到的错误,你得到一个错误是因为你的任何数组而不是因为 http 连接。跨度>
    猜你喜欢
    • 2020-02-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多