feat(conference) send leave reasons on switching room and when errors occur
This commit is contained in:
parent
85d2123fac
commit
fc60ab8383
|
@ -52,7 +52,8 @@ import {
|
||||||
onStartMutedPolicyChanged,
|
onStartMutedPolicyChanged,
|
||||||
p2pStatusChanged,
|
p2pStatusChanged,
|
||||||
sendLocalParticipant,
|
sendLocalParticipant,
|
||||||
nonParticipantMessageReceived
|
nonParticipantMessageReceived,
|
||||||
|
CONFERENCE_LEAVE_REASONS
|
||||||
} from './react/features/base/conference';
|
} from './react/features/base/conference';
|
||||||
import {
|
import {
|
||||||
getReplaceParticipant,
|
getReplaceParticipant,
|
||||||
|
@ -381,7 +382,7 @@ class ConferenceConnector {
|
||||||
// FIXME the conference should be stopped by the library and not by
|
// FIXME the conference should be stopped by the library and not by
|
||||||
// the app. Both the errors above are unrecoverable from the library
|
// the app. Both the errors above are unrecoverable from the library
|
||||||
// perspective.
|
// perspective.
|
||||||
room.leave().then(() => connection.disconnect());
|
room.leave(CONFERENCE_LEAVE_REASONS.UNRECOVERABLE_ERROR).then(() => connection.disconnect());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JitsiConferenceErrors.CONFERENCE_MAX_USERS:
|
case JitsiConferenceErrors.CONFERENCE_MAX_USERS:
|
||||||
|
@ -464,7 +465,7 @@ function _connectionFailedHandler(error) {
|
||||||
_connectionFailedHandler);
|
_connectionFailedHandler);
|
||||||
if (room) {
|
if (room) {
|
||||||
APP.store.dispatch(conferenceWillLeave(room));
|
APP.store.dispatch(conferenceWillLeave(room));
|
||||||
room.leave();
|
room.leave(CONFERENCE_LEAVE_REASONS.UNRECOVERABLE_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3059,13 +3060,14 @@ export default {
|
||||||
* Leaves the room.
|
* Leaves the room.
|
||||||
*
|
*
|
||||||
* @param {boolean} doDisconnect - Whether leaving the room should also terminate the connection.
|
* @param {boolean} doDisconnect - Whether leaving the room should also terminate the connection.
|
||||||
|
* @param {string} reason - reason for leaving the room.
|
||||||
* @returns {Promise}
|
* @returns {Promise}
|
||||||
*/
|
*/
|
||||||
async leaveRoom(doDisconnect = true) {
|
async leaveRoom(doDisconnect = true, reason = '') {
|
||||||
APP.store.dispatch(conferenceWillLeave(room));
|
APP.store.dispatch(conferenceWillLeave(room));
|
||||||
|
|
||||||
if (room && room.isJoined()) {
|
if (room && room.isJoined()) {
|
||||||
return room.leave().finally(() => {
|
return room.leave(reason).finally(() => {
|
||||||
if (doDisconnect) {
|
if (doDisconnect) {
|
||||||
return disconnect();
|
return disconnect();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,3 +31,11 @@ export const JITSI_CONFERENCE_URL_KEY = Symbol('url');
|
||||||
export const TRIGGER_READY_TO_CLOSE_REASONS = [
|
export const TRIGGER_READY_TO_CLOSE_REASONS = [
|
||||||
'The meeting has been terminated'
|
'The meeting has been terminated'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Conference leave reasons.
|
||||||
|
*/
|
||||||
|
export const CONFERENCE_LEAVE_REASONS = {
|
||||||
|
SWITCH_ROOM: 'switch_room',
|
||||||
|
UNRECOVERABLE_ERROR: 'unrecoverable_error'
|
||||||
|
};
|
||||||
|
|
|
@ -46,7 +46,7 @@ import {
|
||||||
setLocalSubject,
|
setLocalSubject,
|
||||||
setSubject
|
setSubject
|
||||||
} from './actions';
|
} from './actions';
|
||||||
import { TRIGGER_READY_TO_CLOSE_REASONS } from './constants';
|
import { CONFERENCE_LEAVE_REASONS, TRIGGER_READY_TO_CLOSE_REASONS } from './constants';
|
||||||
import {
|
import {
|
||||||
_addLocalTracksToConference,
|
_addLocalTracksToConference,
|
||||||
_removeLocalTracksFromConference,
|
_removeLocalTracksFromConference,
|
||||||
|
@ -177,7 +177,7 @@ function _conferenceFailed({ dispatch, getState }, next, action) {
|
||||||
if (typeof APP === 'undefined') {
|
if (typeof APP === 'undefined') {
|
||||||
!error.recoverable
|
!error.recoverable
|
||||||
&& conference
|
&& conference
|
||||||
&& conference.leave().catch(reason => {
|
&& conference.leave(CONFERENCE_LEAVE_REASONS.UNRECOVERABLE_ERROR).catch(reason => {
|
||||||
// Even though we don't care too much about the failure, it may be
|
// Even though we don't care too much about the failure, it may be
|
||||||
// good to know that it happen, so log it (on the info level).
|
// good to know that it happen, so log it (on the info level).
|
||||||
logger.info('JitsiConference.leave() rejected with:', reason);
|
logger.info('JitsiConference.leave() rejected with:', reason);
|
||||||
|
|
|
@ -6,6 +6,7 @@ import type { Dispatch } from 'redux';
|
||||||
|
|
||||||
import { createBreakoutRoomsEvent, sendAnalytics } from '../analytics';
|
import { createBreakoutRoomsEvent, sendAnalytics } from '../analytics';
|
||||||
import {
|
import {
|
||||||
|
CONFERENCE_LEAVE_REASONS,
|
||||||
conferenceLeft,
|
conferenceLeft,
|
||||||
conferenceWillLeave,
|
conferenceWillLeave,
|
||||||
createConference,
|
createConference,
|
||||||
|
@ -225,7 +226,7 @@ export function moveToRoom(roomId?: string) {
|
||||||
dispatch(conferenceWillLeave(conference));
|
dispatch(conferenceWillLeave(conference));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await conference.leave();
|
await conference.leave(CONFERENCE_LEAVE_REASONS.SWITCH_ROOM);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('JitsiConference.leave() rejected with:', error);
|
logger.warn('JitsiConference.leave() rejected with:', error);
|
||||||
|
|
||||||
|
@ -246,7 +247,7 @@ export function moveToRoom(roomId?: string) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// all places we fire notifyConferenceLeft we pass the room name from APP.conference
|
// all places we fire notifyConferenceLeft we pass the room name from APP.conference
|
||||||
await APP.conference.leaveRoom(false /* doDisconnect */).then(
|
await APP.conference.leaveRoom(false /* doDisconnect */, CONFERENCE_LEAVE_REASONS.SWITCH_ROOM).then(
|
||||||
() => APP.API.notifyConferenceLeft(APP.conference.roomName));
|
() => APP.API.notifyConferenceLeft(APP.conference.roomName));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
logger.warn('APP.conference.leaveRoom() rejected with:', error);
|
logger.warn('APP.conference.leaveRoom() rejected with:', error);
|
||||||
|
|
Loading…
Reference in New Issue