AVPlayer and AVFoundationErrorDomain Code = -11819

I am developing an application in which music is played through AVPlayer using songs from the cloud service. everything works fine and most files play without any problems.

Recently, I get an error message from certain files and with the message coming from AVPlayer, I can’t understand if this is due to a network connection problem or to the encoding of the file itself:

Domain Error = AVFoundationErrorDomain Code = -11819 "Unable to complete Action" UserInfo = 0x176abd80 {NSLocalizedRecoverySuggestion = Try again later. NSLocalizedDescription = Unable to complete action}

Looking through the documentation, I found out that code 11819 means:

AVErrorMediaServicesWereReset - The operation cannot be completed because the media services have become unavailable.

Has anyone ever experienced this before?

+4
source share
1 answer

I found a solution using the following method before loading AVURLAsset into AVPlayerItem

  • (void) loadValuesAsynchronouslyForKeys: (NSArray *) keys completionHandler: (void (^) (void)) handler

The reason he crashed into certain tracks was because some of them where mp3 files are stored and they do not have all the information about the song that is immediately available (for example, duration).

+2
source

All Articles