Error Domain=AVFoundationErrorDomain Code=-11800 “The operation could not be completed. Error Domain=NSOSStatusErrorDomain Code=-16170 ”(null)\"

匿名 (未验证) 提交于 2019-12-03 01:38:01

问题:

I am using AVPlayer in my chat application but i am getting the fallowing error in selected audio files but the audio files correctly play in browser.

Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSUnderlyingError=0x60800024fde0 {Error Domain=NSOSStatusErrorDomain Code=-16170 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-16170), NSLocalizedDescription=The operation could not be completed}

I am implementing 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. 
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!