소스 검색

feat(iFrame): Emit event when recording status changes, including errors (#7973)

* feat(iFrame): Emit event when recording status changes, including errors

* Fix APP access on mobile
j8
Izak Glasenčnik 4 년 전
부모
커밋
05f3b4390d
No account linked to committer's email address
3개의 변경된 파일35개의 추가작업 그리고 4개의 파일을 삭제
  1. 17
    0
      modules/API/API.js
  2. 1
    0
      modules/API/external/external_api.js
  3. 17
    4
      react/features/recording/middleware.js

+ 17
- 0
modules/API/API.js 파일 보기

1150
         });
1150
         });
1151
     }
1151
     }
1152
 
1152
 
1153
+    /**
1154
+     * Notify external application (if API is enabled) that recording has started or stopped.
1155
+     *
1156
+     * @param {boolean} on - True if recording is on, false otherwise.
1157
+     * @param {string} mode - Stream or file.
1158
+     * @param {string} error - Error type or null if success.
1159
+     * @returns {void}
1160
+     */
1161
+    notifyRecordingStatusChanged(on: boolean, mode: string, error?: string) {
1162
+        this._sendEvent({
1163
+            name: 'recording-status-changed',
1164
+            on,
1165
+            mode,
1166
+            error
1167
+        });
1168
+    }
1169
+
1153
     /**
1170
     /**
1154
      * Disposes the allocated resources.
1171
      * Disposes the allocated resources.
1155
      *
1172
      *

+ 1
- 0
modules/API/external/external_api.js 파일 보기

88
     'password-required': 'passwordRequired',
88
     'password-required': 'passwordRequired',
89
     'proxy-connection-event': 'proxyConnectionEvent',
89
     'proxy-connection-event': 'proxyConnectionEvent',
90
     'raise-hand-updated': 'raiseHandUpdated',
90
     'raise-hand-updated': 'raiseHandUpdated',
91
+    'recording-status-changed': 'recordingStatusChanged',
91
     'video-ready-to-close': 'readyToClose',
92
     'video-ready-to-close': 'readyToClose',
92
     'video-conference-joined': 'videoConferenceJoined',
93
     'video-conference-joined': 'videoConferenceJoined',
93
     'video-conference-left': 'videoConferenceLeft',
94
     'video-conference-left': 'videoConferenceLeft',

+ 17
- 4
react/features/recording/middleware.js 파일 보기

45
     RECORDING_ON_SOUND_FILE
45
     RECORDING_ON_SOUND_FILE
46
 } from './sounds';
46
 } from './sounds';
47
 
47
 
48
+declare var APP: Object;
48
 declare var interfaceConfig: Object;
49
 declare var interfaceConfig: Object;
49
 
50
 
50
 /**
51
 /**
181
                 if (soundID) {
182
                 if (soundID) {
182
                     dispatch(playSound(soundID));
183
                     dispatch(playSound(soundID));
183
                 }
184
                 }
185
+
186
+                if (typeof APP !== 'undefined') {
187
+                    APP.API.notifyRecordingStatusChanged(true, mode);
188
+                }
184
             } else if (updatedSessionData.status === OFF
189
             } else if (updatedSessionData.status === OFF
185
                 && (!oldSessionData || oldSessionData.status !== OFF)) {
190
                 && (!oldSessionData || oldSessionData.status !== OFF)) {
186
                 dispatch(showStoppedRecordingNotification(
191
                 dispatch(showStoppedRecordingNotification(
209
                     dispatch(stopSound(soundOn));
214
                     dispatch(stopSound(soundOn));
210
                     dispatch(playSound(soundOff));
215
                     dispatch(playSound(soundOff));
211
                 }
216
                 }
217
+
218
+                if (typeof APP !== 'undefined') {
219
+                    APP.API.notifyRecordingStatusChanged(false, mode);
220
+                }
212
             }
221
             }
213
         }
222
         }
214
 
223
 
231
  * @returns {void}
240
  * @returns {void}
232
  */
241
  */
233
 function _showRecordingErrorNotification(recorderSession, dispatch) {
242
 function _showRecordingErrorNotification(recorderSession, dispatch) {
234
-    const isStreamMode
235
-        = recorderSession.getMode()
236
-            === JitsiMeetJS.constants.recording.mode.STREAM;
243
+    const mode = recorderSession.getMode();
244
+    const error = recorderSession.getError();
245
+    const isStreamMode = mode === JitsiMeetJS.constants.recording.mode.STREAM;
237
 
246
 
238
-    switch (recorderSession.getError()) {
247
+    switch (error) {
239
     case JitsiMeetJS.constants.recording.error.SERVICE_UNAVAILABLE:
248
     case JitsiMeetJS.constants.recording.error.SERVICE_UNAVAILABLE:
240
         dispatch(showRecordingError({
249
         dispatch(showRecordingError({
241
             descriptionKey: 'recording.unavailable',
250
             descriptionKey: 'recording.unavailable',
270
         }));
279
         }));
271
         break;
280
         break;
272
     }
281
     }
282
+
283
+    if (typeof APP !== 'undefined') {
284
+        APP.API.notifyRecordingStatusChanged(false, mode, error);
285
+    }
273
 }
286
 }

Loading…
취소
저장