Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: Change Device Volume

Tags:

Is there a way to change the volume of the device? I've seen several apps do it.

I have a desktop version of the iOS app and the device will be able to be controlled to some extent over the network. One of the things I want to allow the user to do is change the device volume and then play a sound. This can help if you loose your iPhone in a crack in your couch again, but can't find it.

Is there any way that you can do this without Apple getting angry?

like image 627
Tristan Avatar asked Feb 01 '11 05:02

Tristan


People also ask

Can I set different volumes on iPhone?

You can separately adjust volume with buttons while listening to Audio on headphones/bluetooth. You can adjust call (voice) volume level which is how loud you hear the caller and how loud they can hear you, which can only be adjusted with the buttons during a live call. It cannot be adjusted in settings.

How do I customize the volume on my iPhone?

When you're on the phone or listening to songs, movies, or other media on iPhone, you can use the buttons on the side of your device to adjust the audio volume. Otherwise, the buttons control the volume for the ringer, alerts, and other sound effects.

How do I fix my IOS volume?

Go to Settings > Sounds (or Settings > Sounds & Haptics), and drag the Ringer and Alerts slider back and forth a few times. If you don't hear any sound, or if your speaker button on the Ringer and Alerts slider is dimmed, your speaker might need service.


2 Answers

Using iPodMusicPlayer would affect the actual iPod volume setting as well. If you want to avoid that, use this:

#import <MediaPlayer/MediaPlayer.h> // ... MPMusicPlayerController *musicPlayer = [MPMusicPlayerController applicationMusicPlayer]; musicPlayer.volume = 1.0f;  

As the user holex correctly mentioned the property volume in MPMusicPlayerController is deprecated in iOS 7.

like image 78
ceriseche Avatar answered Sep 28 '22 07:09

ceriseche


You can use a little trick:

  MPMusicPlayerController* musicPlayer = [MPMusicPlayerController iPodMusicPlayer];   musicPlayer.volume = 1; // device volume will be changed to maximum value 
like image 45
Andrii Forkaliuk Avatar answered Sep 28 '22 07:09

Andrii Forkaliuk