如何以编程方式更改iOS设备的音量? [英] How to change an iOS device volume programmatically?

查看:104
本文介绍了如何以编程方式更改iOS设备的音量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过编程方式更改设备音量?也许使用音频会话?

Is there a way to change the device volume programmatically? maybe using audio session?

推荐答案

我非常确定不可能控制实际设备的音量(因为这也有些麻烦)控制正在播放的某些媒体是另一回事.但是,您可以查看MPVolumeView: https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPVolumeView_Class/index.html 用于显示用于设置音量的视图.

I'm pretty sure that it is not possible to control the actual device volume (as this would also be a bit obtrusive) Controlling some media you're playing is another thing. You could however look into MPVolumeView: https://developer.apple.com/library/ios/documentation/MediaPlayer/Reference/MPVolumeView_Class/index.html for displaying a view for setting the volume.

这里也讨论了这个问题: 如何在iOS上更改设备音量-而不是音乐音量

The question has also been discussed here: How to change device Volume on iOS - not music volume

这篇关于如何以编程方式更改iOS设备的音量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆