|
|
@@ -16,11 +16,10 @@ function Recording(type, eventEmitter, connection, focusMucJid, jirecon,
|
|
16
|
16
|
this.type = type;
|
|
17
|
17
|
this._isSupported
|
|
18
|
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
|
21
|
? false : true;
|
|
21
|
22
|
|
|
22
|
|
- this._isServiceAvailable = false;
|
|
23
|
|
-
|
|
24
|
23
|
/**
|
|
25
|
24
|
* The ID of the jirecon recording session. Jirecon generates it when we
|
|
26
|
25
|
* initially start recording, and it needs to be used in subsequent requests
|
|
|
@@ -52,25 +51,20 @@ Recording.prototype.handleJibriPresence = function (jibri) {
|
|
52
|
51
|
return;
|
|
53
|
52
|
|
|
54
|
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
|
+ logger.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
|
69
|
this.eventEmitter.emit(XMPPEvents.RECORDER_STATE_CHANGED, this.state);
|
|
76
|
70
|
};
|
|
|
@@ -132,7 +126,7 @@ Recording.prototype.setRecordingJirecon =
|
|
132
|
126
|
// TODO wait for an IQ with the real status, since this is
|
|
133
|
127
|
// provisional?
|
|
134
|
128
|
self.jireconRid = $(result).find('recording').attr('rid');
|
|
135
|
|
- console.log('Recording ' +
|
|
|
129
|
+ logger.log('Recording ' +
|
|
136
|
130
|
((state === Recording.status.ON) ? 'started' : 'stopped') +
|
|
137
|
131
|
'(jirecon)' + result);
|
|
138
|
132
|
self.state = state;
|
|
|
@@ -143,7 +137,7 @@ Recording.prototype.setRecordingJirecon =
|
|
143
|
137
|
callback(state);
|
|
144
|
138
|
},
|
|
145
|
139
|
function (error) {
|
|
146
|
|
- console.log('Failed to start recording, error: ', error);
|
|
|
140
|
+ logger.log('Failed to start recording, error: ', error);
|
|
147
|
141
|
errCallback(error);
|
|
148
|
142
|
});
|
|
149
|
143
|
};
|
|
|
@@ -162,7 +156,7 @@ function (state, callback, errCallback, options) {
|
|
162
|
156
|
var self = this;
|
|
163
|
157
|
this.connection.sendIQ(elem,
|
|
164
|
158
|
function (result) {
|
|
165
|
|
- console.log('Set recording "', state, '". Result:', result);
|
|
|
159
|
+ logger.log('Set recording "', state, '". Result:', result);
|
|
166
|
160
|
var recordingElem = $(result).find('>conference>recording');
|
|
167
|
161
|
var newState = recordingElem.attr('state');
|
|
168
|
162
|
|
|
|
@@ -180,7 +174,7 @@ function (state, callback, errCallback, options) {
|
|
180
|
174
|
}
|
|
181
|
175
|
},
|
|
182
|
176
|
function (error) {
|
|
183
|
|
- console.warn(error);
|
|
|
177
|
+ logger.warn(error);
|
|
184
|
178
|
errCallback(error);
|
|
185
|
179
|
}
|
|
186
|
180
|
);
|
|
|
@@ -199,7 +193,7 @@ function (state, callback, errCallback, options) {
|
|
199
|
193
|
this.setRecordingJibri(state, callback, errCallback, options);
|
|
200
|
194
|
break;
|
|
201
|
195
|
default:
|
|
202
|
|
- console.error("Unknown recording type!");
|
|
|
196
|
+ logger.error("Unknown recording type!");
|
|
203
|
197
|
return;
|
|
204
|
198
|
}
|
|
205
|
199
|
};
|