Listen for device changes and update device list.

master
Håvar Aambø Fosstveit 2019-04-05 22:56:51 +02:00
parent 0cd1909af0
commit 7dc4d62c5b
1 changed files with 15 additions and 0 deletions

View File

@ -136,6 +136,8 @@ export default class RoomClient
this._screenSharingProducer = null; this._screenSharingProducer = null;
this._startKeyListener(); this._startKeyListener();
this._startDevicesListener();
} }
close() 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() login()
{ {
const url = `/login?roomId=${this._room.roomId}&peerName=${this._peerName}`; const url = `/login?roomId=${this._room.roomId}&peerName=${this._peerName}`;