Fix media device handling.

master
Håvar Aambø Fosstveit 2019-06-12 15:53:48 +02:00
parent 27a1bf3821
commit 7d831f4bda
1 changed files with 29 additions and 15 deletions

View File

@ -652,9 +652,15 @@ export default class RoomClient
{
logger.debug('muteMic()');
this._micProducer.pause();
try
{
this._micProducer.pause();
await this.sendRequest(
'pauseProducer', { producerId: this._micProducer.id });
store.dispatch(
stateActions.setProducerPaused(this._micProducer.id));
}
catch (error)
{
@ -672,14 +678,21 @@ export default class RoomClient
{
logger.debug('unmuteMic()');
if (!this._micProducer)
{
this.enableMic();
}
else
{
this._micProducer.resume();
try
{
if (this._micProducer)
this._micProducer.resume();
else if (this._room.canSend('audio'))
await this.enableMic();
else
throw new Error('cannot send audio');
await this.sendRequest(
'resumeProducer', { producerId: this._micProducer.id });
store.dispatch(
stateActions.setProducerResumed(this._micProducer.id));
}
catch (error)
{
@ -692,6 +705,7 @@ export default class RoomClient
}));
}
}
}
// Updated consumers based on spotlights
async updateSpotlights(spotlights)