I have an UIWebView
to load a html web link:http://m.y.qq.com in my iOS app. I don't know how to detect the playing state of the audio in UIWebView.
I just need to know whether the audio in UIWebView
is playing or not in my iOS app, so that I can do something.
I have searched a lot from Stackoverflow and Google, but I can't find a satisfied answer. Can anyone give me some help?
You can check if audio is playing with
isOtherAudioPlaying
So in your
UIWebView
delegate methods you can use:AVAudioSession
has asharedInstance
property which you can utilize in this instance. The property is a BOOL and can be updated upon multiple threads.@tnylee's code is perfect.