Browse Source

made the audioRecorder private to the transcriber

dev1
nikvaessen 9 years ago
parent
commit
e6830b249e

+ 1
- 3
JitsiConference.js View File

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

+ 7
- 3
modules/transcription/audioRecorder.js View File

154
  * but not removed from the array so that the recorded stream can still be
154
  * but not removed from the array so that the recorded stream can still be
155
  * accessed
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
     var array = this.recorders;
164
     var array = this.recorders;
161
     var i;
165
     var i;
162
     for(i = 0; i < array.length; i++) {
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
             var recorderToRemove = array[i];
168
             var recorderToRemove = array[i];
165
             if(this.isRecording){
169
             if(this.isRecording){
166
                 stopRecorder(recorderToRemove);
170
                 stopRecorder(recorderToRemove);

+ 16
- 5
modules/transcription/transcriber.js View File

17
  * will be merged to create a transcript
17
  * will be merged to create a transcript
18
  * @param {AudioRecorder} audioRecorder An audioRecorder recording a conference
18
  * @param {AudioRecorder} audioRecorder An audioRecorder recording a conference
19
  */
19
  */
20
-var transcriber = function(audioRecorder) {
20
+var transcriber = function() {
21
     //the object which can record all audio in the conference
21
     //the object which can record all audio in the conference
22
-    this.audioRecorder = audioRecorder;
22
+    this.audioRecorder = new AudioRecorder();
23
     //this object can send the recorder audio to a speech-to-text service
23
     //this object can send the recorder audio to a speech-to-text service
24
     this.transcriptionService =  new SphinxService();
24
     this.transcriptionService =  new SphinxService();
25
     //holds a counter to keep track if merging can start
25
     //holds a counter to keep track if merging can start
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…
Cancel
Save