Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/fopina/MuteDetector
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipe Pina committed Dec 11, 2013
2 parents 2b320d2 + 89d57ce commit 4c744ed
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
MuteDetector
============

Helper class to detect mute switch state

Due to the recent need of detecting mute switch state, I've found SharkfoodMuteSwitchDetector by Moshe Gottlieb (Sharkfood - http://sharkfood.com/archives/450).

This is simply a small redesign of the Moshe's solution to make it easily usable for those of us who simply want to quickly check its state (instead of actively watching it).

Usage
---

* Add _SKMuteSwitchDetector.h, SKMuteSwitchDetector.m and mute.caf_ to your project
* Add _AVFoundation.framework_ to your project
* Import _SKMuteSwitchDetector.h_ in your class and use it as simply as (taken from this demo project _SKViewController.m_):

```objective-c
[SKMuteSwitchDetector checkSwitch:^(BOOL success, BOOL silent) {
NSString *message;
if (success) {
message = [NSString stringWithFormat:@"Mute switch is %@", silent ? @"ON" : @"OFF"];
}
else {
message = @"Failed to detect mute switch state";
}
[[[UIAlertView alloc] initWithTitle:nil message:message delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] show];
}];
```

0 comments on commit 4c744ed

Please sign in to comment.