Cordova Allow Audio to Play in Background and in Silent Switch

This plugin is useful when your phone switch is on silent and you want app music to play on silent. This also lets music play in the background. This is a Cordova Plugin.

This plugin is very usefull when you want to play HTML5 Audio Tracks in Background and super easy to use. It also bypass the silent mode on iOS. 

Plugin Source: https://github.com/katzer/cordova-plugin-background-mode 

 

Install Plugin in Cordova

cordova plugin add cordova-plugin-background-mode

Enable Background or Disable

document.addEventListener('deviceready', function () {
    cordova.plugins.backgroundMode.enable(); //To Enable
    cordova.plugins.backgroundMode.disable(); // To Disable
}, false);

Super Useful if you want your music to keep playing when your phone is on silent (iOS).