Interception UIWebView "setting the path to the movie:" from javascript audio player

In iOS 4, I have a page loaded in a UIWebView with a javascript audio player. I did not create this player, he belongs to a third party, so I can not work with him. When I press the play button, I see the NSLog listing as follows:

setting movie path: http://data.myaudio.com/thefile.mp3 

My question is what it is and how to intercept it? The sound will continue to play until I create another UIWebView interface, or use the built-in audio devices available with the iPhone home button, double-click or close the application. I cannot intercept the path with shouldStartLoadWithRequest: the javascript audio.play() function seems to call the built-in player directly. I would like to control where and how the sound is played, but not parse the HTML for any <audio> tags, I cannot figure out how to capture this path and point it somewhere other than the default value.

+4
source share
1 answer

UIWebView is essentially a wrapper for WebKit. Apple does not want you to touch on anything more than that provided by existing delegation methods.

In doing so, you can change the DOM of any loaded document by entering JavaScript. That way, you can also change audio.play to do nothing, and instead get a URL to play with your own player, which you can control.

+1
source

All Articles