Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Stop UIWebView from playing mp3?

I am loading a MP3 file into UIWebView control on an iPad Application, I have a UIButton called done the user expected to dismiss the UIWebView and stop the music, here is a code snippet:

// points to the mp3 file path
NSURL *url = [NSURL fileURLWithPath:self.sFilePath]; 
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[web loadRequest:request];

When the user hit done I do the following:

[self.webview removeFromSuperview];
[self.webview release];

But that does not stop the music from playing, I noticed that loading mp3 files on UIWebView opens the QuickTime player is that correct way?

I am greatly appreciative of any guidance or help.

like image 623
Ahmad Kayyali Avatar asked May 09 '11 11:05

Ahmad Kayyali


1 Answers

Looks like a dupe of Video/audio streaming does not stop even if UIWebView is closed - iPad

The solution there:

[self.webContent loadRequest:NSURLRequestFromString(@"about:blank")];
like image 170
nielsbot Avatar answered Oct 06 '22 08:10

nielsbot