Skip to content

fopina/MuteDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

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 and SKMuteSwitchDetector.m 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):
    [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];
    }];

About

Helper class to detect mute switch state

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published