Przeglądaj źródła

Adds recording support

master
hristoterezov 10 lat temu
rodzic
commit
b01976306a
3 zmienionych plików z 60 dodań i 23 usunięć
  1. 14
    11
      JitsiConference.js
  2. 14
    11
      lib-jitsi-meet.js
  3. 32
    1
      modules/xmpp/recording.js

+ 14
- 11
JitsiConference.js Wyświetl plik

@@ -419,9 +419,9 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
419 419
  * Returns true if the recording is supproted and false if not.
420 420
  */
421 421
 JitsiConference.prototype.isRecordingSupported = function () {
422
-    // if(this.room)
423
-    //     return this.room.isRecordingSupported();
424
-    // return false;
422
+    if(this.room)
423
+        return this.room.isRecordingSupported();
424
+    return false;
425 425
 };
426 426
 
427 427
 /**
@@ -429,18 +429,18 @@ JitsiConference.prototype.isRecordingSupported = function () {
429 429
  * and "off" if the recording is not started.
430 430
  */
431 431
 JitsiConference.prototype.getRecordingState = function () {
432
-    // if(this.room)
433
-    //     return this.room.getRecordingState();
434
-    // return "off";
432
+    if(this.room)
433
+        return this.room.getRecordingState();
434
+    return "off";
435 435
 }
436 436
 
437 437
 /**
438 438
  * Returns the url of the recorded video.
439 439
  */
440 440
 JitsiConference.prototype.getRecordingURL = function () {
441
-    // if(this.room)
442
-    //     return this.room.getRecordingURL();
443
-    // return null;
441
+    if(this.room)
442
+        return this.room.getRecordingURL();
443
+    return null;
444 444
 }
445 445
 
446 446
 /**
@@ -448,8 +448,8 @@ JitsiConference.prototype.getRecordingURL = function () {
448 448
  * @param token a token for authentication.
449 449
  */
450 450
 JitsiConference.prototype.toggleRecording = function (token) {
451
-    // if(this.room)
452
-    //     this.room.toggleRecording(token);
451
+    if(this.room)
452
+        this.room.toggleRecording(token);
453 453
 }
454 454
 
455 455
 /**
@@ -493,6 +493,9 @@ function setupListeners(conference) {
493 493
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
494 494
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
495 495
     });
496
+    conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED, function () {
497
+        conference.eventEmitter.emit(JitsiConferenceEvents.RECORDING_STATE_CHANGED);
498
+    });
496 499
 
497 500
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
498 501
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);

+ 14
- 11
lib-jitsi-meet.js Wyświetl plik

@@ -421,9 +421,9 @@ JitsiConference.prototype.sendTones = function (tones, duration, pause) {
421 421
  * Returns true if the recording is supproted and false if not.
422 422
  */
423 423
 JitsiConference.prototype.isRecordingSupported = function () {
424
-    // if(this.room)
425
-    //     return this.room.isRecordingSupported();
426
-    // return false;
424
+    if(this.room)
425
+        return this.room.isRecordingSupported();
426
+    return false;
427 427
 };
428 428
 
429 429
 /**
@@ -431,18 +431,18 @@ JitsiConference.prototype.isRecordingSupported = function () {
431 431
  * and "off" if the recording is not started.
432 432
  */
433 433
 JitsiConference.prototype.getRecordingState = function () {
434
-    // if(this.room)
435
-    //     return this.room.getRecordingState();
436
-    // return "off";
434
+    if(this.room)
435
+        return this.room.getRecordingState();
436
+    return "off";
437 437
 }
438 438
 
439 439
 /**
440 440
  * Returns the url of the recorded video.
441 441
  */
442 442
 JitsiConference.prototype.getRecordingURL = function () {
443
-    // if(this.room)
444
-    //     return this.room.getRecordingURL();
445
-    // return null;
443
+    if(this.room)
444
+        return this.room.getRecordingURL();
445
+    return null;
446 446
 }
447 447
 
448 448
 /**
@@ -450,8 +450,8 @@ JitsiConference.prototype.getRecordingURL = function () {
450 450
  * @param token a token for authentication.
451 451
  */
452 452
 JitsiConference.prototype.toggleRecording = function (token) {
453
-    // if(this.room)
454
-    //     this.room.toggleRecording(token);
453
+    if(this.room)
454
+        this.room.toggleRecording(token);
455 455
 }
456 456
 
457 457
 /**
@@ -495,6 +495,9 @@ function setupListeners(conference) {
495 495
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
496 496
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
497 497
     });
498
+    conference.room.addListener(XMPPEvents.RECORDING_STATE_CHANGED, function () {
499
+        conference.eventEmitter.emit(JitsiConferenceEvents.RECORDING_STATE_CHANGED);
500
+    });
498 501
 
499 502
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
500 503
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);

+ 32
- 1
modules/xmpp/recording.js Wyświetl plik

@@ -9,10 +9,19 @@ function Recording(ee, connection, focusMucJid) {
9 9
     this.state = "off";
10 10
     this.focusMucJid = focusMucJid;
11 11
     this.url = null;
12
-    this.isRecordingSupported = false;
12
+    this.isSupported = false;
13 13
 }
14 14
 
15 15
 Recording.prototype.handleJibriPresence = function (jibri) {
16
+    var attributes = jibri.attributes;
17
+    if(!attributes)
18
+        return;
19
+
20
+    this.isSupported = (attributes.status && attributes.status !== "undefined");
21
+    if(this.isSupported) {
22
+        this.url = attributes.url || null;
23
+        this.state = attributes.status || "off";
24
+    }
16 25
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
17 26
 };
18 27
 
@@ -67,4 +76,26 @@ Recording.prototype.toggleRecording = function (token) {
67 76
     );
68 77
 };
69 78
 
79
+/**
80
+ * Returns true if the recording is supproted and false if not.
81
+ */
82
+Recording.prototype.isSupported = function () {
83
+    return this.isSupported;
84
+};
85
+
86
+/**
87
+ * Returns null if the recording is not supported, "on" if the recording started
88
+ * and "off" if the recording is not started.
89
+ */
90
+Recording.prototype.getState = function () {
91
+    return this.state;
92
+}
93
+
94
+/**
95
+ * Returns the url of the recorded video.
96
+ */
97
+Recording.prototype.getURL = function () {
98
+    return this.url;
99
+}
100
+
70 101
 module.exports = Recording;

Ładowanie…
Anuluj
Zapisz