IPhone - Pressing a Capture Device Button

I know that you cannot control the volume of the device from your application, but I would like the device volume to be able to influence the UIScrollBar that I have in my volume management application.

I know that this is possible, because the Last.fm application does this, I would like to implement this behavior.

I can find very little information about networks. Can anyone help me? :)

+5
source share
1 answer

It is easy with a listener callback

void audioVolumeChangeListenerCallback (void *inUserData, AudioSessionPropertyID inID, UInt32 inDataSize, const void *inData)
{
    RootViewController *controller = (RootViewController *) inUserData;
    Float32 newGain = *(Float32 *)inData;
    [controller setGainManual:newGain]; 
}

which is initialized in my viewDidLoad view, like this

AudioSessionAddPropertyListener (kAudioSessionProperty_CurrentHardwareOutputVolume ,audioVolumeChangeListenerCallback, self );

All this also supports the SDK / App Store.

+15
source

All Articles