Translated media buttons, fixes #309
parent
aa5f75b794
commit
f468f95cdc
|
|
@ -7,6 +7,7 @@ import useMediaQuery from '@material-ui/core/useMediaQuery';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import * as appPropTypes from '../appPropTypes';
|
import * as appPropTypes from '../appPropTypes';
|
||||||
import { withRoomContext } from '../../RoomContext';
|
import { withRoomContext } from '../../RoomContext';
|
||||||
|
import { useIntl } from 'react-intl';
|
||||||
import Fab from '@material-ui/core/Fab';
|
import Fab from '@material-ui/core/Fab';
|
||||||
import Tooltip from '@material-ui/core/Tooltip';
|
import Tooltip from '@material-ui/core/Tooltip';
|
||||||
import MicIcon from '@material-ui/icons/Mic';
|
import MicIcon from '@material-ui/icons/Mic';
|
||||||
|
|
@ -57,6 +58,8 @@ const styles = (theme) =>
|
||||||
|
|
||||||
const ButtonControlBar = (props) =>
|
const ButtonControlBar = (props) =>
|
||||||
{
|
{
|
||||||
|
const intl = useIntl();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
roomClient,
|
roomClient,
|
||||||
toolbarsVisible,
|
toolbarsVisible,
|
||||||
|
|
@ -73,20 +76,37 @@ const ButtonControlBar = (props) =>
|
||||||
|
|
||||||
let micTip;
|
let micTip;
|
||||||
|
|
||||||
if (!me.canSendMic || !micProducer)
|
if (!me.canSendMic)
|
||||||
{
|
{
|
||||||
micState = 'unsupported';
|
micState = 'unsupported';
|
||||||
micTip = 'Audio unsupported';
|
micTip = intl.formatMessage({
|
||||||
|
id : 'device.audioUnsupported',
|
||||||
|
defaultMessage : 'Audio unsupported'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (!micProducer)
|
||||||
|
{
|
||||||
|
micState = 'off';
|
||||||
|
micTip = intl.formatMessage({
|
||||||
|
id : 'device.activateAudio',
|
||||||
|
defaultMessage : 'Activate audio'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (!micProducer.locallyPaused && !micProducer.remotelyPaused)
|
else if (!micProducer.locallyPaused && !micProducer.remotelyPaused)
|
||||||
{
|
{
|
||||||
micState = 'on';
|
micState = 'on';
|
||||||
micTip = 'Mute audio';
|
micTip = intl.formatMessage({
|
||||||
|
id : 'device.muteAudio',
|
||||||
|
defaultMessage : 'Mute audio'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
micState = 'off';
|
micState = 'muted';
|
||||||
micTip = 'Unmute audio';
|
micTip = intl.formatMessage({
|
||||||
|
id : 'device.unMuteAudio',
|
||||||
|
defaultMessage : 'Unmute audio'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let webcamState;
|
let webcamState;
|
||||||
|
|
@ -96,17 +116,26 @@ const ButtonControlBar = (props) =>
|
||||||
if (!me.canSendWebcam)
|
if (!me.canSendWebcam)
|
||||||
{
|
{
|
||||||
webcamState = 'unsupported';
|
webcamState = 'unsupported';
|
||||||
webcamTip = 'Video unsupported';
|
webcamTip = intl.formatMessage({
|
||||||
|
id : 'device.videoUnsupported',
|
||||||
|
defaultMessage : 'Video unsupported'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (webcamProducer)
|
else if (webcamProducer)
|
||||||
{
|
{
|
||||||
webcamState = 'on';
|
webcamState = 'on';
|
||||||
webcamTip = 'Stop video';
|
webcamTip = intl.formatMessage({
|
||||||
|
id : 'device.stopVideo',
|
||||||
|
defaultMessage : 'Stop video'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
webcamState = 'off';
|
webcamState = 'off';
|
||||||
webcamTip = 'Start video';
|
webcamTip = intl.formatMessage({
|
||||||
|
id : 'device.startVideo',
|
||||||
|
defaultMessage : 'Start video'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let screenState;
|
let screenState;
|
||||||
|
|
@ -116,17 +145,26 @@ const ButtonControlBar = (props) =>
|
||||||
if (!me.canShareScreen)
|
if (!me.canShareScreen)
|
||||||
{
|
{
|
||||||
screenState = 'unsupported';
|
screenState = 'unsupported';
|
||||||
screenTip = 'Screen sharing not supported';
|
screenTip = intl.formatMessage({
|
||||||
|
id : 'device.screenSharingUnsupported',
|
||||||
|
defaultMessage : 'Screen sharing not supported'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else if (screenProducer)
|
else if (screenProducer)
|
||||||
{
|
{
|
||||||
screenState = 'on';
|
screenState = 'on';
|
||||||
screenTip = 'Stop screen sharing';
|
screenTip = intl.formatMessage({
|
||||||
|
id : 'device.stopScreenSharing',
|
||||||
|
defaultMessage : 'Stop screen sharing'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screenState = 'off';
|
screenState = 'off';
|
||||||
screenTip = 'Start screen sharing';
|
screenTip = intl.formatMessage({
|
||||||
|
id : 'device.startScreenSharing',
|
||||||
|
defaultMessage : 'Start screen sharing'
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const smallScreen = useMediaQuery(theme.breakpoints.down('sm'));
|
const smallScreen = useMediaQuery(theme.breakpoints.down('sm'));
|
||||||
|
|
@ -143,7 +181,10 @@ const ButtonControlBar = (props) =>
|
||||||
>
|
>
|
||||||
<Tooltip title={micTip} placement={smallScreen ? 'top' : 'right'}>
|
<Tooltip title={micTip} placement={smallScreen ? 'top' : 'right'}>
|
||||||
<Fab
|
<Fab
|
||||||
aria-label='Mute mic'
|
aria-label={intl.formatMessage({
|
||||||
|
id : 'device.muteAudio',
|
||||||
|
defaultMessage : 'Mute audio'
|
||||||
|
})}
|
||||||
className={classes.fab}
|
className={classes.fab}
|
||||||
disabled={!me.canSendMic || me.audioInProgress}
|
disabled={!me.canSendMic || me.audioInProgress}
|
||||||
color={micState === 'on' ? 'default' : 'secondary'}
|
color={micState === 'on' ? 'default' : 'secondary'}
|
||||||
|
|
@ -164,7 +205,10 @@ const ButtonControlBar = (props) =>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title={webcamTip} placement={smallScreen ? 'top' : 'right'}>
|
<Tooltip title={webcamTip} placement={smallScreen ? 'top' : 'right'}>
|
||||||
<Fab
|
<Fab
|
||||||
aria-label='Mute video'
|
aria-label={intl.formatMessage({
|
||||||
|
id : 'device.startVideo',
|
||||||
|
defaultMessage : 'Start video'
|
||||||
|
})}
|
||||||
className={classes.fab}
|
className={classes.fab}
|
||||||
disabled={!me.canSendWebcam || me.webcamInProgress}
|
disabled={!me.canSendWebcam || me.webcamInProgress}
|
||||||
color={webcamState === 'on' ? 'default' : 'secondary'}
|
color={webcamState === 'on' ? 'default' : 'secondary'}
|
||||||
|
|
@ -185,7 +229,10 @@ const ButtonControlBar = (props) =>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Tooltip title={screenTip} placement={smallScreen ? 'top' : 'right'}>
|
<Tooltip title={screenTip} placement={smallScreen ? 'top' : 'right'}>
|
||||||
<Fab
|
<Fab
|
||||||
aria-label='Share screen'
|
aria-label={intl.formatMessage({
|
||||||
|
id : 'device.startScreenSharing',
|
||||||
|
defaultMessage : 'Start screen sharing'
|
||||||
|
})}
|
||||||
className={classes.fab}
|
className={classes.fab}
|
||||||
disabled={!me.canShareScreen || me.screenShareInProgress}
|
disabled={!me.canShareScreen || me.screenShareInProgress}
|
||||||
color={screenState === 'on' ? 'primary' : 'default'}
|
color={screenState === 'on' ? 'primary' : 'default'}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue