Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(local-rec) Download recording on meeting end (#13557)

Robert Pintiliia03bf2cb8e4d
diff --git a/lang/main.json b/lang/main.json
index 379ee366eb..6cdfcd5a08 100644
--- a/lang/main.json
+++ b/lang/main.json
@@ -674,6 +674,8 @@
"sessionToken": "Session Token",
"start": "Start Recording",
"stop": "Stop Recording",
+ "stopping": "Stopping Recording",
+ "wait": "Please wait while we save your recording",
"yes": "Yes"
},
"lockRoomPassword": "password",
diff --git a/react/features/base/conference/middleware.any.ts b/react/features/base/conference/middleware.any.ts
index e200948439..a70f43017f 100644
--- a/react/features/base/conference/middleware.any.ts
+++ b/react/features/base/conference/middleware.any.ts
@@ -16,6 +16,8 @@ import { openDisplayNamePrompt } from '../../display-name/actions';
import { readyToClose } from '../../mobile/external-api/actions';
import { showErrorNotification, showWarningNotification } from '../../notifications/actions';
import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
+import { stopLocalVideoRecording } from '../../recording/actions.any';
+import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager';
import { setIAmVisitor } from '../../visitors/actions';
import { iAmVisitor } from '../../visitors/functions';
import { overwriteConfig } from '../config/actions';
@@ -71,7 +73,7 @@ import logger from './logger';
/**
* Handler for before unload event.
*/
-let beforeUnloadHandler: (() => void) | undefined;
+let beforeUnloadHandler: ((e?: any) => void) | undefined;
/**
* Implements the middleware of the feature base/conference.
@@ -295,7 +297,14 @@ function _conferenceJoined({ dispatch, getState }: IStore, next: Function, actio
// handles the process of leaving the conference. This is temporary solution
// that should cover the described use case as part of the effort to
// implement the conferenceWillLeave action for web.
- beforeUnloadHandler = () => {
+ beforeUnloadHandler = (e?: any) => {
+ if (LocalRecordingManager.isRecordingLocally()) {
+ dispatch(stopLocalVideoRecording());
+ if (e) {
+ e.preventDefault();
+ e.returnValue = null;
+ }
+ }
dispatch(conferenceWillLeave(conference));
};
diff --git a/react/features/base/connection/actions.web.ts b/react/features/base/connection/actions.web.ts
index a84ad1b967..b4f1a84d9d 100644
--- a/react/features/base/connection/actions.web.ts
+++ b/react/features/base/connection/actions.web.ts
@@ -1,4 +1,8 @@
import { IStore } from '../../app/types';
+import { showWarningNotification } from '../../notifications/actions';
+import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
+import { stopLocalVideoRecording } from '../../recording/actions.any';
+import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager.web';
import { configureInitialDevices } from '../devices/actions';
import { getBackendSafeRoomName } from '../util/uri';
@@ -43,5 +47,20 @@ export function connect() {
export function disconnect(requestFeedback = false) {
// XXX For web based version we use conference hanging up logic from the old
// app.
- return () => APP.conference.hangup(requestFeedback);
+ return async (dispatch: IStore['dispatch']) => {
+ if (LocalRecordingManager.isRecordingLocally()) {
+ dispatch(stopLocalVideoRecording());
+ dispatch(showWarningNotification({
+ titleKey: 'localRecording.stopping',
+ descriptionKey: 'localRecording.wait'
+ }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
+
+ // wait 1000ms for the recording to end and start downloading
+ await new Promise(res => {
+ setTimeout(res, 1000);
+ });
+ }
+
+ return APP.conference.hangup(requestFeedback);
+ };
}