gpt4 book ai didi

ios - 错误域= AVFoundationErrorDomain代码= -11800 “The operation could not be completed. Error Domain=NSOSStatusErrorDomain Code=-16170 ”(空)“

转载 作者:行者123 更新时间:2023-12-03 07:29:47 50 4
gpt4 key购买 nike

我在聊天应用程序中使用了AVPlayer,但是在选择的音频文件中出现了休闲错误,但是音频文件在浏览器中正确播放。

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}



我正在实现以下方法。
-(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.

最佳答案

就我而言,我使用http url.Set NSAllowsArbitraryLoads to YES修复错误。

关于ios - 错误域= AVFoundationErrorDomain代码= -11800 “The operation could not be completed. Error Domain=NSOSStatusErrorDomain Code=-16170 ”(空)“,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42344757/

50 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com