开发者

iOS: Problem Loading Audio from URL in UIWebView

I am loading an MP3 po开发者_Go百科dcast stream into a UIWebView as follows:

- (void)viewDidLoad
{
    [super viewDidLoad];

    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL: [NSURL URLWithString:@"http://localhost/podcasts/downloader/download.mp3?af=a&f=10109"]]; 

    [webView loadRequest:request];

}

The stream appears to load, and then a UIAlert appears saying:

An error occurred while exchanging data. "Plug-in handled load"

And immediately after the stream loads properly in QuickTime and plays. Why is this alert appearing?

I'd prefer not to use AVAudioPlayer to play the stream, but rather QuickTime.


If you are on iOS, the URL is pointing to localhost, and there are probably no web server on the device.


You can just ignore that error. It is to let you know that quicktime is handling the load.

//Playing audio gives error that says plug-in handled load
if([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 204)
{
    // Ignore it 
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜