浏览代码

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

factor2
Robert Pintilii 2 年前
父节点
当前提交
a03bf2cb8e
没有帐户链接到提交者的电子邮件
共有 3 个文件被更改,包括 33 次插入3 次删除
  1. 2
    0
      lang/main.json
  2. 11
    2
      react/features/base/conference/middleware.any.ts
  3. 20
    1
      react/features/base/connection/actions.web.ts

+ 2
- 0
lang/main.json 查看文件

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

+ 11
- 2
react/features/base/conference/middleware.any.ts 查看文件

@@ -16,6 +16,8 @@ import { openDisplayNamePrompt } from '../../display-name/actions';
16 16
 import { readyToClose } from '../../mobile/external-api/actions';
17 17
 import { showErrorNotification, showWarningNotification } from '../../notifications/actions';
18 18
 import { NOTIFICATION_TIMEOUT_TYPE } from '../../notifications/constants';
19
+import { stopLocalVideoRecording } from '../../recording/actions.any';
20
+import LocalRecordingManager from '../../recording/components/Recording/LocalRecordingManager';
19 21
 import { setIAmVisitor } from '../../visitors/actions';
20 22
 import { iAmVisitor } from '../../visitors/functions';
21 23
 import { overwriteConfig } from '../config/actions';
@@ -71,7 +73,7 @@ import logger from './logger';
71 73
 /**
72 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 79
  * Implements the middleware of the feature base/conference.
@@ -295,7 +297,14 @@ function _conferenceJoined({ dispatch, getState }: IStore, next: Function, actio
295 297
     // handles the process of leaving the conference. This is temporary solution
296 298
     // that should cover the described use case as part of the effort to
297 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 308
         dispatch(conferenceWillLeave(conference));
300 309
     };
301 310
 

+ 20
- 1
react/features/base/connection/actions.web.ts 查看文件

@@ -1,4 +1,8 @@
1 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 6
 import { configureInitialDevices } from '../devices/actions';
3 7
 import { getBackendSafeRoomName } from '../util/uri';
4 8
 
@@ -43,5 +47,20 @@ export function connect() {
43 47
 export function disconnect(requestFeedback = false) {
44 48
     // XXX For web based version we use conference hanging up logic from the old
45 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
 }

正在加载...
取消
保存