I am trying to play a movie file of .mp4 format using AVPlayer. In my code, I am creating AVPlayer every time whenever a movie play is requested. Everything works fine except if due AVPlayer fails to play a movie once then in every next play request it fails until application is launched again.
I key value observing AVPlayerItem's status property for detecting AVPlayer failure.
Has anyone come across similar kind of problem?
Thanks in Advance.
I get this error from AVPlayerItem's error property:
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo=0x17946d540 {NSUnderlyingError=0x178642dc0 "The operation couldn’t be completed. (OSStatus error -12983.)", NSLocalizedFailureReason=An unknown error occurred (-12983), NSLocalizedDescription=The operation could not be completed}
Related
I am using a remote link to play a VOD HLS video using AVPlayer. It's playing fine.
Once the video is playable I am using generateCGImagesAsynchronouslyForTimes to get the thumbnail for a specific time.
But it is responding with following error:-
Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could
not be completed" UserInfo={NSLocalizedFailureReason=An unknown error
occurred (-12436), NSLocalizedDescription=The operation could not be
completed, NSUnderlyingError=0x2805331e0 {Error
Domain=NSOSStatusErrorDomain Code=-12436 "(null)"}}
It would really help if anybody can help me with the error reason.
Error Domain=AVFoundationErrorDomain Code=-11855 "Cannot Decode" UserInfo={NSUnderlyingError=0x157372050 {Error Domain=NSOSStatusErrorDomain Code=560226676 "(null)"}, NSLocalizedFailureReason=The media data could not be decoded on this device., NSLocalizedDescription=Cannot Decode}
Getting the above error when trying to start writing with an AVAssetWriter. This only occurs on iphone 5s, and only occurs sometimes. The most reproducible case is when we move from a VC with an AVPlayer that is playing media straight to the VC that handles the recording. The same VC with the recorder works correctly with the same settings when not navigating from the VC with the AVPlayer. What might cause this error and where can I look to fix this?
The asset writer code is part of the SCRecorder pod:
https://github.com/rFlex/SCRecorder
https://github.com/rFlex/SCRecorder/blob/master/Library/Sources/SCRecordSession.m
We solved this after finding that the audio sample rate was being changed, causing this error. We recheck the audio sample rate prior to recording and correct it if it has for some reason been changed.
I'm using AVPlayer to stream SoundCloud songs in my app, but some of them don't work, despite the streamable flag being true. An example of a song that doesn't work is "Black Friday" by Kendrick Lamar, with streaming URL
https://api.soundcloud.com/tracks/234989572/stream?client_id={MY_CLIENT_ID}
(with {MY_CLIENT_ID} being the actual ID, of course)
This is the error returned by the AVPlayerItem (again with the real client ID obscured):
Error Domain=NSURLErrorDomain Code=-1100 "The requested URL was not found on this server."
UserInfo=0x7fe735752340 {NSUnderlyingError=0x7fe735751e30 "The operation couldn’t be completed. (OSStatus error -12938.)",
NSErrorFailingURLStringKey=https://api.soundcloud.com/tracks/234989572/stream?client_id={MY_CLIENT_ID},
NSErrorFailingURLKey=https://api.soundcloud.com/tracks/234989572/stream?client_id={MY_CLIENT_ID},
NSURL=https://api.soundcloud.com/tracks/234989572/stream?client_id={MY_CLIENT_ID},
NSLocalizedDescription=The requested URL was not found on this server.}
Most songs play just fine, for example "Everything Will Be OK" by G-Eazy. URL:
https://api.soundcloud.com/tracks/236005149/stream?client_id={MY_CLIENT_ID}
Why are some songs, like Black Friday, failing?
The publisher of that track has opted not to provide an mp3 stream for it. Unfortunately, for some very complicated reasons, there's no way to tell that is going to be the case until you actually try to fetch the stream. It's a very frustrating thing, but please believe me when I say the reasons are complicated.
Perhaps sending a HEAD request to the streams endpoint before attempting to play would help?
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.
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:
Send a bytes request HTTP Request, and range = 0 -1
If the response code is 206 and return 1 bytes data, It do the 3th task, if not, AVErrorServerIncorrectlyConfigured error occurred.
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.
I am getting this error code when using 'MKMapView' on the iPhone 4:
Could not determine current country code: Error Domain=GEOErrorDomain Code=-2 "The operation couldn’t be completed. (GEOErrorDomain error -2.)"
The map loads fine with coordinates etc, but this gets logged.
Any ideas what is causing it?
I got this today on my iPad4-Wifi.
Reading more of the message, it stated that it had o internet connection.
Sure enough, the iPad lost connection to the wifi for some reason.
I reselected our wifi network, retried the test and it worked.