How to get a HTML5 audio tag audio to come from receiver instead of speaker?
I was trying to do the following on IPhone:
- load a webpage on UIWebView control in my application.
- The webpage has an audio tag (
<audio/>
in HTML5) with source of the audio file set correctly. - Webpage loads correctly and when I click on play button the audio was coming out from the receiver.
How do I make the audio to come out of the receiver instead of the speaker?
What have I already done?
- I read about the Audio session services on apple platforms.
- My initial category was kAudioSessionCategory_PlayAndRecord.
- Now by default, according to the documentation the audio should go to the reciever. The above did not work.
- So I started listening on the kAudioSessionProperty_AudioRouteChange property. So when I played audio using the audio tag I got a callback. In the callba开发者_JAVA百科ck I queried for the audio route which came back with a string "RecieverAndMicrophone"
So looks like the browser control is doing some magic to override the app default audio session settings. How do I change that behavior through my app?
精彩评论