iPhone - Can't adjust sound volume with hard buttons - iphone

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

Related

How to put iPhone's screen onto mac in Xcode

I watched a tutorial, what that guy did on his iPhone, appeared in Xcode simultaneously, and just like in a simulator. How to do that? THX.
Open QuickTime Player,
File>New Movie Recording
Besides Record button(on the Quick Time Player), there is down arrow.
Click on down arrow and select iPhone
There are several possibilities, depending on what exactly you saw in the tutorial.
Live video
If the video was live, there are two things he could have been doing:
Airserver, etc. (blue bar)
He could have been using an AirPlay Mirroring server app to use Airplay Mirroring on the iPhone to show his screen directly onto the Mac's screen. This is the most probable method.
Simulator (no blue bar)
He could have actually been using the simulator, unless he specifically said he was using a device. There are apps you can use to make your mouse look like a finger on the simulator's display. Slightly unlikely.
Still pictures
This is the more unlikely version of the two, and would mean that all you could see was individual still pictures of the app running on the device.
In the Xcode organizer, you can go to the screenshots tab for a device and take a screenshot of the current display of the device. Highly unlikely.

Play splash movie every time app launch (with multi-task support)

the app I'm working on supports iOS multi-task feature by default, and I want to stick with this.
Upon app launch, a splash movie clip is played (code is in AppDelegate), after user hits the home button, and re-launches the app, I want to the same splash movie be played before showing the last view where use was.
I know by switching off the multi-task support, I can achieve this, but in the meanwhile, I'm losing the multi-task support feature, and I need to write code to save/resume user states. So, is there any workaround for this? thanks!
You could try the app delegate's applicationDidBecomeActive: method but quite frankly I'd consider this to be user hostile behaviour. Who wants to see a movie every time they switch between apps? The point of multitasking on the iPhone is to quickly change between apps and this violates that.

Change the sound from camera [duplicate]

In my iPhone app, I am using the UIImagePickerController with source type UIImagePickerControllerSourceTypeCamera. When the user takes a picture, the phone plays the familiar camera shutter sound. How can I replace this with my own custom sound? I know it's possible because I've seen other apps from the App Store do it (e.g. Red Laser).
I am quite certain it's not possible. AFAIK, Red Laser doesn't actually take a "normal" picture but uses UIGetScreenImage() (undocumented but nevertheless allowed for App Store apps) to make a screenshot of the live video feed. Since the OS does not play sound on this occasion, they are free to play their own sound.
Edit for clarification: As of OS 3.1, you are free to substitute the standard camera interface with your own controls. So you could place your own shutter button on the screen and play your own sound when the user taps it, but AFAIK there is now way to get rid of the OS's standard shutter sound.
AFAIK the standard camera shutter sound cannot be changed via SDK.
This answer supports that. You can replace your own sound by switching sound files, but not in an app.
Some answers such as this one suggest using AVCapture, but this method takes video screenshots, which reduces the image quality. I
t appears that you can't change the shutter sound because you could make it a silent sound, and capturing images covertly is against the App Store policy. See this answer.
TLDR:
The only way to change the shutter sound is to use a video screen grab.

Overriding iPhone shutter sound through SDK

In my iPhone app, I am using the UIImagePickerController with source type UIImagePickerControllerSourceTypeCamera. When the user takes a picture, the phone plays the familiar camera shutter sound. How can I replace this with my own custom sound? I know it's possible because I've seen other apps from the App Store do it (e.g. Red Laser).
I am quite certain it's not possible. AFAIK, Red Laser doesn't actually take a "normal" picture but uses UIGetScreenImage() (undocumented but nevertheless allowed for App Store apps) to make a screenshot of the live video feed. Since the OS does not play sound on this occasion, they are free to play their own sound.
Edit for clarification: As of OS 3.1, you are free to substitute the standard camera interface with your own controls. So you could place your own shutter button on the screen and play your own sound when the user taps it, but AFAIK there is now way to get rid of the OS's standard shutter sound.
AFAIK the standard camera shutter sound cannot be changed via SDK.
This answer supports that. You can replace your own sound by switching sound files, but not in an app.
Some answers such as this one suggest using AVCapture, but this method takes video screenshots, which reduces the image quality. I
t appears that you can't change the shutter sound because you could make it a silent sound, and capturing images covertly is against the App Store policy. See this answer.
TLDR:
The only way to change the shutter sound is to use a video screen grab.

MPVolume on ipodtouch/iphone

i'm using the code of this link: http://blog.stormyprods.com/2008/09/proper-usage-of-mpvolumeview-class.html
it is working on an ipod touch, but NOT on iphones.
what can be the reason for that?
Two things:
I think iPhone OS 3.0 does a better job of syncing the MPVolumeView slider with changes to the system volume received from the buttons on side. So the workaround on that blog (listening for NSNotifications) may no longer be necessary.
On the iPhone, volume changes are contextual. If your app is currently playing sound, then hitting the volume buttons (or, presumably, MPVolumeView) affects the volume level of your app's audio. But if your app isn't producing sound, then you are just changing the ringer volume. This might explain why your current code works on touches, which don't have ringers.