浏览代码

Implements recording

j8
hristoterezov 9 年前
父节点
当前提交
c8c6a6d583
共有 2 个文件被更改,包括 971 次插入1171 次删除
  1. 24
    11
      app.js
  2. 947
    1160
      libs/lib-jitsi-meet.js

+ 24
- 11
app.js 查看文件

@@ -136,10 +136,16 @@ const APP = {
136 136
 };
137 137
 
138 138
 function initConference(localTracks, connection) {
139
-    let room = connection.initJitsiConference(APP.conference.roomName, {
139
+    let options = {
140 140
         openSctp: config.openSctp,
141 141
         disableAudioLevels: config.disableAudioLevels
142
-    });
142
+    };
143
+    if(config.enableRecording) {
144
+        options.recordingType = (config.hosts &&
145
+            (typeof config.hosts.jirecon != "undefined"))?
146
+            "jirecon" : "colibri";
147
+    }
148
+    let room = connection.initJitsiConference(APP.conference.roomName, options);
143 149
     APP.conference._room = room; // FIXME do not use this
144 150
 
145 151
     const addTrack = (track) => {
@@ -414,6 +420,15 @@ function initConference(localTracks, connection) {
414 420
     room.on(ConferenceEvents.DISPLAY_NAME_CHANGED, function (id, displayName) {
415 421
         APP.UI.changeDisplayName(id, displayName);
416 422
     });
423
+
424
+    room.on(ConferenceEvents.RECORDING_STATE_CHANGED, (status, error) => {
425
+        if(status == "error") {
426
+            console.error(error);
427
+            return;
428
+        }
429
+        APP.UI.updateRecordingState(status);
430
+    });
431
+
417 432
     APP.UI.addListener(UIEvents.NICKNAME_CHANGED, function (nickname) {
418 433
         APP.settings.setDisplayName(nickname);
419 434
         room.setDisplayName(nickname);
@@ -471,16 +486,14 @@ function initConference(localTracks, connection) {
471 486
 
472 487
     // Starts or stops the recording for the conference.
473 488
     APP.UI.addListener(UIEvents.RECORDING_TOGGLE, function (predefinedToken) {
474
-        // FIXME recording
475
-        // APP.xmpp.toggleRecording(function (callback) {
476
-        //     if (predefinedToken) {
477
-        //         callback(predefinedToken);
478
-        //         return;
479
-        //     }
480
-
481
-        //     APP.UI.requestRecordingToken().then(callback);
489
+        if (predefinedToken) {
490
+            room.toggleRecording({token: predefinedToken});
491
+            return;
492
+        }
493
+        APP.UI.requestRecordingToken().then((token) => {
494
+            room.toggleRecording({token: token});
495
+        });
482 496
 
483
-        // }, APP.UI.updateRecordingState);
484 497
     });
485 498
 
486 499
     APP.UI.addListener(UIEvents.TOPIC_CHANGED, function (topic) {

+ 947
- 1160
libs/lib-jitsi-meet.js
文件差异内容过多而无法显示
查看文件


正在加载...
取消
保存