gpt4 book ai didi

ios - AVPlayer 有时无法播放视频

转载 作者:搜寻专家 更新时间:2023-10-30 22:09:42 25 4
gpt4 key购买 nike

AVPlayer failed to play video

我有视频网格,AVPlayer 有时无法播放视频并显示此禁用图标并出现以下错误,

Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped" UserInfo={NSUnderlyingError=0x7f927ede4210
{Error Domain=NSOSStatusErrorDomain Code=-12939 "(null)"}
, NSLocalizedFailureReason=The server is not correctly configured., NSLocalizedDescription=Operation Stopped})

但稍后会播放相同的视频,所以这是随机问题。对出了什么问题有帮助吗?

最佳答案

搜索错误

我相信有很多人和我一样,正在寻找这个问题的解决方案。

耗费了整整一个下午的时间,终于解决了这个问题。

题中视频开始播放时出现错误。

如:

Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped"

然后我搜索这个错误号,并找到它:

AVErrorServerIncorrectlyConfigured = -11850

在 Apple 的文档中,我找到了有关此错误的一些信息。

The HTTP server sending the media resource is not configured as expected. This might mean that the server does not support byte range requests.

查找错误

所以,我们应该理解这是服务器的问题。

现在,我们播放一段视频,抓取所有的 http 请求进行分析。

会发现AVPlayerItem发送HTTP请求。

当 AVPlayerItem 收到视频 URL 时,它会执行以下任务:

  1. 发送字节请求HTTP请求,范围=0-1
  2. 如果响应代码是 206 并返回 1 个字节的数据,它执行第 3 个任务,如果不是,则发生 AVErrorServerIncorrectlyConfigured 错误。
  3. 继续发送其他 HTTP 请求,以下载所有持续时间的片段。 VideoData代码的响应必须是206

在我的情况下,当发送 range[0-1] HTTP 请求时,服务器端给我一个 200 OK 响应,所以发生了错误。

结果

因此,您需要让您的服务器工程师检测所有返回的响应。

希望对您有所帮助。

关于ios - AVPlayer 有时无法播放视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33823411/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com