AVPlayer有时无法播放视频 [英] AVPlayer fails to play video sometimes

查看:176
本文介绍了AVPlayer有时无法播放视频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I'm having grid of videos, AVPlayer sometimes fail to play video and showing this disabled icon with following error,

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})

,但是稍后播放同一视频,因此是随机问题.有什么问题的帮助吗?

but same video getting played later on, so it is random issue. Any help on what's going wrong?

推荐答案

搜索错误

我相信,像我一样,有很多人正在寻找解决这个问题的方法.

Search Error

I believe there are a lot of people, like me, are looking for the solution of this problem.

我花了整整一个下午的时间,终于解决了问题.

I spent a whole afternoon's time, finally solved the problem.

在问题上,视频开始播放时发生错误.

On the question, an error occurred when the video starts playing.

例如:

Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped"

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

then I search this error number, and find it:

AVErrorServerIncorrectlyConfigured = -11850

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

In Apple's Document, I find some information about this error.

发送媒体资源的HTTP服务器未按预期配置. 这可能意味着服务器不支持字节范围请求.

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

发现错误

因此,我们应该了解这是服务器问题.

Find Error

So, we should understand that this is a server problem.

现在,我们播放视频,并获取所有http请求进行分析.

Now, we play a video, and grab all http request for analysis.

会发现AVPlayerItem发送了一个HTTP请求.

Will find that AVPlayerItem sends an HTTP request.

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

when AVPlayerItem receive a video URL , it do the following task:

  1. 发送字节请求HTTP请求,范围= 0 -1
  2. 如果响应代码为206并返回1字节数据,则执行第三项任务;否则,执行AVErrorServerIncorrectlyConfigured错误.
  3. 继续发送其他HTTP请求,以下载所有持续时间"段.并且VideoData代码的响应必须为206

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

In my situation , when send range[0-1] HTTP request, the server side give me a 200 OK response, So error occurred.

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

So, you need to ask your server engineer to detect all response who return.

我希望它能为您提供帮助.

I wish it could help you.

这篇关于AVPlayer有时无法播放视频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆