瀏覽代碼

Adds recording support

master
hristoterezov 10 年之前
父節點
當前提交
b01976306a
共有 3 個檔案被更改,包括 60 行新增23 行删除
  1. 14
    11
      JitsiConference.js
  2. 14
    11
      lib-jitsi-meet.js
  3. 32
    1
      modules/xmpp/recording.js

+ 14
- 11
JitsiConference.js 查看文件

419
  * Returns true if the recording is supproted and false if not.
419
  * Returns true if the recording is supproted and false if not.
420
  */
420
  */
421
 JitsiConference.prototype.isRecordingSupported = function () {
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
  * and "off" if the recording is not started.
429
  * and "off" if the recording is not started.
430
  */
430
  */
431
 JitsiConference.prototype.getRecordingState = function () {
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
  * Returns the url of the recorded video.
438
  * Returns the url of the recorded video.
439
  */
439
  */
440
 JitsiConference.prototype.getRecordingURL = function () {
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
  * @param token a token for authentication.
448
  * @param token a token for authentication.
449
  */
449
  */
450
 JitsiConference.prototype.toggleRecording = function (token) {
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
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
493
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
494
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
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
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
500
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
498
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
501
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);

+ 14
- 11
lib-jitsi-meet.js 查看文件

421
  * Returns true if the recording is supproted and false if not.
421
  * Returns true if the recording is supproted and false if not.
422
  */
422
  */
423
 JitsiConference.prototype.isRecordingSupported = function () {
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
  * and "off" if the recording is not started.
431
  * and "off" if the recording is not started.
432
  */
432
  */
433
 JitsiConference.prototype.getRecordingState = function () {
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
  * Returns the url of the recorded video.
440
  * Returns the url of the recorded video.
441
  */
441
  */
442
 JitsiConference.prototype.getRecordingURL = function () {
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
  * @param token a token for authentication.
450
  * @param token a token for authentication.
451
  */
451
  */
452
 JitsiConference.prototype.toggleRecording = function (token) {
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
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
495
     conference.room.addListener(XMPPEvents.CONNECTION_INTERRUPTED, function () {
496
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_INTERRUPTED);
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
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
502
     conference.room.addListener(XMPPEvents.CONNECTION_RESTORED, function () {
500
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
503
         conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);

+ 32
- 1
modules/xmpp/recording.js 查看文件

9
     this.state = "off";
9
     this.state = "off";
10
     this.focusMucJid = focusMucJid;
10
     this.focusMucJid = focusMucJid;
11
     this.url = null;
11
     this.url = null;
12
-    this.isRecordingSupported = false;
12
+    this.isSupported = false;
13
 }
13
 }
14
 
14
 
15
 Recording.prototype.handleJibriPresence = function (jibri) {
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
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
25
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
17
 };
26
 };
18
 
27
 
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
 module.exports = Recording;
101
 module.exports = Recording;

Loading…
取消
儲存