Listen for device changes and update device list.

This commit is contained in:
Håvar Aambø Fosstveit
2019-04-05 22:56:51 +02:00
parent 0cd1909af0
commit 7dc4d62c5b
+15
View File
@@ -136,6 +136,8 @@ export default class RoomClient
this._screenSharingProducer = null;
this._startKeyListener();
this._startDevicesListener();
}
close()
@@ -211,6 +213,19 @@ export default class RoomClient
});
}
_startDevicesListener()
{
navigator.mediaDevices.addEventListener('devicechange', async () =>
{
logger.debug('_startDevicesListener() | navigator.mediaDevices.ondevicechange');
await this._updateAudioDevices();
await this._updateWebcams();
this.notify('Your devices changed, configure your devices in the settings dialog.');
});
}
login()
{
const url = `/login?roomId=${this._room.roomId}&peerName=${this._peerName}`;