capacitor-plugin-mute-switch
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

capacitor-plugin-mute-switch

This package is a Capacitor Plugin based on SoundSwitch and it detects if mute switch is enabled or disabled on iOS devices.

Since there is no native iOS API to detect it, the trick is too play a short sound and measure the amount of time it took for the sound to complete playing, this way we can determine if we are in silent mode or not.

Install

npm install capacitor-plugin-mute-switch
npx cap sync

Usage

import { MuteSwitch } from 'capacitor-plugin-mute-switch';

MuteSwitch.isMute().then(response => console.log(response.value))

// Add Listener
const myPluginEventListener = MuteSwitch.addListener('onChange', response => {
    console.log('Silente Mode: ', response.isMute);
});

// Remove
myPluginEventListener.remove();

Supported Methods

Name Android iOS Web
isMute
addListener

License

MIT © Magroove


If you find any bugs or want to contribute to this project, feel free to send us an email: julobato or fafaschiavo

Readme

Keywords

Package Sidebar

Install

npm i capacitor-plugin-mute-switch

Weekly Downloads

2

Version

0.0.1

License

MIT

Unpacked Size

24.9 kB

Total Files

24

Last publish

Collaborators

  • magroove
  • julobato