IPhone UIWebView playing MP3. Dismissal protocol

audioiphoneuiwebview

So I can't find any documentation on how to do this, maybe someone knows what's going on here.

I'm in a UITableView (with a UINavigationController) in my application, and launching a UIWebView that loads an mp3 file on the internet by pushing the Web View's controller onto the navigation controller's stack. This works great, the file launches and plays in the quicktime player that Safari uses.

The problem is that once the audio file is finished playing, or the user clicks the done button, the player is released and the app goes back to an empty webView with my navigation bar. I can hit the back button to get back to my original UITableView, but that blank screen is ugly and needs to go.

So, what action can i use to put a [webviewcontroller.navigationcontroller popviewcontroller] message in? Is it loading an instance of some other class (like AVAudioPlayer) to play the audio? Do i need to subclass something? Apple's documentation on how it plays audio in UIWebView is basically nonexistant.

Best Answer

Ok, so I found a much better, much simpler solution; one that i had to delete lines of code from my app to use. I just used UIWebview initWithFrame:CGRectMake(0.0,0.0,1.0,1.0), didn't add it to the view, then called an NSURLRequest, and hooked it up to my button. The media player fullscreens automagically, and there's no need to call the nav controller.

Related Topic