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