core audio - UISlider following sound volume, not working -


I have a problem with my iPhone app with sound I have a UISlider object that I can adjust to the sound volume I use

When I see this, I use the code based on the following line to set the initial value of the slider:

  audio sessiongate property ('chuv' , And datasys, and volumes);   

And it works fine then I would like to run the slider accordingly when I activate the device's hardware sound volume button. But on the basis of this type of code on this part:

  AUDIOssociationproductIdd Volume ChangeId = kAudioSessionProperty_CurrentHardwareOutputVolume; AudioSessionAddPropertyListener (volumeChangeID, handleSoundVolume, self);   

does not work so well What can I see that the callback function: handleSoundVolume is called only when some sound is running and otherwise not. On the other hand, the value provided by AudioSessionGetProperty is always true for sound playing or not. Why is it like this?

I thought AudioSessionGetProperty and AudioSessionAddPropertyListener were working "together", but it does not seem like that.

Looking at the default music app when touching the iPod, it seems that

Have seen the same problem, callback does not work for me at all.

The best solution is to add an Observer to the NSNation Center, for the property AVC System Controller / SystemWalled Change Notification.

  NSNitification Center * center = [Default Center of NSNation Center]; [Center addObserver: Self selector: @Selector (by changing the volume) Name: @ "AVS System Controller SystemWall Disease Notification" Object: Zero];   

And you have the method

  - (zero) changed the volume: (NSNotification *) Notification {Float Volume = [[[User Information] [User Information] ObjectForake : @ "AviSystem Controller_AudioOolumation Pirmter"] Float Value]; }   

The way I suggest instead of using 'chov', you must continuously

  kAudioSessionProperty_CurrentHardwareOutputVolume   < / Pre>  should use> 

Comments