|
|
@@ -6,6 +6,58 @@ const XMPPEvents = require('../../service/xmpp/XMPPEvents');
|
|
6
|
6
|
const JitsiRecorderErrors = require('../../JitsiRecorderErrors');
|
|
7
|
7
|
const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
|
|
8
|
8
|
|
|
|
9
|
+/**
|
|
|
10
|
+ * Extracts the error details from given error element/node.
|
|
|
11
|
+ *
|
|
|
12
|
+ * @param {Element|Object} errorIqNode - Either DOM element or the structure
|
|
|
13
|
+ * from ChatRoom packet2JSON.
|
|
|
14
|
+ * @return {{
|
|
|
15
|
+ * code: string,
|
|
|
16
|
+ * type: string,
|
|
|
17
|
+ * message: string
|
|
|
18
|
+ * }}
|
|
|
19
|
+ */
|
|
|
20
|
+function getJibriErrorDetails(errorIqNode) {
|
|
|
21
|
+ if (typeof errorIqNode.querySelector === 'function') {
|
|
|
22
|
+ const error = errorIqNode.querySelector('error');
|
|
|
23
|
+ const errorText = error && error.querySelector('text');
|
|
|
24
|
+
|
|
|
25
|
+ return error && {
|
|
|
26
|
+ code: error.attributes.code && error.attributes.code.value,
|
|
|
27
|
+ type: error.attributes.type && error.attributes.type.value,
|
|
|
28
|
+ message: errorText && errorText.textContent
|
|
|
29
|
+ };
|
|
|
30
|
+ }
|
|
|
31
|
+
|
|
|
32
|
+ let error = null;
|
|
|
33
|
+
|
|
|
34
|
+ for (const child of errorIqNode.children) {
|
|
|
35
|
+ if (child.tagName === 'error') {
|
|
|
36
|
+ error = child;
|
|
|
37
|
+ break;
|
|
|
38
|
+ }
|
|
|
39
|
+ }
|
|
|
40
|
+
|
|
|
41
|
+ if (!error) {
|
|
|
42
|
+ return null;
|
|
|
43
|
+ }
|
|
|
44
|
+
|
|
|
45
|
+ let errorText = null;
|
|
|
46
|
+
|
|
|
47
|
+ for (const errorChild of error.children) {
|
|
|
48
|
+ if (errorChild.tagName === 'text') {
|
|
|
49
|
+ errorText = errorChild.value;
|
|
|
50
|
+ break;
|
|
|
51
|
+ }
|
|
|
52
|
+ }
|
|
|
53
|
+
|
|
|
54
|
+ return {
|
|
|
55
|
+ code: error.attributes.code,
|
|
|
56
|
+ type: error.attributes.type,
|
|
|
57
|
+ message: errorText
|
|
|
58
|
+ };
|
|
|
59
|
+}
|
|
|
60
|
+
|
|
9
|
61
|
/* eslint-disable max-params */
|
|
10
|
62
|
|
|
11
|
63
|
/**
|
|
|
@@ -35,6 +87,7 @@ export default function Recording(
|
|
35
|
87
|
= !(
|
|
36
|
88
|
(type === Recording.types.JIRECON && !this.jirecon)
|
|
37
|
89
|
|| (type !== Recording.types.JIBRI
|
|
|
90
|
+ && type !== Recording.types.JIBRI_FILE
|
|
38
|
91
|
&& type !== Recording.types.COLIBRI));
|
|
39
|
92
|
|
|
40
|
93
|
/**
|
|
|
@@ -51,7 +104,8 @@ export default function Recording(
|
|
51
|
104
|
Recording.types = {
|
|
52
|
105
|
COLIBRI: 'colibri',
|
|
53
|
106
|
JIRECON: 'jirecon',
|
|
54
|
|
- JIBRI: 'jibri'
|
|
|
107
|
+ JIBRI: 'jibri',
|
|
|
108
|
+ JIBRI_FILE: 'jibri_file'
|
|
55
|
109
|
};
|
|
56
|
110
|
|
|
57
|
111
|
Recording.status = {
|
|
|
@@ -79,8 +133,9 @@ Recording.prototype.handleJibriPresence = function(jibri) {
|
|
79
|
133
|
}
|
|
80
|
134
|
|
|
81
|
135
|
const newState = attributes.status;
|
|
|
136
|
+ const errorDetails = getJibriErrorDetails(jibri);
|
|
82
|
137
|
|
|
83
|
|
- logger.log('Handle jibri presence : ', newState);
|
|
|
138
|
+ logger.log(`Handle Jibri presence : ${newState}`, errorDetails);
|
|
84
|
139
|
|
|
85
|
140
|
if (newState === this.state) {
|
|
86
|
141
|
return;
|
|
|
@@ -125,7 +180,12 @@ Recording.prototype.setRecordingJibri = function(
|
|
125
|
180
|
'action': state === Recording.status.ON
|
|
126
|
181
|
? Recording.action.START
|
|
127
|
182
|
: Recording.action.STOP,
|
|
128
|
|
- 'streamid': options.streamId
|
|
|
183
|
+ 'recording_mode': this.type === Recording.types.JIBRI_FILE
|
|
|
184
|
+ ? 'file'
|
|
|
185
|
+ : 'stream',
|
|
|
186
|
+ 'streamid': this.type === Recording.types.JIBRI
|
|
|
187
|
+ ? options.streamId
|
|
|
188
|
+ : undefined
|
|
129
|
189
|
})
|
|
130
|
190
|
.up();
|
|
131
|
191
|
|
|
|
@@ -141,7 +201,8 @@ Recording.prototype.setRecordingJibri = function(
|
|
141
|
201
|
callback(jibri.attr('state'), jibri.attr('url'));
|
|
142
|
202
|
},
|
|
143
|
203
|
error => {
|
|
144
|
|
- logger.log('Failed to start recording, error: ', error);
|
|
|
204
|
+ logger.log(
|
|
|
205
|
+ 'Failed to start recording, error: ', getJibriErrorDetails(error));
|
|
145
|
206
|
errCallback(error);
|
|
146
|
207
|
});
|
|
147
|
208
|
};
|
|
|
@@ -258,6 +319,7 @@ Recording.prototype.setRecording = function(...args) {
|
|
258
|
319
|
this.setRecordingColibri(...args);
|
|
259
|
320
|
break;
|
|
260
|
321
|
case Recording.types.JIBRI:
|
|
|
322
|
+ case Recording.types.JIBRI_FILE:
|
|
261
|
323
|
this.setRecordingJibri(...args);
|
|
262
|
324
|
break;
|
|
263
|
325
|
default: {
|