Last active
July 13, 2021 18:00
-
-
Save Koze/058f12cd85d6f029c647 to your computer and use it in GitHub Desktop.
Private volume API with MPMusicPlayerController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// MPMusicPlayerController has private method setVolume: and setVolumePrivate: | |
// The following KVO works on iOS 8.3. | |
MPMusicPlayerController *playerController = [MPMusicPlayerController systemMusicPlayer]; | |
[playerController setValue:@(0.1) forKey:@"volume"]; | |
[playerController setValue:@(0.2) forKey:@"volumePrivate"]; |
@cyberdude
I think that the volume of systemMusicPlayer is equivalent to device volume like Music app.
Therefore, there will be no API for control only the volume of the music.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @Koze.
Thanks for sharing this! Do you happen to know if you can just lower the systemMusicPlayer but not the whole device volume? These two keys are affecting the whole system volume
Maybe there's a magic key hidden somewhere ;)
Cheerios,
capo