Browse Source

Adds follow entity parameter for the recording

master
hristoterezov 9 years ago
parent
commit
ba5275ef2f
5 changed files with 35 additions and 31 deletions
  1. 2
    2
      JitsiConference.js
  2. 3
    3
      doc/example/example.js
  3. 18
    15
      lib-jitsi-meet.js
  4. 2
    2
      modules/xmpp/ChatRoom.js
  5. 10
    9
      modules/xmpp/recording.js

+ 2
- 2
JitsiConference.js View File

447
  * Starts/stops the recording
447
  * Starts/stops the recording
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, followEntity) {
451
     if(this.room)
451
     if(this.room)
452
-        return this.room.toggleRecording(token);
452
+        return this.room.toggleRecording(token, followEntity);
453
     return new Promise(function(resolve, reject){
453
     return new Promise(function(resolve, reject){
454
         reject(new Error("The conference is not created yet!"))});
454
         reject(new Error("The conference is not created yet!"))});
455
 }
455
 }

+ 3
- 3
doc/example/example.js View File

42
             $("body").append("<video autoplay='1' id='localVideo" + i + "' />");
42
             $("body").append("<video autoplay='1' id='localVideo" + i + "' />");
43
             localTracks[i].attach($("#localVideo" + i ));
43
             localTracks[i].attach($("#localVideo" + i ));
44
         } else {
44
         } else {
45
-            // $("body").append("<audio autoplay='1' id='localAudio" + i + "' />");
46
-            // localTracks[i].attach($("#localAudio" + i ));
45
+            $("body").append("<audio autoplay='1' muted='true' id='localAudio" + i + "' />");
46
+            localTracks[i].attach($("#localAudio" + i ));
47
         }
47
         }
48
         if(isJoined)
48
         if(isJoined)
49
             room.addTrack(localTracks[i]);
49
             room.addTrack(localTracks[i]);
105
  * That function is called when connection is established successfully
105
  * That function is called when connection is established successfully
106
  */
106
  */
107
 function onConnectionSuccess(){
107
 function onConnectionSuccess(){
108
-    room = connection.initJitsiConference("conference6", confOptions);
108
+    room = connection.initJitsiConference("conference10", confOptions);
109
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
109
     room.on(JitsiMeetJS.events.conference.TRACK_ADDED, onRemoteTrack);
110
     room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function (track) {
110
     room.on(JitsiMeetJS.events.conference.TRACK_REMOVED, function (track) {
111
         console.log("track removed!!!" + track);
111
         console.log("track removed!!!" + track);

+ 18
- 15
lib-jitsi-meet.js View File

449
  * Starts/stops the recording
449
  * Starts/stops the recording
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, followEntity) {
453
     if(this.room)
453
     if(this.room)
454
-        return this.room.toggleRecording(token);
454
+        return this.room.toggleRecording(token, followEntity);
455
     return new Promise(function(resolve, reject){
455
     return new Promise(function(resolve, reject){
456
         reject(new Error("The conference is not created yet!"))});
456
         reject(new Error("The conference is not created yet!"))});
457
 }
457
 }
6503
  * Starts/stops the recording
6503
  * Starts/stops the recording
6504
  * @param token token for authentication
6504
  * @param token token for authentication
6505
  */
6505
  */
6506
-ChatRoom.prototype.toggleRecording = function (token) {
6506
+ChatRoom.prototype.toggleRecording = function (token, followEntity) {
6507
     if(this.recording)
6507
     if(this.recording)
6508
-        return this.recording.toggleRecording(token);
6508
+        return this.recording.toggleRecording(token, followEntity);
6509
 
6509
 
6510
     return new Promise(function(resolve, reject){
6510
     return new Promise(function(resolve, reject){
6511
         reject(new Error("The conference is not created yet!"))});
6511
         reject(new Error("The conference is not created yet!"))});
10725
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
10725
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
10726
 };
10726
 };
10727
 
10727
 
10728
-Recording.prototype.setRecording = function (state, streamId, callback,
10729
-    errCallback){
10728
+Recording.prototype.setRecording = function (state, streamId, followEntity,
10729
+    callback, errCallback){
10730
     if (state == this.state){
10730
     if (state == this.state){
10731
         return;
10731
         return;
10732
     }
10732
     }
10735
 
10735
 
10736
     var iq = $iq({to: this.focusMucJid, type: 'set'})
10736
     var iq = $iq({to: this.focusMucJid, type: 'set'})
10737
         .c('jibri', {
10737
         .c('jibri', {
10738
-            xmlns: 'http://jitsi.org/protocol/jibri',
10739
-            action: (state === 'on') ? 'start' : 'stop',
10740
-            streamid: streamId
10738
+            "xmlns": 'http://jitsi.org/protocol/jibri',
10739
+            "action": (state === 'on') ? 'start' : 'stop',
10740
+            "streamid": streamId,
10741
+            "follow-entity": followEntity
10741
         }).up();
10742
         }).up();
10742
 
10743
 
10743
-    logger.log('Set jibri recording: '+state, iq);
10744
-
10744
+    logger.log('Set jibri recording: '+state, iq.nodeTree);
10745
+    console.log(iq.nodeTree);
10745
     this.connection.sendIQ(
10746
     this.connection.sendIQ(
10746
         iq,
10747
         iq,
10747
         function (result) {
10748
         function (result) {
10754
         });
10755
         });
10755
 };
10756
 };
10756
 
10757
 
10757
-Recording.prototype.toggleRecording = function (token) {
10758
+Recording.prototype.toggleRecording = function (token, followEntity) {
10758
     var self = this;
10759
     var self = this;
10759
     return new Promise(function(resolve, reject) {
10760
     return new Promise(function(resolve, reject) {
10760
         if (!token) {
10761
         if (!token) {
10772
         var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
10773
         var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
10773
 
10774
 
10774
         self.setRecording(newState,
10775
         self.setRecording(newState,
10775
-            token,
10776
+            token, followEntity,
10776
             function (state, url) {
10777
             function (state, url) {
10777
                 logger.log("New recording state: ", state);
10778
                 logger.log("New recording state: ", state);
10778
                 if (state && state !== oldState) {
10779
                 if (state && state !== oldState) {
11424
                             logger.info('Dial result ', result);
11425
                             logger.info('Dial result ', result);
11425
 
11426
 
11426
                             var resource = $(result).find('ref').attr('uri');
11427
                             var resource = $(result).find('ref').attr('uri');
11427
-                            self.call_resource = resource.substr('xmpp:'.length);
11428
+                            self.call_resource =
11429
+                                resource.substr('xmpp:'.length);
11428
                             logger.info(
11430
                             logger.info(
11429
-                                "Received call resource: " + self.call_resource);
11431
+                                "Received call resource: " +
11432
+                                self.call_resource);
11430
                             resolve();
11433
                             resolve();
11431
                         },
11434
                         },
11432
                         function (error) {
11435
                         function (error) {

+ 2
- 2
modules/xmpp/ChatRoom.js View File

702
  * Starts/stops the recording
702
  * Starts/stops the recording
703
  * @param token token for authentication
703
  * @param token token for authentication
704
  */
704
  */
705
-ChatRoom.prototype.toggleRecording = function (token) {
705
+ChatRoom.prototype.toggleRecording = function (token, followEntity) {
706
     if(this.recording)
706
     if(this.recording)
707
-        return this.recording.toggleRecording(token);
707
+        return this.recording.toggleRecording(token, followEntity);
708
 
708
 
709
     return new Promise(function(resolve, reject){
709
     return new Promise(function(resolve, reject){
710
         reject(new Error("The conference is not created yet!"))});
710
         reject(new Error("The conference is not created yet!"))});

+ 10
- 9
modules/xmpp/recording.js View File

26
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
26
     this.eventEmitter.emit(XMPPEvents.RECORDING_STATE_CHANGED);
27
 };
27
 };
28
 
28
 
29
-Recording.prototype.setRecording = function (state, streamId, callback,
30
-    errCallback){
29
+Recording.prototype.setRecording = function (state, streamId, followEntity,
30
+    callback, errCallback){
31
     if (state == this.state){
31
     if (state == this.state){
32
         return;
32
         return;
33
     }
33
     }
36
 
36
 
37
     var iq = $iq({to: this.focusMucJid, type: 'set'})
37
     var iq = $iq({to: this.focusMucJid, type: 'set'})
38
         .c('jibri', {
38
         .c('jibri', {
39
-            xmlns: 'http://jitsi.org/protocol/jibri',
40
-            action: (state === 'on') ? 'start' : 'stop',
41
-            streamid: streamId
39
+            "xmlns": 'http://jitsi.org/protocol/jibri',
40
+            "action": (state === 'on') ? 'start' : 'stop',
41
+            "streamid": streamId,
42
+            "follow-entity": followEntity
42
         }).up();
43
         }).up();
43
 
44
 
44
-    logger.log('Set jibri recording: '+state, iq);
45
-
45
+    logger.log('Set jibri recording: '+state, iq.nodeTree);
46
+    console.log(iq.nodeTree);
46
     this.connection.sendIQ(
47
     this.connection.sendIQ(
47
         iq,
48
         iq,
48
         function (result) {
49
         function (result) {
55
         });
56
         });
56
 };
57
 };
57
 
58
 
58
-Recording.prototype.toggleRecording = function (token) {
59
+Recording.prototype.toggleRecording = function (token, followEntity) {
59
     var self = this;
60
     var self = this;
60
     return new Promise(function(resolve, reject) {
61
     return new Promise(function(resolve, reject) {
61
         if (!token) {
62
         if (!token) {
73
         var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
74
         var newState = (oldState === 'off' || !oldState) ? 'on' : 'off';
74
 
75
 
75
         self.setRecording(newState,
76
         self.setRecording(newState,
76
-            token,
77
+            token, followEntity,
77
             function (state, url) {
78
             function (state, url) {
78
                 logger.log("New recording state: ", state);
79
                 logger.log("New recording state: ", state);
79
                 if (state && state !== oldState) {
80
                 if (state && state !== oldState) {

Loading…
Cancel
Save