I implement UILocalNotification in my app which will play 16-seconds-length sound.
I notice that while the sound is being played,
if I press the side Volume buttons (on iPhone/ iPod) to increase or decrease the volume,
the sound is stopped immediately.
Do you know how to not stopped the Local Notification sound when user presses the side Volume buttons on iPhone/ iPod?
Thank you.
EDIT:
I like to do the same like this i-iQ Timer app, when UILocalNotification sound is playing, if user adjust the side volume buttons, the sound keeps playing.
No, the standard APIs give you no control over what happens when the volume buttons are pressed. The only sound-related thing about a UILocalNotification that you can control is to choose which sound plays.}
Related
When I take picture from camera using UIImagePicker, background music (from ipod app, pandora app) stops. It's not happening for facebook app. Is there a separate delegate for this? Please help
This might be due to your Audio Session policy. Taking a picture makes a "click" noise. Perhaps this is causing all other sound to be stopped because of your Audio Session.
I am working on Audio related project. I am playing audio, in both case, either my app is active or suspended. I am stuck here, when I play audio and lock my iphone, when I double click on home button, there appears the player controls. I try to play/pause may audio, without unlocking the iphone same as in default ipone/ipod application. Is it possible? If yes then feel free to help. Thanks in advance.
Use Remote Control events
Remote control events are any event received for the purpose of controlling media. eg iTunes pause/play/next/previous buttons available from double-tapping the home screen button, or remote-control events from play/pause buttons on headphones.
http://www.sagorin.org/2011/11/29/ios-playing-audio-in-background-audio/
I use AVFoundation to play audio. When i lock my device with playing music, and press Home button twice, I can see audio controls: forward, rewind, pause/play and volume slider
How to use them? When i press they don't do anything. Onlu volume slider works good.
When my app is launched (no sound emitted, Ambiant category set for AudioSession), using the up and down volume button on the iPhone does not do anything :
- on screen, nothing is displayed (I mean, the iOS black and white "slider" overlay does not appear to show me that volume is changing).
- in app, after playing with hard buttons, no impact on the sound volume when some sound is played (I use an AVAudioPlayer)
- this is the same if I quit the app, adjust the sound volume (onscreen "slider"overlay shows up to show me that the sound level have decreased for example), kill the app and relaunch it : same sound level that before
Using those hard buttons work though on the springboard and into other apps ("slider" overlay is displayed and volume is changing).
What is the problem with my app ?
As far as I've seen, many app, and angry birds for an example, make sounds, does not have a hard slider to change it's volume when playing game, and sound can be adjusted just playing with hard buttons.
I got some users of my app with the same problem, it was not my code but their iPhone settings:
Go to Settings->Sound->Change with Buttons and set it to Off
How your app behaves with that stuff depends on how you have set up your audio session. There are as I recall five different categories to choose from. Which category you choose affects how your app behaves with respect to hardware buttons, volume, backgrounding, and so on.
Best bet is to have a look at the Apple docs here:
http://developer.apple.com/library/ios/#DOCUMENTATION/Audio/Conceptual/AudioSessionProgrammingGuide/Configuration/Configuration.html#//apple_ref/doc/uid/TP40007875-CH3-SW1
Also, there is a really great tutorial video by Apple that covers this stuff really well. Here's the link:
https://developer.apple.com/videos/iphone/#video-advanced-audiodev
I wanted to ask if there is any way to control the volume of the system sound effect. When I press the volume control toggle (up and down) in the game, the system sound effects does not get affected. I also read that this should be affected by the ringer volume. But the weird thing is that when I press the volume up and down, I do not see the little ringer text on top of the speaker icon. I only see the speaker icon without ringer on top when I press the volume control. Does anyone know why?
Thanks.
If audio is playing on your device using audioQueue, iPod or some other form other than system sounds, the volume adjusted by the side buttons will be the device volume. If the device is otherwise silent, adjusting the side buttons will adjust the ringer volume.
if you want to affected,you can use this
[[AVAudioSession sharedInstance]
setCategory:AVAudioSessionCategoryPlayAndRecord
withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker
error:nil];