Merge pull request #11515 from mariogasparoni/fix-11490

Cleanup joinedAudioOnly state when user disconnects or reconnect microphone
This commit is contained in:
Anton Georgiev 2021-02-26 13:30:05 -05:00 committed by GitHub
commit e70470e975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 0 deletions

View File

@ -135,4 +135,5 @@ export default {
},
isReturningFromBreakoutAudioTransfer:
() => AudioManager.returningFromBreakoutAudioTransfer,
isReconnecting: () => AudioManager.isReconnecting,
};

View File

@ -102,11 +102,14 @@ class BreakoutRoom extends PureComponent {
breakoutRoomUser,
breakoutRooms,
closeBreakoutPanel,
isMicrophoneUser,
isReconnecting,
} = this.props;
const {
waiting,
requestedBreakoutId,
joinedAudioOnly,
} = this.state;
if (breakoutRooms.length <= 0) closeBreakoutPanel();
@ -120,6 +123,10 @@ class BreakoutRoom extends PureComponent {
_.delay(() => this.setState({ waiting: false }), 1000);
}
}
if (joinedAudioOnly && (!isMicrophoneUser || isReconnecting)) {
this.clearJoinedAudioOnly();
}
}
getBreakoutURL(breakoutId) {
@ -144,6 +151,10 @@ class BreakoutRoom extends PureComponent {
return null;
}
clearJoinedAudioOnly() {
this.setState({ joinedAudioOnly: false });
}
transferUserToBreakoutRoom(breakoutId) {
const { transferToBreakout } = this.props;
transferToBreakout(breakoutId);

View File

@ -25,6 +25,7 @@ export default withTracker((props) => {
const breakoutRooms = findBreakouts();
const isMicrophoneUser = AudioService.isConnected() && !AudioService.isListenOnly();
const isMeteorConnected = Meteor.status().connected;
const isReconnecting = AudioService.isReconnecting();
const { setReturningFromBreakoutAudioTransfer } = AudioService;
return {
@ -43,5 +44,6 @@ export default withTracker((props) => {
isUserInBreakoutRoom,
exitAudio: () => AudioManager.exitAudio(),
setReturningFromBreakoutAudioTransfer,
isReconnecting,
};
})(BreakoutContainer);

View File

@ -52,6 +52,7 @@ class AudioManager {
outputDeviceId: null,
muteHandle: null,
autoplayBlocked: false,
isReconnecting: false,
});
this.useKurento = Meteor.settings.public.kurento.enableListenOnly;
@ -392,12 +393,15 @@ class AudioManager {
} = response;
if (status === STARTED) {
this.isReconnecting = false;
this.onAudioJoin();
resolve(STARTED);
} else if (status === ENDED) {
this.isReconnecting = false;
logger.info({ logCode: 'audio_ended' }, 'Audio ended without issue');
this.onAudioExit();
} else if (status === FAILED) {
this.isReconnecting = false;
const errorKey = this.messages.error[error] || this.messages.error.GENERIC_ERROR;
const errorMsg = this.intl.formatMessage(errorKey, { 0: bridgeError });
this.error = !!error;
@ -415,10 +419,12 @@ class AudioManager {
this.onAudioExit();
}
} else if (status === RECONNECTING) {
this.isReconnecting = true;
logger.info({ logCode: 'audio_reconnecting' }, 'Attempting to reconnect audio');
this.notify(this.intl.formatMessage(this.messages.info.RECONNECTING_AUDIO), true);
this.playHangUpSound();
} else if (status === AUTOPLAY_BLOCKED) {
this.isReconnecting = false;
this.autoplayBlocked = true;
this.onAudioJoin();
resolve(AUTOPLAY_BLOCKED);