FADE IN: INT. TEENAGERS BEDROOM - DAY Music is playing loudly over stereo. TEEN is reading magazine on the bed. PARENT walks in, teen does not notice. PARENT (shouting) I thought you were going to take out the trash! Teen does not hear parent over the music. PARENT I said I thought you were going to take out the trash! Teen still does not notice. Parent walks over and turns off stereo. TEEN Teen turns to parent standing by stereo. Hey! Why did you do that? That is so rude! Teen and parent commence arguing. VOICEOVER Dont be that parent. Use DuckAudio in your mobile app. FADE OUT.
Don’t Turn Off, Just Turn Down.
That’s right, your iPhone app doesn’t need to completely turn off the background music that your app user is rocking out to just to remind them to take out the trash. Your can enable Duck Audio!
Any currently playing background music is simply turned down while your app makes an audio sound
With duck audio, any currently playing background music is simply turned down while your app makes an audio sound. This is a lot better than completely turning off the audio, and a lot less annoying to your users!
Enabling your Appcelerator iOS to use duck audio is simple:
1) Download and install the handy module I wrote: TiAVAudioSession
2) Initialize the module when the app is first launched
var AVAudio = require('com.polancomedia.tiavaudiosession'); AVAudio.init();
3) Right before you play a sound, enable duck audio!
AVAudio.enableDuckAudio();
And you can optionally turn it off again with disableDuckAudio()
.
That’s it! For more examples, check out the module on Github.
Special thanks to Michael Z. for agreeing to contribute this to open source!
You must be logged in to post a comment.