Controlling System volume objc_util
Is there a way of controlling the system volume (not the music player volume!) from objc_util ?
Webmaster4o last edited by
What do you mean by 'system volume', not music player volume? As far as I am aware, the system volume is the music player volume. There's the ringer volume and the music volume, but the music volume controls everything besides the ringtone.
omz last edited by
There is no Apple-sanctioned way (public API) to do this, but this works on iOS 9.2 (things like this tend to break with system updates):
from objc_util import NSBundle, ObjCClass, on_main_thread NSBundle.bundleWithPath_('/System/Library/Frameworks/MediaPlayer.framework').load() MPVolumeView = ObjCClass('MPVolumeView') @on_main_thread def set_system_volume(value): volume_view = MPVolumeView.new().autorelease() for subview in volume_view.subviews(): if subview.isKindOfClass_(ObjCClass('UISlider')): subview.value = value break set_system_volume(0.5)
There's probably a less convoluted way that I don't know of.
@Webmaster4o notifications and ringtone on iPhone
@omz Keep up the good work! Your apps are brilliant! :) Thanks mate!
Does this work on iOS 10?
Because I am looking for a way to mute the ringer volume, and then put it back to where it was.
ccc last edited by
Did you try the solution above? Did it work or not?
I did, it mutes the music player volume. But if i wanted to take a picture without the click noise, I want to mute the ringer. I would turn it immediately back on so I wouldn't make confusion.