소스 검색

Handle recording errors

j8
yanas 9 년 전
부모
커밋
69798848c0
4개의 변경된 파일42개의 추가작업 그리고 19개의 파일을 삭제
  1. 3
    2
      conference.js
  2. 4
    2
      lang/main.json
  3. 2
    2
      modules/UI/UI.js
  4. 33
    13
      modules/UI/recording/Recording.js

+ 3
- 2
conference.js 파일 보기

@@ -21,6 +21,8 @@ const ConferenceErrors = JitsiMeetJS.errors.conference;
21 21
 const TrackEvents = JitsiMeetJS.events.track;
22 22
 const TrackErrors = JitsiMeetJS.errors.track;
23 23
 
24
+const RecorderErrors = JitsiMeetJS.errors.recorder;
25
+
24 26
 let room, connection, localAudio, localVideo, roomLocker;
25 27
 let currentAudioInputDevices, currentVideoInputDevices;
26 28
 
@@ -356,7 +358,6 @@ export default {
356 358
         if(JitsiMeetJS.getGlobalOnErrorHandler){
357 359
             var oldOnErrorHandler = window.onerror;
358 360
             window.onerror = function (message, source, lineno, colno, error) {
359
-
360 361
                 JitsiMeetJS.getGlobalOnErrorHandler(
361 362
                     message, source, lineno, colno, error);
362 363
 
@@ -1152,7 +1153,7 @@ export default {
1152 1153
 
1153 1154
         room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1154 1155
             console.log("Received recorder status change: ", status, error);
1155
-            APP.UI.updateRecordingState(status);
1156
+            APP.UI.updateRecordingState(status, error);
1156 1157
         });
1157 1158
 
1158 1159
         room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {

+ 4
- 2
lang/main.json 파일 보기

@@ -275,7 +275,8 @@
275 275
         "off": "Recording stopped",
276 276
         "failedToStart": "Recording failed to start",
277 277
         "buttonTooltip": "Start / stop recording",
278
-        "error": "Recording failed. Please try again."
278
+        "error": "Recording failed. Please try again.",
279
+        "unavailable": "The recording service is currently unavailable. Please try again later."
279 280
     },
280 281
     "liveStreaming":
281 282
     {
@@ -286,6 +287,7 @@
286 287
         "failedToStart": "Live streaming failed to start",
287 288
         "buttonTooltip": "Start / stop live stream",
288 289
         "streamIdRequired": "Please fill in the stream id in order to launch the live streaming.",
289
-        "error": "Live streaming failed. Please try again"
290
+        "error": "Live streaming failed. Please try again.",
291
+        "busy": "All recorders are currently busy. Please try again later."
290 292
     }
291 293
 }

+ 2
- 2
modules/UI/UI.js 파일 보기

@@ -1006,8 +1006,8 @@ UI.requestFeedback = function () {
1006 1006
     });
1007 1007
 };
1008 1008
 
1009
-UI.updateRecordingState = function (state) {
1010
-    Recording.updateRecordingState(state);
1009
+UI.updateRecordingState = function (state, error) {
1010
+    Recording.updateRecordingState(state, error);
1011 1011
 };
1012 1012
 
1013 1013
 UI.notifyTokenAuthFailed = function () {

+ 33
- 13
modules/UI/recording/Recording.js 파일 보기

@@ -206,7 +206,9 @@ var Status = {
206 206
     AVAILABLE: "available",
207 207
     UNAVAILABLE: "unavailable",
208 208
     PENDING: "pending",
209
-    ERROR: "error"
209
+    ERROR: "error",
210
+    FAILED: "failed",
211
+    BUSY: "busy"
210 212
 };
211 213
 
212 214
 /**
@@ -245,21 +247,27 @@ var Recording = {
245 247
 
246 248
         if (recordingType === 'jibri') {
247 249
             this.baseClass = "fa fa-play-circle";
250
+            this.recordingTitle = "dialog.liveStreaming";
248 251
             this.recordingOnKey = "liveStreaming.on";
249 252
             this.recordingOffKey = "liveStreaming.off";
250 253
             this.recordingPendingKey = "liveStreaming.pending";
251 254
             this.failedToStartKey = "liveStreaming.failedToStart";
252 255
             this.recordingErrorKey = "liveStreaming.error";
253 256
             this.recordingButtonTooltip = "liveStreaming.buttonTooltip";
257
+            this.recordingUnavailable = "liveStreaming.unavailable";
258
+            this.recordingBusy = "liveStreaming.busy";
254 259
         }
255 260
         else {
256 261
             this.baseClass = "icon-recEnable";
262
+            this.recordingTitle = "dialog.recording";
257 263
             this.recordingOnKey = "recording.on";
258 264
             this.recordingOffKey = "recording.off";
259 265
             this.recordingPendingKey = "recording.pending";
260 266
             this.failedToStartKey = "recording.failedToStart";
261 267
             this.recordingErrorKey = "recording.error";
262 268
             this.recordingButtonTooltip = "recording.buttonTooltip";
269
+            this.recordingUnavailable = "recording.unavailable";
270
+            this.recordingBusy = "liveStreaming.busy";
263 271
         }
264 272
 
265 273
         selector.addClass(this.baseClass);
@@ -307,10 +315,17 @@ var Recording = {
307 315
                     }
308 316
                     break;
309 317
                 }
318
+                case Status.BUSY: {
319
+                    APP.UI.messageHandler.openMessageDialog(
320
+                        self.recordingTitle,
321
+                        self.recordingBusy
322
+                    );
323
+                    break;
324
+                }
310 325
                 default: {
311 326
                     APP.UI.messageHandler.openMessageDialog(
312
-                        "dialog.liveStreaming",
313
-                        "liveStreaming.unavailable"
327
+                        self.recordingTitle,
328
+                        self.recordingUnavailable
314 329
                     );
315 330
                 }
316 331
             }
@@ -333,7 +348,7 @@ var Recording = {
333 348
      * Updates the recording state UI.
334 349
      * @param recordingState gives us the current recording state
335 350
      */
336
-    updateRecordingState(recordingState) {
351
+    updateRecordingState(recordingState, error) {
337 352
         // I'm the recorder, so I don't want to see any UI related to states.
338 353
         if (config.iAmRecorder)
339 354
             return;
@@ -342,16 +357,19 @@ var Recording = {
342 357
         if (!recordingState || this.currentState === recordingState)
343 358
             return;
344 359
 
345
-        this.updateRecordingUI(recordingState);
360
+        this.updateRecordingUI(recordingState, error);
346 361
     },
347 362
 
348 363
     /**
349 364
      * Sets the state of the recording button.
350 365
      * @param recordingState gives us the current recording state
351 366
      */
352
-    updateRecordingUI (recordingState) {
367
+    updateRecordingUI (recordingState, error) {
353 368
         let buttonSelector = $('#toolbar_button_record');
354 369
 
370
+        let oldState = this.currentState;
371
+        this.currentState = recordingState;
372
+
355 373
         // TODO: handle recording state=available
356 374
         if (recordingState === Status.ON) {
357 375
 
@@ -361,19 +379,21 @@ var Recording = {
361 379
             this._updateStatusLabel(this.recordingOnKey, false);
362 380
         }
363 381
         else if (recordingState === Status.OFF
364
-                || recordingState === Status.UNAVAILABLE) {
382
+                || recordingState === Status.UNAVAILABLE
383
+                || recordingState === Status.BUSY
384
+                || recordingState === Status.FAILED) {
365 385
 
366 386
             // We don't want to do any changes if this is
367 387
             // an availability change.
368
-            if (this.currentState !== Status.ON
369
-                && this.currentState !== Status.PENDING)
388
+            if (oldState !== Status.ON
389
+                && oldState !== Status.PENDING)
370 390
                 return;
371 391
 
372 392
             buttonSelector.removeClass(this.baseClass + " active");
373 393
             buttonSelector.addClass(this.baseClass);
374 394
 
375 395
             let messageKey;
376
-            if (this.currentState === Status.PENDING)
396
+            if (oldState === Status.PENDING)
377 397
                 messageKey = this.failedToStartKey;
378 398
             else
379 399
                 messageKey = this.recordingOffKey;
@@ -391,15 +411,15 @@ var Recording = {
391 411
 
392 412
             this._updateStatusLabel(this.recordingPendingKey, true);
393 413
         }
394
-        else if (recordingState === Status.ERROR) {
414
+        else if (recordingState === Status.ERROR
415
+                    || recordingState === Status.FAILED) {
395 416
             buttonSelector.removeClass(this.baseClass + " active");
396 417
             buttonSelector.addClass(this.baseClass);
397 418
 
398 419
             this._updateStatusLabel(this.recordingErrorKey, true);
420
+            console.log("Recording failed for the following reason: ", error);
399 421
         }
400 422
 
401
-        this.currentState = recordingState;
402
-
403 423
         let labelSelector = $('#recordingLabel');
404 424
 
405 425
         // We don't show the label for available state.

Loading…
취소
저장