AVPlayer fails to play video sometimes
Asked Answered
C

1

16

AVPlayer failed to play video

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?

Comedo answered 20/11, 2015 at 9:41 Comment(4)
see #6138620 .. maybe it is range requestsTombolo
@Daij-Djan: thanks, but not helpedComedo
did you solve this issue?Lasala
I am having exactly same issue, video url i am getting from one sdk that play sometimes but randomly it fail with this error. avplayer show cross symbol as above. url works fine on browsesCristicristian
S
20

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.

such as:

Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped"

then I search this error number, and find it:

AVErrorServerIncorrectlyConfigured = -11850

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

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.

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

Will find that AVPlayerItem sends an HTTP request.

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

  1. Send a bytes request HTTP Request, and range = 0 -1
  2. If the response code is 206 and return 1 bytes data, It do the 3th task, if not, AVErrorServerIncorrectlyConfigured error occurred.
  3. continue send other HTTP Request, to download segment of All duration. and the response of VideoData code must be 206

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

Result

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

I wish it could help you.

Squireen answered 15/2, 2017 at 9:8 Comment(4)
Just a small note, before it send the last request to get the full video, it sends several partial requests, 0-1, 0-65535, 15928-65535, 131072-196607, 262144-327679, 65536-131071, 196608-262143, 327680-116324656 (the final one)Nasion
This reponse was really helpful for us. Thanks! What specifically did the trick for us was to add the following line to our nginx-config on the server: proxy_force_ranges on;Memorial
@DavidMagalhães In my case, after the 1st 0-1, the 2nd request always sends range of full length: e.g. 0-116324656 . And that causes a slowness in playback because the server has to spend time to return the full data. Similar thing is discussed in #18058511Shuma
This also occurs if the response contains a content-range with a size of * (unknown).Quillet

© 2022 - 2024 — McMap. All rights reserved.