Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change volume with MPMusicPlayerController without affecting the device volume

I am using MPMusicPlayerController and AVAudioPlayer simultaneously. For audio balancing, I have two volume sliders for MPMusicPlayerController and AVAudioPlayer each. If I mute the MPMusicPlayer volume and increases AVAudioPlayer volume, the overall device volume mutes and I'm not able to hear the AVAudioPlayer sound.

Then, how can I change the MPMusicPlayer volume independently, without affecting the device volume.

like image 773
iPhoneDv Avatar asked Nov 14 '22 05:11

iPhoneDv


1 Answers

Prior to iOS 7, there was a volume property on MPMusicPlayer - it was deprecated in iOS7. On AVAudioPlayer there still is a volume property, which you can use to change the instance volume, without affecting the device volume.

Now, in iOS 7, I think you can use:

MPVolumeView

like image 146
Fluffhead Avatar answered Dec 20 '22 02:12

Fluffhead