Is there a way to programmatically mute the sound on OSX?

こ雲淡風輕ζ 提交于 2019-12-11 10:29:49

问题


Is there a way to programmatically mute the sound on OSX without using private APIs and in a way that is accepted by the Mac App Store.


回答1:


FOR MAC OS X: This tutorial might be of assistance.

FOR IOS: No.

Sound Mute is a system-wide setting. So for applications developed using the official SDK cannot change (and in most cases cannot even access) system-wide settings.

It is technically possible to change the system volume through the private AVSystemController class in Celestial.framework, but will prevent your app from getting Apple's approval.




回答2:


On the Mac, see Srikar's answer. I believe he's got it covered.

On iOS, [MPMusicPlayerController iPodMusicPlayer].volume = 0.0 will mute the audio output. If there is an MPVolumeView present in your view hierarchy, it will do this without visual feedback; if there is not, it may present the volume change popup you see when you press the hardware volume buttons on the device.



来源:https://stackoverflow.com/questions/8431412/is-there-a-way-to-programmatically-mute-the-sound-on-osx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!