auto_join_3.3
Håvar Aambø Fosstveit 2020-05-19 14:25:13 +02:00
parent bb391b1390
commit a0a23109a9
3 changed files with 114 additions and 114 deletions

View File

@ -315,7 +315,7 @@ export default class RoomClient
{
const newPeerId = this._spotlights.getNextAsSelected(
store.getState().room.selectedPeerId);
if (newPeerId) this.setSelectedPeer(newPeerId);
break;
}
@ -798,7 +798,7 @@ export default class RoomClient
}
});
torrent.on('done', () =>
torrent.on('done', () =>
{
store.dispatch(
fileActions.setFileDone(
@ -948,7 +948,7 @@ export default class RoomClient
{
await this.sendRequest(
'resumeProducer', { producerId: this._micProducer.id });
store.dispatch(
producerActions.setProducerResumed(this._micProducer.id));
}
@ -1000,23 +1000,23 @@ export default class RoomClient
}
}
disconnectLocalHark()
disconnectLocalHark()
{
logger.debug('disconnectLocalHark() | Stopping harkStream.');
if (this._harkStream != null)
if (this._harkStream != null)
{
this._harkStream.getAudioTracks()[0].stop();
this._harkStream = null;
}
if (this._hark != null)
if (this._hark != null)
{
logger.debug('disconnectLocalHark() Stopping hark.');
this._hark.stop();
}
}
connectLocalHark(track)
connectLocalHark(track)
{
logger.debug('connectLocalHark() | Track:%o', track);
this._harkStream = new MediaStream();
@ -1027,21 +1027,21 @@ export default class RoomClient
if (!this._harkStream.getAudioTracks()[0])
throw new Error('getMicStream():something went wrong with hark');
this._hark = hark(this._harkStream,
{
play : false,
interval : 5,
this._hark = hark(this._harkStream,
{
play : false,
interval : 5,
threshold : store.getState().settings.noiseThreshold,
history : 300
});
this._hark.lastVolume = -100;
this._hark.on('volume_change', (volume) =>
this._hark.on('volume_change', (volume) =>
{
volume = Math.round(volume);
if (this._micProducer && volume !== Math.round(this._hark.lastVolume))
{
if (volume < this._hark.lastVolume * 1.02)
if (volume < this._hark.lastVolume * 1.02)
{
volume = this._hark.lastVolume * 1.02;
}
@ -1052,7 +1052,7 @@ export default class RoomClient
this._hark.on('speaking', () =>
{
store.dispatch(meActions.setIsSpeaking(true));
if ((store.getState().settings.voiceActivatedUnmute ||
if ((store.getState().settings.voiceActivatedUnmute ||
store.getState().me.isAutoMuted) &&
this._micProducer &&
this._micProducer.paused)
@ -1064,9 +1064,9 @@ export default class RoomClient
this._hark.on('stopped_speaking', () =>
{
store.dispatch(meActions.setIsSpeaking(false));
if (store.getState().settings.voiceActivatedUnmute &&
if (store.getState().settings.voiceActivatedUnmute &&
this._micProducer &&
!this._micProducer.paused)
!this._micProducer.paused)
{
this._micProducer.pause();
store.dispatch(meActions.setAutoMuted(true));
@ -1082,7 +1082,7 @@ export default class RoomClient
meActions.setAudioInProgress(true));
try
{
{
const device = this._audioDevices[deviceId];
if (!device)
@ -1201,7 +1201,7 @@ export default class RoomClient
...VIDEO_CONSTRAINS[resolution]
}
});
if (stream)
{
const track = stream.getVideoTracks()[0];
@ -1212,15 +1212,15 @@ export default class RoomClient
{
await this._webcamProducer.replaceTrack({ track });
}
else
else
{
this._webcamProducer = await this._sendTransport.produce({
track,
appData :
appData :
{
source : 'webcam'
}
});
});
}
store.dispatch(
@ -1230,7 +1230,7 @@ export default class RoomClient
{
logger.warn('getVideoTracks Error: First Video Track is null');
}
}
else
{
@ -1264,7 +1264,7 @@ export default class RoomClient
if (!device)
throw new Error('no webcam devices');
logger.debug(
'changeWebcam() | new selected webcam [device:%o]',
device);
@ -1292,17 +1292,17 @@ export default class RoomClient
{
await this._webcamProducer.replaceTrack({ track });
}
else
else
{
this._webcamProducer = await this._sendTransport.produce({
track,
appData :
appData :
{
source : 'webcam'
}
});
});
}
store.dispatch(
producerActions.setProducerTrack(this._webcamProducer.id, track));
@ -1311,7 +1311,7 @@ export default class RoomClient
{
logger.warn('getVideoTracks Error: First Video Track is null');
}
}
else
{
@ -2098,7 +2098,7 @@ export default class RoomClient
const { displayName } = store.getState().settings;
const { picture } = store.getState().me;
await this.sendRequest('changeDisplayName', { displayName });
await this.sendRequest('changePicture', { picture });
break;
@ -2107,10 +2107,10 @@ export default class RoomClient
case 'signInRequired':
{
store.dispatch(roomActions.setSignInRequired(true));
break;
}
case 'overRoomLimit':
{
store.dispatch(roomActions.setOverRoomLimit(true));
@ -2126,24 +2126,24 @@ export default class RoomClient
store.dispatch(roomActions.toggleJoined());
store.dispatch(roomActions.setInLobby(false));
await this._joinRoom({ joinVideo });
break;
}
case 'roomBack':
{
await this._joinRoom({ joinVideo });
break;
}
case 'lockRoom':
{
store.dispatch(
roomActions.setRoomLocked());
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
@ -2151,15 +2151,15 @@ export default class RoomClient
defaultMessage : 'Room is now locked'
})
}));
break;
}
case 'unlockRoom':
{
store.dispatch(
roomActions.setRoomUnLocked());
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
@ -2167,21 +2167,21 @@ export default class RoomClient
defaultMessage : 'Room is now unlocked'
})
}));
break;
}
case 'parkedPeer':
{
const { peerId } = notification.data;
store.dispatch(
lobbyPeerActions.addLobbyPeer(peerId));
store.dispatch(
roomActions.setToolbarsVisible(true));
this._soundNotification();
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
@ -2189,7 +2189,7 @@ export default class RoomClient
defaultMessage : 'New participant entered the lobby'
})
}));
break;
}
@ -2218,7 +2218,7 @@ export default class RoomClient
)
);
});
store.dispatch(
roomActions.setToolbarsVisible(true));
@ -2235,14 +2235,14 @@ export default class RoomClient
break;
}
case 'lobby:peerClosed':
{
const { peerId } = notification.data;
store.dispatch(
lobbyPeerActions.removeLobbyPeer(peerId));
store.dispatch(requestActions.notify(
{
text : intl.formatMessage({
@ -2250,10 +2250,10 @@ export default class RoomClient
defaultMessage : 'Participant in lobby left'
})
}));
break;
}
case 'lobby:promotedPeer':
{
const { peerId } = notification.data;
@ -2263,7 +2263,7 @@ export default class RoomClient
break;
}
case 'lobby:changeDisplayName':
{
const { peerId, displayName } = notification.data;
@ -2283,11 +2283,11 @@ export default class RoomClient
break;
}
case 'lobby:changePicture':
{
const { peerId, picture } = notification.data;
store.dispatch(
lobbyPeerActions.setLobbyPeerPicture(picture, peerId));
@ -2305,7 +2305,7 @@ export default class RoomClient
case 'setAccessCode':
{
const { accessCode } = notification.data;
store.dispatch(
roomActions.setAccessCode(accessCode));
@ -2319,14 +2319,14 @@ export default class RoomClient
break;
}
case 'setJoinByAccessCode':
{
const { joinByAccessCode } = notification.data;
store.dispatch(
roomActions.setJoinByAccessCode(joinByAccessCode));
if (joinByAccessCode)
{
store.dispatch(requestActions.notify(
@ -2337,7 +2337,7 @@ export default class RoomClient
})
}));
}
else
else
{
store.dispatch(requestActions.notify(
{
@ -2350,20 +2350,20 @@ export default class RoomClient
break;
}
case 'activeSpeaker':
{
const { peerId } = notification.data;
store.dispatch(
roomActions.setRoomActiveSpeaker(peerId));
if (peerId && peerId !== this._peerId)
this._spotlights.handleActiveSpeaker(peerId);
break;
}
case 'changeDisplayName':
{
const { peerId, displayName, oldDisplayName } = notification.data;
@ -2571,74 +2571,74 @@ export default class RoomClient
{
const { consumerId } = notification.data;
const consumer = this._consumers.get(consumerId);
if (!consumer)
break;
consumer.close();
if (consumer.hark != null)
consumer.hark.stop();
this._consumers.delete(consumerId);
const { peerId } = consumer.appData;
store.dispatch(
consumerActions.removeConsumer(consumerId, peerId));
break;
}
case 'consumerPaused':
{
const { consumerId } = notification.data;
const consumer = this._consumers.get(consumerId);
if (!consumer)
break;
store.dispatch(
consumerActions.setConsumerPaused(consumerId, 'remote'));
break;
}
case 'consumerResumed':
{
const { consumerId } = notification.data;
const consumer = this._consumers.get(consumerId);
if (!consumer)
break;
store.dispatch(
consumerActions.setConsumerResumed(consumerId, 'remote'));
break;
}
case 'consumerLayersChanged':
{
const { consumerId, spatialLayer, temporalLayer } = notification.data;
const consumer = this._consumers.get(consumerId);
if (!consumer)
break;
store.dispatch(consumerActions.setConsumerCurrentLayers(
consumerId, spatialLayer, temporalLayer));
break;
}
case 'consumerScore':
{
const { consumerId, score } = notification.data;
store.dispatch(
consumerActions.setConsumerScore(consumerId, score));
break;
}
@ -2752,7 +2752,7 @@ export default class RoomClient
break;
}
default:
{
logger.error(
@ -2799,7 +2799,7 @@ export default class RoomClient
this._webTorrent.on('error', (error) =>
{
logger.error('Filesharing [error:"%o"]', error);
store.dispatch(requestActions.notify(
{
type : 'error',
@ -3021,7 +3021,7 @@ export default class RoomClient
);
}
locked ?
locked ?
store.dispatch(roomActions.setRoomLocked()) :
store.dispatch(roomActions.setRoomUnLocked());
@ -3047,14 +3047,14 @@ export default class RoomClient
await this.enableMic();
const { autoMuteThreshold } = store.getState().settings;
if (autoMuteThreshold && peers.length > autoMuteThreshold)
if (autoMuteThreshold && peers.length > autoMuteThreshold)
this.muteMic();
}
if (joinVideo && this._mediasoupDevice.canProduce('video'))
this.enableWebcam();
}
await this._updateAudioOutputDevices();
const { selectedAudioOutputDevice } = store.getState().settings;
@ -3067,7 +3067,7 @@ export default class RoomClient
)
);
}
store.dispatch(roomActions.setRoomState('connected'));
// Clean all the existing notifications.
@ -3251,7 +3251,7 @@ export default class RoomClient
if (!device)
throw new Error('no webcam devices');
logger.debug(
'addExtraVideo() | new selected webcam [device:%o]',
device);
@ -3296,7 +3296,7 @@ export default class RoomClient
{
videoGoogleStartBitrate : 1000
},
appData :
appData :
{
source : 'extravideo'
}
@ -3306,7 +3306,7 @@ export default class RoomClient
{
producer = await this._sendTransport.produce({
track,
appData :
appData :
{
source : 'extravideo'
}
@ -3400,7 +3400,7 @@ export default class RoomClient
if (!device)
throw new Error('no audio devices');
logger.debug(
'enableMic() | new selected audio device [device:%o]',
device);
@ -3437,7 +3437,7 @@ export default class RoomClient
opusPtime : '3',
opusMaxPlaybackRate : 48000
},
appData :
appData :
{ source: 'mic' }
});
@ -3597,7 +3597,7 @@ export default class RoomClient
{
videoGoogleStartBitrate : 1000
},
appData :
appData :
{
source : 'screen'
}
@ -3607,7 +3607,7 @@ export default class RoomClient
{
this._screenSharingProducer = await this._sendTransport.produce({
track,
appData :
appData :
{
source : 'screen'
}
@ -3725,7 +3725,7 @@ export default class RoomClient
if (!device)
throw new Error('no webcam devices');
logger.debug(
'_setWebcamProducer() | new selected webcam [device:%o]',
device);
@ -3768,7 +3768,7 @@ export default class RoomClient
{
videoGoogleStartBitrate : 1000
},
appData :
appData :
{
source : 'webcam'
}
@ -3778,7 +3778,7 @@ export default class RoomClient
{
this._webcamProducer = await this._sendTransport.produce({
track,
appData :
appData :
{
source : 'webcam'
}

View File

@ -312,7 +312,7 @@ const TopBar = (props) =>
</Typography>
<div className={classes.grow} />
<div className={classes.sectionDesktop}>
<Tooltip
<Tooltip
title={intl.formatMessage({
id : 'label.moreActions',
defaultMessage : 'More actions'
@ -350,7 +350,7 @@ const TopBar = (props) =>
</IconButton>
</Tooltip>
}
<Tooltip
<Tooltip
title={intl.formatMessage({
id : 'tooltip.participants',
defaultMessage : 'Show participants'
@ -421,7 +421,7 @@ const TopBar = (props) =>
</span>
</Tooltip>
{ lobbyPeers.length > 0 &&
<Tooltip
<Tooltip
title={intl.formatMessage({
id : 'tooltip.lobby',
defaultMessage : 'Show lobby'
@ -457,7 +457,7 @@ const TopBar = (props) =>
})}
className={classes.actionButton}
color='inherit'
onClick={() =>
onClick={() =>
{
loggedIn ? roomClient.logout() : roomClient.login();
}}
@ -480,7 +480,7 @@ const TopBar = (props) =>
<MoreIcon />
</IconButton>
{ lobbyPeers.length > 0 &&
<Tooltip
<Tooltip
title={intl.formatMessage({
id : 'tooltip.lobby',
defaultMessage : 'Show lobby'
@ -506,7 +506,7 @@ const TopBar = (props) =>
</IconButton>
</span>
</Tooltip>
}
}
</div>
<div className={classes.divider} />
@ -559,8 +559,8 @@ const TopBar = (props) =>
/>
</p>
</MenuItem>
<MenuItem
onClick={() =>
<MenuItem
onClick={() =>
{
handleMenuClose();
setHelpOpen(!room.helpOpen);
@ -579,8 +579,8 @@ const TopBar = (props) =>
/>
</p>
</MenuItem>
<MenuItem
onClick={() =>
<MenuItem
onClick={() =>
{
handleMenuClose();
setAboutOpen(!room.aboutOpen);
@ -613,7 +613,7 @@ const TopBar = (props) =>
{ loginEnabled &&
<MenuItem
aria-label={loginTooltip}
onClick={() =>
onClick={() =>
{
handleMenuClose();
loggedIn ? roomClient.logout() : roomClient.login();
@ -699,7 +699,7 @@ const TopBar = (props) =>
</p>
</MenuItem>
{ lobbyPeers.length > 0 &&
<MenuItem
<MenuItem
aria-label={intl.formatMessage({
id : 'tooltip.lobby',
defaultMessage : 'Show lobby'

View File

@ -3,13 +3,13 @@
* after the given amount of milliseconds has passed since
* the last time the callback function was called.
*/
export const idle = (callback, delay) =>
export const idle = (callback, delay) =>
{
let handle;
return () =>
return () =>
{
if (handle)
if (handle)
{
clearTimeout(handle);
}