Kaynağa Gözat

Fix jibri presence initial state

master
yanas 9 yıl önce
ebeveyn
işleme
78c99a5a24
3 değiştirilmiş dosya ile 23 ekleme ve 36 silme
  1. 2
    6
      JitsiConference.js
  2. 4
    8
      modules/xmpp/ChatRoom.js
  3. 17
    22
      modules/xmpp/recording.js

+ 2
- 6
JitsiConference.js Dosyayı Görüntüle

710
  * and "off" if the recording is not started.
710
  * and "off" if the recording is not started.
711
  */
711
  */
712
 JitsiConference.prototype.getRecordingState = function () {
712
 JitsiConference.prototype.getRecordingState = function () {
713
-    if(this.room)
714
-        return this.room.getRecordingState();
715
-    return Recording.status.OFF;
713
+    return (this.room) ? this.room.getRecordingState() : undefined;
716
 }
714
 }
717
 
715
 
718
 /**
716
 /**
719
  * Returns the url of the recorded video.
717
  * Returns the url of the recorded video.
720
  */
718
  */
721
 JitsiConference.prototype.getRecordingURL = function () {
719
 JitsiConference.prototype.getRecordingURL = function () {
722
-    if(this.room)
723
-        return this.room.getRecordingURL();
724
-    return null;
720
+    return (this.room) ? this.room.getRecordingURL() : null;
725
 }
721
 }
726
 
722
 
727
 /**
723
 /**

+ 4
- 8
modules/xmpp/ChatRoom.js Dosyayı Görüntüle

740
  * and "off" if the recording is not started.
740
  * and "off" if the recording is not started.
741
  */
741
  */
742
 ChatRoom.prototype.getRecordingState = function () {
742
 ChatRoom.prototype.getRecordingState = function () {
743
-    if(this.recording)
744
-        return this.recording.getState();
745
-    return "off";
746
-};
743
+    return (this.recording) ? this.recording.getState() : undefined;
744
+}
747
 
745
 
748
 /**
746
 /**
749
  * Returns the url of the recorded video.
747
  * Returns the url of the recorded video.
750
  */
748
  */
751
 ChatRoom.prototype.getRecordingURL = function () {
749
 ChatRoom.prototype.getRecordingURL = function () {
752
-    if(this.recording)
753
-        return this.recording.getURL();
754
-    return null;
755
-};
750
+    return (this.recording) ? this.recording.getURL() : null;
751
+}
756
 
752
 
757
 /**
753
 /**
758
  * Starts/stops the recording
754
  * Starts/stops the recording

+ 17
- 22
modules/xmpp/recording.js Dosyayı Görüntüle

16
     this.type = type;
16
     this.type = type;
17
     this._isSupported
17
     this._isSupported
18
         = ( type === Recording.types.JIRECON && !this.jirecon
18
         = ( type === Recording.types.JIRECON && !this.jirecon
19
-            || type === Recording.types.JIBRI && !this._isServiceAvailable)
19
+            || (type !== Recording.types.JIBRI
20
+                && type !== Recording.types.COLIBRI))
20
             ? false : true;
21
             ? false : true;
21
 
22
 
22
-    this._isServiceAvailable = false;
23
-
24
     /**
23
     /**
25
      * The ID of the jirecon recording session. Jirecon generates it when we
24
      * The ID of the jirecon recording session. Jirecon generates it when we
26
      * initially start recording, and it needs to be used in subsequent requests
25
      * initially start recording, and it needs to be used in subsequent requests
52
         return;
51
         return;
53
 
52
 
54
     var newState = attributes.status;
53
     var newState = attributes.status;
55
-    console.log("handle jibri presence : ", newState);
56
-    var oldIsAvailable = this._isServiceAvailable;
57
-    // The service is available if the statu isn't undefined.
58
-    this._isServiceAvailable =
59
-        (newState && newState !== "undefined");
60
-
61
-    if (newState === "undefined"
62
-        || oldIsAvailable != this._isServiceAvailable
63
-        // If we receive an OFF state without any recording in progress we
64
-        // consider this to be an initial available state.
65
-        || (this.state === Recording.status.AVAILABLE
66
-            && newState === Recording.status.OFF))
67
-        this.state = (newState === "undefined")
68
-                        ? Recording.status.UNAVAILABLE
69
-                        : Recording.status.AVAILABLE;
70
-    else
71
-        this.state = attributes.status;
72
-
73
-    logger.log("Handle Jibri presence: ", this.state);
54
+    console.log("Handle jibri presence : ", newState);
55
+
56
+    if (newState === this.state)
57
+        return;
58
+
59
+    if (newState === "undefined") {
60
+        this.state = Recording.status.UNAVAILABLE;
61
+    }
62
+    else if (newState === "off") {
63
+        this.state = Recording.status.AVAILABLE;
64
+    }
65
+    else {
66
+        this.state = newState;
67
+    }
74
 
68
 
75
     this.eventEmitter.emit(XMPPEvents.RECORDER_STATE_CHANGED, this.state);
69
     this.eventEmitter.emit(XMPPEvents.RECORDER_STATE_CHANGED, this.state);
76
 };
70
 };
255
  * Returns true if the recording is supproted and false if not.
249
  * Returns true if the recording is supproted and false if not.
256
  */
250
  */
257
 Recording.prototype.isSupported = function () {
251
 Recording.prototype.isSupported = function () {
252
+    console.log("IS SUPPORTED", this._isSupported);
258
     return this._isSupported;
253
     return this._isSupported;
259
 };
254
 };
260
 
255
 

Loading…
İptal
Kaydet