|
@@ -40,7 +40,9 @@ Recording.status = {
|
40
|
40
|
OFF: "off",
|
41
|
41
|
AVAILABLE: "available",
|
42
|
42
|
UNAVAILABLE: "unavailable",
|
43
|
|
- PENDING: "pending"
|
|
43
|
+ PENDING: "pending",
|
|
44
|
+ BUSY: "busy",
|
|
45
|
+ FAILED: "failed"
|
44
|
46
|
};
|
45
|
47
|
|
46
|
48
|
Recording.action = {
|
|
@@ -77,10 +79,11 @@ Recording.prototype.handleJibriPresence = function (jibri) {
|
77
|
79
|
this.eventEmitter.emit(XMPPEvents.RECORDER_STATE_CHANGED, this.state);
|
78
|
80
|
};
|
79
|
81
|
|
80
|
|
-Recording.prototype.setRecordingJibri = function (state, callback, errCallback,
|
81
|
|
- options) {
|
|
82
|
+Recording.prototype.setRecordingJibri
|
|
83
|
+ = function (state, callback, errCallback, options) {
|
|
84
|
+
|
82
|
85
|
if (state == this.state){
|
83
|
|
- errCallback(new Error("Invalid state!"));
|
|
86
|
+ errCallback(JitsiRecorderErrors.INVALID_STATE);
|
84
|
87
|
}
|
85
|
88
|
options = options || {};
|
86
|
89
|
|
|
@@ -215,9 +218,13 @@ Recording.prototype.toggleRecording = function (options, statusChangeHandler) {
|
215
|
218
|
var oldState = this.state;
|
216
|
219
|
|
217
|
220
|
// If the recorder is currently unavailable we throw an error.
|
218
|
|
- if (oldState === Recording.status.UNAVAILABLE)
|
219
|
|
- statusChangeHandler("error",
|
220
|
|
- new Error(JitsiRecorderErrors.RECORDER_UNAVAILABLE));
|
|
221
|
+ if (oldState === Recording.status.UNAVAILABLE
|
|
222
|
+ || oldState === Recording.status.FAILED)
|
|
223
|
+ statusChangeHandler(Recording.status.FAILED,
|
|
224
|
+ JitsiRecorderErrors.RECORDER_UNAVAILABLE);
|
|
225
|
+ else if (oldState === Recording.status.BUSY)
|
|
226
|
+ statusChangeHandler(Recording.status.BUSY,
|
|
227
|
+ JitsiRecorderErrors.RECORDER_BUSY);
|
221
|
228
|
|
222
|
229
|
// If we're about to turn ON the recording we need either a streamId or
|
223
|
230
|
// an authentication token depending on the recording type. If we don't
|
|
@@ -226,8 +233,8 @@ Recording.prototype.toggleRecording = function (options, statusChangeHandler) {
|
226
|
233
|
|| oldState === Recording.status.AVAILABLE)
|
227
|
234
|
&& ((!options.token && this.type === Recording.types.COLIBRI) ||
|
228
|
235
|
(!options.streamId && this.type === Recording.types.JIBRI))) {
|
229
|
|
- statusChangeHandler("error",
|
230
|
|
- new Error(JitsiRecorderErrors.NO_TOKEN));
|
|
236
|
+ statusChangeHandler(Recording.status.FAILED,
|
|
237
|
+ JitsiRecorderErrors.NO_TOKEN);
|
231
|
238
|
logger.error("No token passed!");
|
232
|
239
|
return;
|
233
|
240
|
}
|
|
@@ -249,7 +256,7 @@ Recording.prototype.toggleRecording = function (options, statusChangeHandler) {
|
249
|
256
|
statusChangeHandler(state);
|
250
|
257
|
}
|
251
|
258
|
}, function (error) {
|
252
|
|
- statusChangeHandler("error", error);
|
|
259
|
+ statusChangeHandler(Recording.status.FAILED, error);
|
253
|
260
|
}, options);
|
254
|
261
|
};
|
255
|
262
|
|