Voximplant. Blog

Microphone activity event

Mic Activity

Measuring microphone activity can be useful in many cases. For example, in case of audio conference it lets developer highlight conference participant who is talking at the moment, or another useful scenario example – measuring call participant’s speech length. Now VoxImplant developers can detect microphone activity at VoxEngine scenarios level, we’ve implement new method for Call class – handleMicStatus , set handle to true and then use new CallEvents.MicStatusChange event to receive the information about microphone activity. Please check the usage example below:

  1. // Inbound call processing
  2. VoxEngine.addEventListener(AppEvents.CallAlerting, function(e) {
  3. var call = e.call;
  4. // Enable mic status tracking
  5. call.handleMicStatus(true);
  6. call.addEventListener(CallEvents.Connected, handleCallConnected);
  7. // Add event listener for mic activity events
  8. call.addEventListener(CallEvents.MicStatusChange, handleMicStatusChange);
  9. call.answer();
  10. });
  11.  
  12. function handleMicStatusChange(e) {
  13. // Write mic activity info into log file
  14. Logger.write("Mic active: "+e.active);
  15. }
  16.  
  17. function handleCallConnected(e) {
  18. Logger.write("Call connected");
  19. }

Comments