瀏覽代碼

Fix off recording state handling

dev1
yanas 9 年之前
父節點
當前提交
d4be648c45
共有 1 個檔案被更改,包括 15 行新增7 行删除
  1. 15
    7
      modules/xmpp/recording.js

+ 15
- 7
modules/xmpp/recording.js 查看文件

@@ -40,11 +40,14 @@ Recording.status = {
40 40
     OFF: "off",
41 41
     AVAILABLE: "available",
42 42
     UNAVAILABLE: "unavailable",
43
-    START: "start",
44
-    STOP: "stop",
45 43
     PENDING: "pending"
46 44
 };
47 45
 
46
+Recording.action = {
47
+    START: "start",
48
+    STOP: "stop"
49
+};
50
+
48 51
 Recording.prototype.handleJibriPresence = function (jibri) {
49 52
     var attributes = jibri.attributes;
50 53
     if(!attributes)
@@ -60,7 +63,12 @@ Recording.prototype.handleJibriPresence = function (jibri) {
60 63
         this.state = Recording.status.UNAVAILABLE;
61 64
     }
62 65
     else if (newState === "off") {
63
-        this.state = Recording.status.AVAILABLE;
66
+        if (!this.state
67
+            || this.state === "undefined"
68
+            || this.state === Recording.status.UNAVAILABLE)
69
+            this.state = Recording.status.AVAILABLE;
70
+        else
71
+            this.state = Recording.status.OFF;
64 72
     }
65 73
     else {
66 74
         this.state = newState;
@@ -81,8 +89,8 @@ Recording.prototype.setRecordingJibri = function (state, callback, errCallback,
81 89
         .c('jibri', {
82 90
         "xmlns": 'http://jitsi.org/protocol/jibri',
83 91
         "action": (state === Recording.status.ON)
84
-                    ? Recording.status.START
85
-                    : Recording.status.STOP,
92
+                    ? Recording.action.START
93
+                    : Recording.action.STOP,
86 94
         "streamid": options.streamId,
87 95
         }).up();
88 96
 
@@ -111,8 +119,8 @@ Recording.prototype.setRecordingJirecon =
111 119
     var iq = $iq({to: this.jirecon, type: 'set'})
112 120
         .c('recording', {xmlns: 'http://jitsi.org/protocol/jirecon',
113 121
             action: (state === Recording.status.ON)
114
-                ? Recording.status.START
115
-                : Recording.status.STOP,
122
+                ? Recording.action.START
123
+                : Recording.action.STOP,
116 124
             mucjid: this.roomjid});
117 125
     if (state === 'off'){
118 126
         iq.attrs({rid: this.jireconRid});

Loading…
取消
儲存