This plugin allows you to detect the state of mute switch on iPhone.
The plugin is based on code seen in several other existing plugins:
Thanks to all of the above mentioned authors for sharing their code openly.
cordova plugin add https://github.com/AnasFullStack/Cordova-Plugin-Mute-Switch-Detector.git --nofetch
Detect mute switch status
window.cordova.plugins.DetectMuteSwitch.detectMuteSwitch();
- iOS
Call the window.cordova.plugins.DetectMuteSwitch.detectMuteSwitch()
method passing a callback function
window.cordova.plugins.DetectMuteSwitch.detectMuteSwitch(
function(msg) {
console.log('Result:', msg);
}
);
/*
This will print the Mute switch status
Result: Mute switch is Off
OR
Result: Mute switch is On
*/