Skip to content
Aric edited this page Jul 17, 2014 · 7 revisions

The Volume Controls Cordova Plugin allows a user to get/set the ringer volume/mode along with the media volume level.

The system Toast window is disabled by default. It can be flagged as enabled to show it when volume values are changed.


Value Up

Increases audio stream by one.

@stream - String, 'ringer/media'

@toast - Boolean, true

@returnVal - Int, New Current Value

window.volumecontrols.up({stream:arg, toast:arg, success:function(returnVal){}});

window.volumecontrols.up({stream:'ringer', toast:true});


Value Down

Decreases audio stream by one.

@stream - String, 'ringer/media'

@toast - Boolean, true

@returnVal - Int, New Current Value

window.volumecontrols.down({stream:arg, toast:arg, success:function(returnVal){}});

window.volumecontrols.down({stream:'media'});


Percentage

Sets volume to passed percentage value.

@value - Int, 0-100

@stream - String, 'ringer/media'

@toast - Boolean, true

@returnVal - Int, New Current Percentage Value

window.volumecontrols.percentage({stream:arg, toast:arg, value:int, success:function(returnVal){}});

window.volumecontrols.percentage({stream:'ringer', value:63});


Mute

Mutes the media stream

@returnVal - Int, 0

window.volumecontrols.mute({success:function(returnVal){ //dosomething}});


Ringer Modes

Sets ringer modes: Silent, Vibrate or Normal. Percentage Boolean only applies to the 'Normal' call, returning the percentage value of the current ringer volume.

@percentage - Boolean, true

@returnVal - String, 'vibrate/silent'

`@returnVal - Int, Current value. <- @.normal({});'

window.volumecontrols.vibrate({success:function(returnVal){}});

window.volumecontrols.silent({success:function(returnVal){}});

window.volumecontrols.normal({percentage:boolean, success:function(returnVal){}});


Ringer Checks

Check the current ringer mode/value.

window.volumecontrols.check({stream:'ringer', flag:'mode'}); <- @returnVal - String, 'silent/vibrate/normal'

window.volumecontrols.check({stream:'ringer', flag:'max'}); <- @returnVal - Int, Max Value

window.volumecontrols.check({stream:'ringer', flag:'percentage'}); <- @returnVal - Int, Current Value as percentage

window.volumecontrols.check({stream:'ringer'}); <- @returnVal - Int, Current Value


Media Checks

Check the current media mode/value.

window.volumecontrols.check({stream:'media', flag:'percentage'}); <- @returnVal - Int, Current Value as percentage

window.volumecontrols.check({stream:'media', flag:'max'}); <- @returnVal - Int, Max Value

window.volumecontrols.check({stream:'media'}); <- @returnVal - Int, Current Value

Clone this wiki locally