本文介绍了获取系统卷 iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的情况很简单:我需要播放警告信号并希望确保用户会听到它,所以我想检查系统音量.

My case is simple:I need to play a warning signal and want to make sure the user will hear it, so I want to check the system volume.

如何知道当前系统音量是多少?

How can I find out what the current system volume is?

推荐答案

Swift 更新

let vol = AVAudioSession.sharedInstance().outputVolume

音频会话可以提供输出音量(iOS >= 6.0).

The audio session can provide output volume (iOS >= 6.0).

float vol = [[AVAudioSession sharedInstance] outputVolume];
NSLog(@"output volume: %1.2f dB", 20.f*log10f(vol+FLT_MIN));

这篇关于获取系统卷 iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 08:22