Call control devices with WebHID Manager
The WebHID Manager utility allows you to integrate external hardware devices for call control functionality. This feature enables you to connect USB or Bluetooth devices to manage call and mute states of your eyeson meetings, providing physical controls for your virtual communication sessions.
Also read the blog article Call control devices - WebHID API
Initialize
import { WebHIDManager } from '@eyeson/js';
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
}
});
}
The initialization process is asynchronous as the WebHID Manager performs a background check to prevent conflicts when used across multiple tabs or browser windows simultaneously.
Available Methods
The WebHID Manager provides several methods to manage device connections and control call states:
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
When an error occurs, the WebHID Manager triggers an error event containing two properties: id
and message
. The id
uniquely identifies the error type, while the message
provides a standard English description of what went wrong. These error details can be used for debugging or displaying appropriate notifications to users.
initialize_failed - "WebHID initializing failed"
pair_request_failed - "Device pair request failed"
invalid_device - "Invalid device"
Eyeson IFrame API already includes the needed permissions.