in web-ui/src/components/chime/ChimeSdkWrapper.js [204:249]
async joinRoom(element) {
if (!element) {
this.logError(new Error(`element does not exist`));
return;
}
window.addEventListener('unhandledrejection', (event) => {
this.logError(event.reason);
});
const audioInputs = await this.audioVideo.listAudioInputDevices();
if (audioInputs && audioInputs.length > 0 && audioInputs[0].deviceId) {
this.currentAudioInputDevice = {
label: audioInputs[0].label,
value: audioInputs[0].deviceId,
};
await this.audioVideo.chooseAudioInputDevice(audioInputs[0].deviceId);
}
const audioOutputs = await this.audioVideo.listAudioOutputDevices();
if (audioOutputs && audioOutputs.length > 0 && audioOutputs[0].deviceId) {
this.currentAudioOutputDevice = {
label: audioOutputs[0].label,
value: audioOutputs[0].deviceId,
};
await this.audioVideo.chooseAudioOutputDevice(audioOutputs[0].deviceId);
}
const videoInputs = await this.audioVideo.listVideoInputDevices();
if (videoInputs && videoInputs.length > 0 && videoInputs[0].deviceId) {
this.currentVideoInputDevice = {
label: videoInputs[0].label,
value: videoInputs[0].deviceId,
};
await this.audioVideo.chooseVideoInputDevice(null);
}
this.publishDevicesUpdated();
try {
await this.audioVideo.bindAudioElement(element);
this.audioVideo.start();
} catch (error) {
console.log('failed to bind audio element: ', error);
}
}