HDMuteSwitch 是一个检测 iPhone 手机是否静音的工具。
[[HBMuteSwitch shareInstance] detectMuteSwitch:^(BOOL muted) {
if (muted) {
// 静音
[[HBMuteSwitch shareInstance] repeatPlaySystemSoundVibrate];
} else {
[[HBMuteSwitch shareInstance] repeatPlaySystemSoundVibrate];
// 播放其他自己定义的声音或者歌曲
}
}];
通过 Clone 或下载下载 HDMuteSwitch 文件夹内的所有内容。
将 HDMuteSwitch 内的源文件添加(拖放)到您的工程。
导入#import "HDMuteSwitch.h"。
添加 AudioToolbox.framework 依赖库
类似于微信语音通话和语音视频处理逻辑。
HDMuteSwitch 在 MIT 许可下发布。有关详细信息,请参阅 LICENSE。