A Cordova plugin to control the device's media volume. Plugin only supports the Android Platform.
cordova plugin add net.zyion.mediavolume
cordova plugin rm net.zyion.mediavolume
// get the current volume properties
MediaVolume.get().then(function (res) {
console.log('Volume info', res);
});
// set the volume to 5
MediaVolume.set(5).then(function (res) {
console.log('Volume', res.volume);
});
// set the volume to 50%
MediaVolume.setVolume(0.5).then(function (res) {
console.log('Volume', res.volume);
});
// mute the device's media volume
MediaVolume.mute().then(function (res) {
console.log('Volume muted', res.muted);
});
Get the media volume from the device, the function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- max: integer the device's maximum volume
- muted: boolean if the device volume is mute
- fixed: boolean if the device has a fixed volume
Set the media volume for the device requires the following parameter
- value: integer the volume level to set
The function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- muted: boolean if the device volume is mute
Set the media volume for the device requires the following parameter
- value: float the volume level to set as a float from 0.0 - 1.0
The function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- muted: boolean if the device volume is mute
Increase the media volume, the function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- muted: boolean if the device volume is mute
Decrease the media volume, the function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- muted: boolean if the device volume is mute
Mute the device's media volume, the function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- muted: boolean if the device volume is mute
Unmute the device's media volume, the function returns a promise which on success receives a json abject with the following properties
- volume: integer the device's media volume
- muted: boolean if the device volume is mute
Apache 2.0 License