Error Domain = AVFoundationErrorDomain Code = -11800 "Operation cannot be performed Domain Error = NSOSStatusErrorDomain Code = -16170" (null) "

I use AVPlayer in my chat application, but I get an error in the selected audio files, but the audio files play correctly in the browser.

Domain error = AVFoundationErrorDomain Code = -11800 "Operation may not fill out" UserInfo = {NSUnderlyingError = 0x60800024fde0 {Error Domain = NSOSStatusErrorDomain Code = -16170 "(null)"}, NSLocalizedFailureReason = An unknown error was encountered (non-specific) -16 can be completed}

I implement the following methods.

-(void)setupAVPlayerForURL:(NSURL*)url { AVAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil]; AVPlayerItem *anItem = [AVPlayerItem playerItemWithAsset:asset]; playerAud = nil; playerAud = [AVPlayer playerWithPlayerItem:anItem]; [self startTimer]; [playerAud play]; [anItem addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(stopAudioPlay) name:AVPlayerItemDidPlayToEndTimeNotification object:nil]; } And also implement the fallowing observer. - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { //// playerAud is instance of AVPlayer if (object == playerAud.currentItem && [keyPath isEqualToString:@"status"]) { if (playerAud.currentItem.status == AVPlayerItemStatusFailed) { NSLog(@"------player item failed:%@",playerAud.currentItem.error); } } } It prints the above error. 
+5
source share

Source: https://habr.com/ru/post/1264449/


All Articles