Skip to main content

Call control devices with WebHID Manager

Connect call control devices to synchronize call and mute states of the current meeting.

More details at help.eyeson.com.

Initialize

import { WebHIDManager } from 'eyeson';

if (WebHIDManager.supported) {
const manager = await WebHIDManager.initialize(); // with options: initialize({ verbose: false })

if (manager.blocked) {
// already used in another tab or window
return;
}

manager.onEvent(event => {
const { type } = event;
if (type === 'devicelist') {
console.log(event.devices); // list device { id, vendorId, productId, productName }
}
else if (type === 'error') {
console.log(event.id, event.message); // initialize_failed (WebHID initializing failed), pair_request_failed (Device pair request failed), invalid_device (Invalid device)
}
else if (type === 'togglemute') {
console.log(event.active); // true/false
}
else if (type === 'togglecall') {
console.log(event.active); // true/false
}
});
}

Initilializing is asynchronious, because it runs a check to avoid conflicts if used in multiple tabs or windows at the same time.

More functions

manager.offEvent(); // or with offEvent(namedEventFunction)

await manager.pairDeviceRequest();

manager.emitDeviceList(); // (only if needed again)

manager.setMuteActive(true/false);

manager.setCallActive(true/false);

await manager.removeDevice(deviceId); // "devicelist" event device.id

manager.destroy();

Error event

The event type "error" has an id and message, where message is just a default english description of the error.

  • initialize_failed - "WebHID initializing failed"
  • pair_request_failed - "Device pair request failed"
  • invalid_device - "Invalid device"