Handle device change properly based on paused status.
parent
2e3749cafe
commit
21f2018e71
|
|
@ -402,7 +402,7 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.updateMic({ restart: true });
|
this.updateMic({ start: true });
|
||||||
|
|
||||||
store.dispatch(requestActions.notify(
|
store.dispatch(requestActions.notify(
|
||||||
{
|
{
|
||||||
|
|
@ -421,7 +421,7 @@ export default class RoomClient
|
||||||
if (this._webcamProducer)
|
if (this._webcamProducer)
|
||||||
this.disableWebcam();
|
this.disableWebcam();
|
||||||
else
|
else
|
||||||
this.updateWebcam({ restart: true });
|
this.updateWebcam({ start: true });
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -969,7 +969,7 @@ export default class RoomClient
|
||||||
|
|
||||||
if (!this._micProducer)
|
if (!this._micProducer)
|
||||||
{
|
{
|
||||||
this.updateMic({ restart: true });
|
this.updateMic({ start: true });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -1153,10 +1153,11 @@ export default class RoomClient
|
||||||
meActions.setAudioOutputInProgress(false));
|
meActions.setAudioOutputInProgress(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateMic({ restart = false, newDeviceId = null } = {})
|
async updateMic({ start = false, restart = false, newDeviceId = null } = {})
|
||||||
{
|
{
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'updateMic() [restart:"%s", newDeviceId:"%s"]',
|
'updateMic() [start:"%s", restart:"%s", newDeviceId:"%s"]',
|
||||||
|
start,
|
||||||
restart,
|
restart,
|
||||||
newDeviceId
|
newDeviceId
|
||||||
);
|
);
|
||||||
|
|
@ -1192,12 +1193,13 @@ export default class RoomClient
|
||||||
sampleSize
|
sampleSize
|
||||||
} = store.getState().settings;
|
} = store.getState().settings;
|
||||||
|
|
||||||
if (restart)
|
if (
|
||||||
|
(restart && this._micProducer) ||
|
||||||
|
start
|
||||||
|
)
|
||||||
{
|
{
|
||||||
this.disconnectLocalHark();
|
this.disconnectLocalHark();
|
||||||
|
|
||||||
store.dispatch(settingsActions.setSelectedAudioDevice(deviceId));
|
|
||||||
|
|
||||||
if (this._micProducer)
|
if (this._micProducer)
|
||||||
await this.disableMic();
|
await this.disableMic();
|
||||||
|
|
||||||
|
|
@ -1325,6 +1327,7 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateWebcam({
|
async updateWebcam({
|
||||||
|
start = false,
|
||||||
restart = false,
|
restart = false,
|
||||||
newDeviceId = null,
|
newDeviceId = null,
|
||||||
newResolution = null,
|
newResolution = null,
|
||||||
|
|
@ -1332,7 +1335,8 @@ export default class RoomClient
|
||||||
} = {})
|
} = {})
|
||||||
{
|
{
|
||||||
logger.debug(
|
logger.debug(
|
||||||
'updateWebcam() [restart:"%s", newDeviceId:"%s", newResolution:"%s", newFrameRate:"%s"]',
|
'updateWebcam() [start:"%s", restart:"%s", newDeviceId:"%s", newResolution:"%s", newFrameRate:"%s"]',
|
||||||
|
start,
|
||||||
restart,
|
restart,
|
||||||
newDeviceId,
|
newDeviceId,
|
||||||
newResolution,
|
newResolution,
|
||||||
|
|
@ -1371,10 +1375,11 @@ export default class RoomClient
|
||||||
frameRate
|
frameRate
|
||||||
} = store.getState().settings;
|
} = store.getState().settings;
|
||||||
|
|
||||||
if (restart)
|
if (
|
||||||
|
(restart && this._webcamProducer) ||
|
||||||
|
start
|
||||||
|
)
|
||||||
{
|
{
|
||||||
store.dispatch(settingsActions.setSelectedWebcamDevice(deviceId));
|
|
||||||
|
|
||||||
if (this._webcamProducer)
|
if (this._webcamProducer)
|
||||||
await this.disableWebcam();
|
await this.disableWebcam();
|
||||||
|
|
||||||
|
|
@ -1439,7 +1444,6 @@ export default class RoomClient
|
||||||
store.dispatch(producerActions.addProducer(
|
store.dispatch(producerActions.addProducer(
|
||||||
{
|
{
|
||||||
id : this._webcamProducer.id,
|
id : this._webcamProducer.id,
|
||||||
deviceLabel : device.label,
|
|
||||||
source : 'webcam',
|
source : 'webcam',
|
||||||
paused : this._webcamProducer.paused,
|
paused : this._webcamProducer.paused,
|
||||||
track : this._webcamProducer.track,
|
track : this._webcamProducer.track,
|
||||||
|
|
@ -3226,7 +3230,7 @@ export default class RoomClient
|
||||||
if (this._mediasoupDevice.canProduce('audio'))
|
if (this._mediasoupDevice.canProduce('audio'))
|
||||||
if (!this._muted)
|
if (!this._muted)
|
||||||
{
|
{
|
||||||
await this.updateMic({ restart: true });
|
await this.updateMic({ start: true });
|
||||||
let autoMuteThreshold = 4;
|
let autoMuteThreshold = 4;
|
||||||
|
|
||||||
if ('autoMuteThreshold' in window.config)
|
if ('autoMuteThreshold' in window.config)
|
||||||
|
|
@ -3238,7 +3242,7 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
|
|
||||||
if (joinVideo)
|
if (joinVideo)
|
||||||
this.updateWebcam({ restart: true });
|
this.updateWebcam({ start: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
await this._updateAudioOutputDevices();
|
await this._updateAudioOutputDevices();
|
||||||
|
|
@ -3585,12 +3589,12 @@ export default class RoomClient
|
||||||
}
|
}
|
||||||
|
|
||||||
async updateScreenSharing({
|
async updateScreenSharing({
|
||||||
restart = false,
|
start = false,
|
||||||
newResolution = null,
|
newResolution = null,
|
||||||
newFrameRate = null
|
newFrameRate = null
|
||||||
} = {})
|
} = {})
|
||||||
{
|
{
|
||||||
logger.debug('updateScreenSharing() [restart:"%s"]', restart);
|
logger.debug('updateScreenSharing() [start:"%s"]', start);
|
||||||
|
|
||||||
let track;
|
let track;
|
||||||
|
|
||||||
|
|
@ -3617,7 +3621,7 @@ export default class RoomClient
|
||||||
screenSharingFrameRate
|
screenSharingFrameRate
|
||||||
} = store.getState().settings;
|
} = store.getState().settings;
|
||||||
|
|
||||||
if (restart)
|
if (start)
|
||||||
{
|
{
|
||||||
const stream = await this._screenSharing.start({
|
const stream = await this._screenSharing.start({
|
||||||
...VIDEO_CONSTRAINS[screenSharingResolution],
|
...VIDEO_CONSTRAINS[screenSharingResolution],
|
||||||
|
|
|
||||||
|
|
@ -466,7 +466,7 @@ const Me = (props) =>
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
{
|
{
|
||||||
if (micState === 'off')
|
if (micState === 'off')
|
||||||
roomClient.updateMic({ restart: true });
|
roomClient.updateMic({ start: true });
|
||||||
else if (micState === 'on')
|
else if (micState === 'on')
|
||||||
roomClient.muteMic();
|
roomClient.muteMic();
|
||||||
else
|
else
|
||||||
|
|
@ -500,7 +500,7 @@ const Me = (props) =>
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
{
|
{
|
||||||
if (micState === 'off')
|
if (micState === 'off')
|
||||||
roomClient.updateMic({ restart: true });
|
roomClient.updateMic({ start: true });
|
||||||
else if (micState === 'on')
|
else if (micState === 'on')
|
||||||
roomClient.muteMic();
|
roomClient.muteMic();
|
||||||
else
|
else
|
||||||
|
|
@ -538,7 +538,7 @@ const Me = (props) =>
|
||||||
{
|
{
|
||||||
webcamState === 'on' ?
|
webcamState === 'on' ?
|
||||||
roomClient.disableWebcam() :
|
roomClient.disableWebcam() :
|
||||||
roomClient.updateWebcam({ restart: true });
|
roomClient.updateWebcam({ start: true });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{ webcamState === 'on' ?
|
{ webcamState === 'on' ?
|
||||||
|
|
@ -563,7 +563,7 @@ const Me = (props) =>
|
||||||
{
|
{
|
||||||
webcamState === 'on' ?
|
webcamState === 'on' ?
|
||||||
roomClient.disableWebcam() :
|
roomClient.disableWebcam() :
|
||||||
roomClient.updateWebcam({ restart: true });
|
roomClient.updateWebcam({ start: true });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{ webcamState === 'on' ?
|
{ webcamState === 'on' ?
|
||||||
|
|
@ -599,7 +599,7 @@ const Me = (props) =>
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
{
|
{
|
||||||
if (screenState === 'off')
|
if (screenState === 'off')
|
||||||
roomClient.updateScreenSharing({ restart: true });
|
roomClient.updateScreenSharing({ start: true });
|
||||||
else if (screenState === 'on')
|
else if (screenState === 'on')
|
||||||
roomClient.disableScreenSharing();
|
roomClient.disableScreenSharing();
|
||||||
}}
|
}}
|
||||||
|
|
@ -631,7 +631,7 @@ const Me = (props) =>
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
{
|
{
|
||||||
if (screenState === 'off')
|
if (screenState === 'off')
|
||||||
roomClient.updateScreenSharing({ restart: true });
|
roomClient.updateScreenSharing({ start: true });
|
||||||
else if (screenState === 'on')
|
else if (screenState === 'on')
|
||||||
roomClient.disableScreenSharing();
|
roomClient.disableScreenSharing();
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ const ButtonControlBar = (props) =>
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
{
|
{
|
||||||
if (micState === 'off')
|
if (micState === 'off')
|
||||||
roomClient.updateMic({ restart: true });
|
roomClient.updateMic({ start: true });
|
||||||
else if (micState === 'on')
|
else if (micState === 'on')
|
||||||
roomClient.muteMic();
|
roomClient.muteMic();
|
||||||
else
|
else
|
||||||
|
|
@ -220,7 +220,7 @@ const ButtonControlBar = (props) =>
|
||||||
{
|
{
|
||||||
webcamState === 'on' ?
|
webcamState === 'on' ?
|
||||||
roomClient.disableWebcam() :
|
roomClient.disableWebcam() :
|
||||||
roomClient.updateWebcam({ restart: true });
|
roomClient.updateWebcam({ start: true });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{ webcamState === 'on' ?
|
{ webcamState === 'on' ?
|
||||||
|
|
@ -243,7 +243,7 @@ const ButtonControlBar = (props) =>
|
||||||
onClick={() =>
|
onClick={() =>
|
||||||
{
|
{
|
||||||
if (screenState === 'off')
|
if (screenState === 'off')
|
||||||
roomClient.updateScreenSharing({ restart: true });
|
roomClient.updateScreenSharing({ start: true });
|
||||||
else if (screenState === 'on')
|
else if (screenState === 'on')
|
||||||
roomClient.disableScreenSharing();
|
roomClient.disableScreenSharing();
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue