简体   繁体   中英

iOS: Problem Loading Audio from URL in UIWebView

I am loading an MP3 podcast 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 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM