Skip to content

Detect iPhone is mute(silence) or not, detect once or keep detecting . 检测 iPhone 是否静音,可只检测一次,也可循环监听。

License

Notifications You must be signed in to change notification settings

pikacode/EBMuteDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

查看中文文档 Chinese README.md

E-mail:pikacode@qq.com

EBMuteDetector

Detect iPhone is mute(silence) or not, detect once or keep detecting .

Installation

manual

Download and Drag & Copy EBMuteDetector file folder from root into you Xcode project.

Usage

detect once

only detect once, after calling the method, it will detect in 0.02~0.2 sec, when finished will run the block.

use case: if it's not mute, play a short ring.

[EBMuteDetector detectComplete:^(BOOL isMute) {
	if (isMute) {
		NSLog(@"is mute");
	}else{
		NSLog(@"is not mute");
	}
}];

detect in loop

keep detecting  at intervals, then run the block.

use case: when playing a music, if the mute changed, pause/resume the music.

detect in loop
[EBMuteDetector detecting:^(BOOL isMute) {
    if (isMute) {
        NSLog(@"is mute");
    }else{
        NSLog(@"is not mute");
    }
}];
pause
[EBMuteDetector pause];
resume
[EBMuteDetector resume];
vibrate
[EBMuteDetector vibrate];
Detecto Frequency
EBMuteDetectorFrequency = 0.5; // secound, default is 1

set it first,then begin the loop it will works.

License

EBMuteDetector is released under the MIT license. See LICENSE for details.

About

Detect iPhone is mute(silence) or not, detect once or keep detecting . 检测 iPhone 是否静音,可只检测一次,也可循环监听。

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published