Coder Social home page Coder Social logo

robotji / rbdmuteswitch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rich2k/rbdmuteswitch

0.0 1.0 0.0 180 KB

Prior to iOS 5 it was relatively straightforward to detect whether a device was muted by using an audio route to detect playback type.

License: BSD 4-Clause "Original" or "Old" License

rbdmuteswitch's Introduction

Prior to iOS 5 it was relatively straightforward to detect whether a device was muted by using an audio route to detect playback type.

However under iOS 5 this was changed as Apple never intended for this behaviour.  In fact Apple have stated that there is no way to obtain the positioning of the mute switch and have stated that this is not a bug but an intentional change.

However RBDMuteSwitch is a simple, small and easy to use component that takes minutes to integrate, and will even work under previous versions of iOS.

A sample project is included

To integrate:

Include RBDMuteSwitch.h, RBDMuteSwitch.m and detection.aiff to your app

Add the following to the header file where you wish to detect the mute switch

    #import "RBDMuteSwitch.h"

to your interface declaration add the RBDMuteSwitchDelegate

    @interface MainViewController : UIViewController <RBDMuteSwitchDelegate>

To your implementation you can call the detection routine

    [[RBDMuteSwitch sharedInstance] setDelegate:self];
    [[RBDMuteSwitch sharedInstance] detectMuteSwitch];

then add the isMuted: delegate method

    - (void)isMuted:(BOOL)muted {
        if (muted) {
            NSLog("Muted");
        }
        else {
            NSLog("Not Muted");
        }
    }

rbdmuteswitch's People

Contributors

treadstone42 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.