Merge branch 'feat-audiocontext' into develop
commit
9013b40143
|
|
@ -87,8 +87,10 @@ export default class RoomClient
|
||||||
// Alert sound
|
// Alert sound
|
||||||
this._soundAlert = new Audio('/sounds/notify.mp3');
|
this._soundAlert = new Audio('/sounds/notify.mp3');
|
||||||
|
|
||||||
// AudioContext
|
if (AudioContext)
|
||||||
this._audioContext= null;
|
{
|
||||||
|
this._audioContext = new AudioContext();
|
||||||
|
}
|
||||||
|
|
||||||
// Socket.io peer connection
|
// Socket.io peer connection
|
||||||
this._signalingSocket = null;
|
this._signalingSocket = null;
|
||||||
|
|
@ -562,15 +564,33 @@ export default class RoomClient
|
||||||
{
|
{
|
||||||
logger.debug('muteMic()');
|
logger.debug('muteMic()');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
this._micProducer.pause();
|
this._micProducer.pause();
|
||||||
}
|
}
|
||||||
|
catch (error)
|
||||||
|
{
|
||||||
|
logger.error('muteMic() | failed: %o', error);
|
||||||
|
|
||||||
|
this.notify('An error occured while accessing your microphone.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
unmuteMic()
|
unmuteMic()
|
||||||
{
|
{
|
||||||
logger.debug('unmuteMic()');
|
logger.debug('unmuteMic()');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
this._micProducer.resume();
|
this._micProducer.resume();
|
||||||
}
|
}
|
||||||
|
catch (error)
|
||||||
|
{
|
||||||
|
logger.error('unmuteMic() | failed: %o', error);
|
||||||
|
|
||||||
|
this.notify('An error occured while accessing your microphone.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Updated consumers based on spotlights
|
// Updated consumers based on spotlights
|
||||||
async updateSpotlights(spotlights)
|
async updateSpotlights(spotlights)
|
||||||
|
|
@ -989,7 +1009,6 @@ export default class RoomClient
|
||||||
logger.debug('resumeAudio()');
|
logger.debug('resumeAudio()');
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (AudioContext)
|
|
||||||
await this._audioContext.resume();
|
await this._audioContext.resume();
|
||||||
|
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
|
|
@ -998,6 +1017,8 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
catch (error)
|
catch (error)
|
||||||
{
|
{
|
||||||
|
store.dispatch(
|
||||||
|
stateActions.setAudioSuspended({ audioSuspended: true }));
|
||||||
logger.error('resumeAudioJoin() failed: %o', error);
|
logger.error('resumeAudioJoin() failed: %o', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1518,14 +1539,12 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (AudioContext)
|
if (this._audioContext)
|
||||||
{
|
{
|
||||||
this._audioContext = new AudioContext();
|
|
||||||
|
|
||||||
// We need to provoke user interaction to get permission from browser to start audio
|
// We need to provoke user interaction to get permission from browser to start audio
|
||||||
if (this._audioContext.state === 'suspended')
|
if (this._audioContext.state === 'suspended')
|
||||||
{
|
{
|
||||||
store.dispatch(stateActions.setAudioSuspended({ audioSuspended: true }));
|
this.resumeAudio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue