|
|
@@ -10,12 +10,11 @@ function Recording(ee, connection, focusMucJid) {
|
|
10
|
10
|
this.focusMucJid = focusMucJid;
|
|
11
|
11
|
this.url = null;
|
|
12
|
12
|
this.isRecordingSupported = false;
|
|
13
|
|
-};
|
|
|
13
|
+}
|
|
14
|
14
|
|
|
15
|
15
|
Recording.prototype.handleJibriPresence = function (jibri) {
|
|
16
|
|
-
|
|
17
|
16
|
this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
|
|
18
|
|
-}
|
|
|
17
|
+};
|
|
19
|
18
|
|
|
20
|
19
|
Recording.prototype.setRecording = function (state, streamId, callback){
|
|
21
|
20
|
if (state == this.state){
|
|
|
@@ -41,33 +40,31 @@ Recording.prototype.setRecording = function (state, streamId, callback){
|
|
41
|
40
|
},
|
|
42
|
41
|
function (error) {
|
|
43
|
42
|
console.log('Failed to start recording, error: ', error);
|
|
44
|
|
- callback(recordingEnabled);
|
|
|
43
|
+ callback(this.state);
|
|
45
|
44
|
});
|
|
46
|
|
-}
|
|
47
|
|
-
|
|
|
45
|
+};
|
|
48
|
46
|
|
|
49
|
47
|
Recording.prototype.toggleRecording = function (token) {
|
|
50
|
48
|
// Jirecon does not (currently) support a token.
|
|
51
|
|
- if (!token) {
|
|
52
|
|
- console.error("No token passed!");
|
|
53
|
|
- return;
|
|
54
|
|
- }
|
|
|
49
|
+ if (!token) {
|
|
|
50
|
+ console.error("No token passed!");
|
|
|
51
|
+ return;
|
|
|
52
|
+ }
|
|
55
|
53
|
|
|
56
|
|
- var oldState = this.state;
|
|
57
|
|
- var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
|
|
|
54
|
+ var oldState = this.state;
|
|
|
55
|
+ var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
|
|
58
|
56
|
|
|
59
|
|
- this.setRecording(newState,
|
|
60
|
|
- token,
|
|
61
|
|
- function (state) {
|
|
62
|
|
- console.log("New recording state: ", state);
|
|
63
|
|
- if (state !== oldState) {
|
|
64
|
|
- this.state = state;
|
|
65
|
|
- this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED, state);
|
|
66
|
|
- }
|
|
|
57
|
+ this.setRecording(newState,
|
|
|
58
|
+ token,
|
|
|
59
|
+ function (state) {
|
|
|
60
|
+ console.log("New recording state: ", state);
|
|
|
61
|
+ if (state !== oldState) {
|
|
|
62
|
+ this.state = state;
|
|
|
63
|
+ this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED,
|
|
|
64
|
+ state);
|
|
67
|
65
|
}
|
|
68
|
|
- );
|
|
69
|
|
- }
|
|
70
|
|
-
|
|
|
66
|
+ }
|
|
|
67
|
+ );
|
|
71
|
68
|
};
|
|
72
|
69
|
|
|
73
|
70
|
module.exports = Recording;
|