Table of Contents

onVolume()

wrtc.onVolume() is called when wrtc.adv.volumeMeter() has sampled microphone volume.

You can use this event to display current microphone volume, like a volume meter instrument.

Occurs

Each time microphone volume has been sampled.

The number of wrtc.onVolume() events per second is determined by call.adv.stats_ms

Arguments

wrtc.onVolume(arg)

Example

By varying the width of a div according to current volume value you get a volume meter bar.

wrtc.onVolume(arg) {
    document.getElementById("volume").style.width = arg;
}
...
<div id="volume" style="display:inline-block;height:8px;background-color:#ffff00;transition: width 0.6s;"></div>

See also

wrtc.adv.VolumeMeter()