-
Notifications
You must be signed in to change notification settings - Fork 24
API: Volume
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.
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});
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'});
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});
Mutes the media stream
@returnVal - Int, 0
window.volumecontrols.mute({success:function(returnVal){ //dosomething}});
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){}});
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
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