Quellcode durchsuchen

Handle recording errors

j8
yanas vor 9 Jahren
Ursprung
Commit
69798848c0
4 geänderte Dateien mit 42 neuen und 19 gelöschten Zeilen
  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 Datei anzeigen

21
 const TrackEvents = JitsiMeetJS.events.track;
21
 const TrackEvents = JitsiMeetJS.events.track;
22
 const TrackErrors = JitsiMeetJS.errors.track;
22
 const TrackErrors = JitsiMeetJS.errors.track;
23
 
23
 
24
+const RecorderErrors = JitsiMeetJS.errors.recorder;
25
+
24
 let room, connection, localAudio, localVideo, roomLocker;
26
 let room, connection, localAudio, localVideo, roomLocker;
25
 let currentAudioInputDevices, currentVideoInputDevices;
27
 let currentAudioInputDevices, currentVideoInputDevices;
26
 
28
 
356
         if(JitsiMeetJS.getGlobalOnErrorHandler){
358
         if(JitsiMeetJS.getGlobalOnErrorHandler){
357
             var oldOnErrorHandler = window.onerror;
359
             var oldOnErrorHandler = window.onerror;
358
             window.onerror = function (message, source, lineno, colno, error) {
360
             window.onerror = function (message, source, lineno, colno, error) {
359
-
360
                 JitsiMeetJS.getGlobalOnErrorHandler(
361
                 JitsiMeetJS.getGlobalOnErrorHandler(
361
                     message, source, lineno, colno, error);
362
                     message, source, lineno, colno, error);
362
 
363
 
1152
 
1153
 
1153
         room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1154
         room.on(ConferenceEvents.RECORDER_STATE_CHANGED, (status, error) => {
1154
             console.log("Received recorder status change: ", status, error);
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
         room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {
1159
         room.on(ConferenceEvents.USER_STATUS_CHANGED, function (id, status) {

+ 4
- 2
lang/main.json Datei anzeigen

275
         "off": "Recording stopped",
275
         "off": "Recording stopped",
276
         "failedToStart": "Recording failed to start",
276
         "failedToStart": "Recording failed to start",
277
         "buttonTooltip": "Start / stop recording",
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
     "liveStreaming":
281
     "liveStreaming":
281
     {
282
     {
286
         "failedToStart": "Live streaming failed to start",
287
         "failedToStart": "Live streaming failed to start",
287
         "buttonTooltip": "Start / stop live stream",
288
         "buttonTooltip": "Start / stop live stream",
288
         "streamIdRequired": "Please fill in the stream id in order to launch the live streaming.",
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 Datei anzeigen

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
 UI.notifyTokenAuthFailed = function () {
1013
 UI.notifyTokenAuthFailed = function () {

+ 33
- 13
modules/UI/recording/Recording.js Datei anzeigen

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

Laden…
Abbrechen
Speichern