9

So far I've been using an MPVolumeView to control the volume of my iOS devices, which worked just fine until updating to iOS7.

I've created a test project (Base SDK 6.1, Deployment Target 5.1) which has only one MPVolumeView on a single UIView. While running this App on my iPad 1 (iOS 5.1) works just fine, running it on my iPhone 5 (iOS 7) does not.

On my iPad dragging the volume slider changes the whole devices volume. Also when i use the hardware buttons this does reflect on my slider in the VolumeView. On my iPhone on the other hand, it seems that there is no longer a connection between those controls. The hardware buttons do not result in any changes on my VolumeView, neither does changing the slider in the volume control result in the devices volume level.

I need to have e.g. the iPodMusicPlayer playing something, then it works. Otherwise it doesn't.

Does anyone how i can get this to work again? I really need to control the whole devices audio level (not necessarily programmatically, the user needs to be able to change it within my app), not only the level of the sound played by the app itself.

Marco
  • 6,692
  • 2
  • 27
  • 38
Toubey
  • 199
  • 3
  • 14

1 Answers1

0

After Long research i had delivery the answer to here. But i am not sure try with this if you get any issues let me know

Instead of MPVolumeView, you can also use:

 AVAudioPlayer *testPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"m" ofType:@"caf"]] error:nil];

    [testPlayer prepareToPlay];

prior to installing the MPVolumeView.

if your app that uses Audio session mode AVAudioSessionModeVoiceChat does not allow the MPVolumeView to work as well with no workaround.

codercat
  • 22,873
  • 9
  • 61
  • 85