iphone - 使用 AVAudioPlayer 的音频流

标签 iphone ios avaudioplayer

我正在尝试开发一个应用程序,我将在其中使用PlayStop 按钮。单击“播放”按钮后,它应该会播放正在播放的音频在特定链接上

-(void)playMusic
{  
   mAudioPlayer=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.tuneindia.com"] error:nil];
   mAudioPlayer.delegate = self;
   mAudioPlayer.volume=mVolumeSlider.value;
   NSLog(@"THEVOLUME::::   %f",mVolumeSlider.value);
   [mAudioPlayer prepareToPlay];
   [mAudioPlayer play];
}

请帮助我理解这个 AVAudioPlayer 如何附加到链接并从那里流式传输音频(因为我们使用了 www.tuneindia.com)。

最佳答案

AVAudioPlayer 不适用于流式传输。 Init with URL 仅适用于本地文件 url。使用 AVPlayer 进行流式传输。

https://developer.apple.com/library/ios/qa/qa1634/_index.html

关于iphone - 使用 AVAudioPlayer 的音频流,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16057222/

相关文章:

iphone - 同一目标上的设备与模拟器的 xcode 不同链接器/cflags?

ios - 带有 iOS 的 Gmail API - 接收电子邮件

ios - swift iOS : Get the title of current song playing

iphone - ios 库中的 Libxml

iphone - 不同部分中的所有 tableCells 都选择了同一行(使用 NSIndexPath)

iphone - objective-c : Do I have to retype all the code everytime?

ios - 我可以使用网络语言(HTML - CSS - jQuery)创建 iphone 应用程序 (IOS) 吗?

ios - 自定义 UITableViewCell : UITextFields clearing when scrolled out of view- dequeuing problems 的问题

ios - 检查文件是否可以使用 AVAudioPlayer 播放

ios - 如何使用 swift 使用 JukeBox 播放保管箱音频文件?