Browse Source

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

factor2
Robert Pintilii 2 years ago
parent
commit
a03bf2cb8e
No account linked to committer's email address

+ 2
- 0
lang/main.json View File

674
         "sessionToken": "Session Token",
674
         "sessionToken": "Session Token",
675
         "start": "Start Recording",
675
         "start": "Start Recording",
676
         "stop": "Stop Recording",
676
         "stop": "Stop Recording",
677
+        "stopping": "Stopping Recording",
678
+        "wait": "Please wait while we save your recording",
677
         "yes": "Yes"
679
         "yes": "Yes"
678
     },
680
     },
679
     "lockRoomPassword": "password",
681
     "lockRoomPassword": "password",

+ 11
- 2
react/features/base/conference/middleware.any.ts View File

16
 import { readyToClose } from '../../mobile/external-api/actions';
16
 import { readyToClose } from '../../mobile/external-api/actions';
17
 import { showErrorNotification, showWarningNotification } from '../../notifications/actions';
17
 import { showErrorNotification, showWarningNotification } from '../../notifications/actions';
18
 import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
18
 import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
19
+import { stopLocalVideoRecording } from '../../recording/actions.any';
20
+import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager';
19
 import { setIAmVisitor } from '../../visitors/actions';
21
 import { setIAmVisitor } from '../../visitors/actions';
20
 import { iAmVisitor } from '../../visitors/functions';
22
 import { iAmVisitor } from '../../visitors/functions';
21
 import { overwriteConfig } from '../config/actions';
23
 import { overwriteConfig } from '../config/actions';
71
 /**
73
 /**
72
  * Handler for before unload event.
74
  * Handler for before unload event.
73
  */
75
  */
74
-let beforeUnloadHandler: (() => void) | undefined;
76
+let beforeUnloadHandler: ((e?: any) => void) | undefined;
75
 
77
 
76
 /**
78
 /**
77
  * Implements the middleware of the feature base/conference.
79
  * Implements the middleware of the feature base/conference.
295
     // handles the process of leaving the conference. This is temporary solution
297
     // handles the process of leaving the conference. This is temporary solution
296
     // that should cover the described use case as part of the effort to
298
     // that should cover the described use case as part of the effort to
297
     // implement the conferenceWillLeave action for web.
299
     // implement the conferenceWillLeave action for web.
298
-    beforeUnloadHandler = () => {
300
+    beforeUnloadHandler = (e?: any) => {
301
+        if (LocalRecordingManager.isRecordingLocally()) {
302
+            dispatch(stopLocalVideoRecording());
303
+            if (e) {
304
+                e.preventDefault();
305
+                e.returnValue = null;
306
+            }
307
+        }
299
         dispatch(conferenceWillLeave(conference));
308
         dispatch(conferenceWillLeave(conference));
300
     };
309
     };
301
 
310
 

+ 20
- 1
react/features/base/connection/actions.web.ts View File

1
 import { IStore } from '../../app/types';
1
 import { IStore } from '../../app/types';
2
+import { showWarningNotification } from '../../notifications/actions';
3
+import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
4
+import { stopLocalVideoRecording } from '../../recording/actions.any';
5
+import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager.web';
2
 import { configureInitialDevices } from '../devices/actions';
6
 import { configureInitialDevices } from '../devices/actions';
3
 import { getBackendSafeRoomName } from '../util/uri';
7
 import { getBackendSafeRoomName } from '../util/uri';
4
 
8
 
43
 export function disconnect(requestFeedback = false) {
47
 export function disconnect(requestFeedback = false) {
44
     // XXX For web based version we use conference hanging up logic from the old
48
     // XXX For web based version we use conference hanging up logic from the old
45
     // app.
49
     // app.
46
-    return () => APP.conference.hangup(requestFeedback);
50
+    return async (dispatch: IStore['dispatch']) => {
51
+        if (LocalRecordingManager.isRecordingLocally()) {
52
+            dispatch(stopLocalVideoRecording());
53
+            dispatch(showWarningNotification({
54
+                titleKey: 'localRecording.stopping',
55
+                descriptionKey: 'localRecording.wait'
56
+            }, NOTIFICATION_TIMEOUT_TYPE.STICKY));
57
+
58
+            // wait 1000ms for the recording to end and start downloading
59
+            await new Promise(res => {
60
+                setTimeout(res, 1000);
61
+            });
62
+        }
63
+
64
+        return APP.conference.hangup(requestFeedback);
65
+    };
47
 }
66
 }

Loading…
Cancel
Save