Fix mute/unmute mic.

master
Håvar Aambø Fosstveit 2019-06-13 13:56:31 +02:00
parent 819bd64948
commit 2aa6166f6b
1 changed files with 12 additions and 4 deletions

View File

@ -78,11 +78,16 @@ const Sidebar = (props) =>
let micTip; let micTip;
if (!me.canSendMic || !micProducer) if (!me.canSendMic)
{ {
micState = 'unsupported'; micState = 'unsupported';
micTip = 'Audio unsupported'; micTip = 'Audio unsupported';
} }
else if (!micProducer)
{
micState = 'off';
micTip = 'Activate audio';
}
else if (!micProducer.locallyPaused && !micProducer.remotelyPaused) else if (!micProducer.locallyPaused && !micProducer.remotelyPaused)
{ {
micState = 'on'; micState = 'on';
@ -90,7 +95,7 @@ const Sidebar = (props) =>
} }
else else
{ {
micState = 'off'; micState = 'muted';
micTip = 'Unmute audio'; micTip = 'Unmute audio';
} }
@ -152,9 +157,12 @@ const Sidebar = (props) =>
size={smallScreen ? 'large' : 'medium'} size={smallScreen ? 'large' : 'medium'}
onClick={() => onClick={() =>
{ {
micState === 'on' ? if (micState === 'off')
roomClient.disableMic() :
roomClient.enableMic(); roomClient.enableMic();
else if (micState === 'on')
roomClient.muteMic();
else
roomClient.unmuteMic();
}} }}
> >
{ micState === 'on' ? { micState === 'on' ?