アプリでラジオをストリーミングしようとしています。
AVAudioPlayer を使用していますが、理解できないエラーがあります:
NSString *urlString = @"http://broadcast.infomaniak.net/radionova-high.mp3";
NSURL *myURL = [NSURL URLWithString:urlString];
NSError *error;
self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:myURL error:&error];
if (self.audioPlayer == nil){
NSLog(@"Error loading clip: %@", [error localizedDescription]);
}
else {
self.audioPlayer.delegate = self;
self.audioPlayer.volume = 0.5;
[self.audioPlayer play];
}
そして、私は次のエラーがあります:
Error loading clip: The operation couldn’t be completed. (OSStatus error -43.)
誰が何が悪いのか分かりますか?
編集 :
これはAppleのドキュメントが言うことです:
AVAudioPlayer クラスは、HTTP URL に基づくストリーミング オーディオをサポートしていません。initWithContentsOfURL: で使用される URL は、ファイル URL (file://) である必要があります。つまり、ローカル パスです。
それで ?:(