瀏覽代碼

made the audioRecorder private to the transcriber

dev1
nikvaessen 9 年之前
父節點
當前提交
e6830b249e
共有 3 個文件被更改,包括 24 次插入11 次删除
  1. 1
    3
      JitsiConference.js
  2. 7
    3
      modules/transcription/audioRecorder.js
  3. 16
    5
      modules/transcription/transcriber.js

+ 1
- 3
JitsiConference.js 查看文件

@@ -17,7 +17,6 @@ var ComponentsVersions = require("./modules/version/ComponentsVersions");
17 17
 var GlobalOnErrorHandler = require("./modules/util/GlobalOnErrorHandler");
18 18
 var JitsiConferenceEventManager = require("./JitsiConferenceEventManager");
19 19
 var Transcriber = require("./modules/transcription/transcriber");
20
-var AudioRecorder = require("./modules/transcription/audioRecorder");
21 20
 
22 21
 /**
23 22
  * Creates a JitsiConference object with the given name and properties.
@@ -58,7 +57,6 @@ function JitsiConference(options) {
58 57
     };
59 58
     this.isMutedByFocus = false;
60 59
     this.reportedAudioSSRCs = {};
61
-    this.audioRecorder = new AudioRecorder();
62 60
 }
63 61
 
64 62
 /**
@@ -376,7 +374,7 @@ JitsiConference.prototype.setSubject = function (subject) {
376 374
  */
377 375
 JitsiConference.prototype.getTranscriber = function(){
378 376
     if(this.transcriber === undefined){
379
-        this.transcriber = new Transcriber(this.audioRecorder);
377
+        this.transcriber = new Transcriber();
380 378
     }
381 379
     return this.transcriber;
382 380
 };

+ 7
- 3
modules/transcription/audioRecorder.js 查看文件

@@ -154,13 +154,17 @@ audioRecorder.prototype.addTrack = function (track) {
154 154
  * but not removed from the array so that the recorded stream can still be
155 155
  * accessed
156 156
  *
157
- * @param jitsiTrack the JitsiTrack to remove from the recording session
157
+ * @param {JitsiTrack} track the JitsiTrack to remove from the recording session
158 158
  */
159
-audioRecorder.prototype.removeTrack = function(jitsiTrack){
159
+audioRecorder.prototype.removeTrack = function(track){
160
+    if(track.isVideoTrack()){
161
+        return;
162
+    }
163
+    
160 164
     var array = this.recorders;
161 165
     var i;
162 166
     for(i = 0; i < array.length; i++) {
163
-        if(array[i].track.getParticipantId() === jitsiTrack.getParticipantId()){
167
+        if(array[i].track.getParticipantId() === track.getParticipantId()){
164 168
             var recorderToRemove = array[i];
165 169
             if(this.isRecording){
166 170
                 stopRecorder(recorderToRemove);

+ 16
- 5
modules/transcription/transcriber.js 查看文件

@@ -17,9 +17,9 @@ var MAXIMUM_SENTENCE_LENGTH = 80;
17 17
  * will be merged to create a transcript
18 18
  * @param {AudioRecorder} audioRecorder An audioRecorder recording a conference
19 19
  */
20
-var transcriber = function(audioRecorder) {
20
+var transcriber = function() {
21 21
     //the object which can record all audio in the conference
22
-    this.audioRecorder = audioRecorder;
22
+    this.audioRecorder = new AudioRecorder();
23 23
     //this object can send the recorder audio to a speech-to-text service
24 24
     this.transcriptionService =  new SphinxService();
25 25
     //holds a counter to keep track if merging can start
@@ -273,10 +273,21 @@ var pushWordToSortedArray = function(array, word){
273 273
 };
274 274
 
275 275
 /**
276
- * Returns the AudioRecorder module to add and remove tracks to
276
+ * Gives the transcriber a JitsiTrack holding an audioStream to transcribe.
277
+ * The JitsiTrack is given to the audioRecorder. If it doesn't hold an
278
+ * audiostream, it will not be added by the audioRecorder
279
+ * @param {JitsiTrack} track the track to give to the audioRecorder
277 280
  */
278
-transcriber.getAudioRecorder = function getAudioRecorder() {
279
-    return this.audioRecorder;
281
+transcriber.prototype.addTrack = function(track){
282
+    this.audioRecorder.addTrack(track);
283
+};
284
+
285
+/**
286
+ * Remove the given track from the auioRecorder
287
+ * @param track
288
+ */
289
+transcriber.prototype.removeTrack = function(track){
290
+    this.audioRecorder.removeTrack(track);
280 291
 };
281 292
 
282 293
 /**

Loading…
取消
儲存