|
@@ -262,17 +262,27 @@ JitsiConference.prototype.getExternalAuthUrl = function (urlForPopup) {
|
262
|
262
|
JitsiConference.prototype.getLocalTracks = function (mediaType) {
|
263
|
263
|
let tracks = [];
|
264
|
264
|
if (this.rtc) {
|
265
|
|
- tracks = this.rtc.localTracks.slice();
|
266
|
|
- }
|
267
|
|
- if (mediaType !== undefined) {
|
268
|
|
- tracks = tracks.filter(
|
269
|
|
- (track) => {
|
270
|
|
- return track && track.getType && track.getType() === mediaType;
|
271
|
|
- });
|
|
265
|
+ tracks = this.rtc.getLocalTracks(mediaType);
|
272
|
266
|
}
|
273
|
267
|
return tracks;
|
274
|
268
|
};
|
275
|
269
|
|
|
270
|
+/**
|
|
271
|
+ * Obtains local audio track.
|
|
272
|
+ * @return {JitsiLocalTrack|null}
|
|
273
|
+ */
|
|
274
|
+JitsiConference.prototype.getLocalAudioTrack = function () {
|
|
275
|
+ return this.rtc ? this.rtc.getLocalAudioTrack() : null;
|
|
276
|
+};
|
|
277
|
+
|
|
278
|
+/**
|
|
279
|
+ * Obtains local video track.
|
|
280
|
+ * @return {JitsiLocalTrack|null}
|
|
281
|
+ */
|
|
282
|
+JitsiConference.prototype.getLocalVideoTrack = function () {
|
|
283
|
+ return this.rtc ? this.rtc.getLocalVideoTrack() : null;
|
|
284
|
+};
|
|
285
|
+
|
276
|
286
|
/**
|
277
|
287
|
* Attaches a handler for events(For example - "participant joined".) in the conference. All possible event are defined
|
278
|
288
|
* in JitsiConferenceEvents.
|
|
@@ -394,12 +404,10 @@ JitsiConference.prototype.getTranscriber = function(){
|
394
|
404
|
if (this.transcriber === undefined){
|
395
|
405
|
this.transcriber = new Transcriber();
|
396
|
406
|
//add all existing local audio tracks to the transcriber
|
397
|
|
- // FIXME accessing localTracks field directly
|
398
|
|
- this.rtc.localTracks.forEach(function (localTrack) {
|
399
|
|
- if (localTrack.isAudioTrack()){
|
400
|
|
- this.transcriber.addTrack(localTrack);
|
401
|
|
- }
|
402
|
|
- }.bind(this));
|
|
407
|
+ const localAudioTracks = this.getLocalTracks(MediaType.AUDIO);
|
|
408
|
+ for (const localAudio of localAudioTracks) {
|
|
409
|
+ this.transcriber.addTrack(localAudio);
|
|
410
|
+ }
|
403
|
411
|
//and all remote audio tracks
|
404
|
412
|
const remoteAudioTracks = this.rtc.getRemoteTracks(MediaType.AUDIO);
|
405
|
413
|
for (const remoteTrack of remoteAudioTracks){
|
|
@@ -1028,7 +1036,7 @@ function (jingleSession, jingleOffer, now) {
|
1028
|
1036
|
|
1029
|
1037
|
this.rtc.initializeDataChannels(jingleSession.peerconnection);
|
1030
|
1038
|
// Add local Tracks to the ChatRoom
|
1031
|
|
- this.rtc.localTracks.forEach(function(localTrack) {
|
|
1039
|
+ this.getLocalTracks().forEach(function(localTrack) {
|
1032
|
1040
|
var ssrcInfo = null;
|
1033
|
1041
|
/**
|
1034
|
1042
|
* We don't do this for Firefox because, on Firefox, we keep the
|
|
@@ -1124,7 +1132,7 @@ JitsiConference.prototype.onCallEnded
|
1124
|
1132
|
// will learn what their SSRC from the new PeerConnection which will be
|
1125
|
1133
|
// created on incoming call event.
|
1126
|
1134
|
var self = this;
|
1127
|
|
- this.rtc.localTracks.forEach(function(localTrack) {
|
|
1135
|
+ this.getLocalTracks().forEach(function(localTrack) {
|
1128
|
1136
|
// Reset SSRC as it will no longer be valid
|
1129
|
1137
|
localTrack._setSSRC(null);
|
1130
|
1138
|
// Bind the handler to fetch new SSRC, it will un register itself once
|
|
@@ -1177,21 +1185,25 @@ JitsiConference.prototype.myUserId = function () {
|
1177
|
1185
|
};
|
1178
|
1186
|
|
1179
|
1187
|
JitsiConference.prototype.sendTones = function (tones, duration, pause) {
|
|
1188
|
+ // FIXME P2P 'dtmfManager' must be cleared, after switching jingleSessions
|
1180
|
1189
|
if (!this.dtmfManager) {
|
1181
|
|
- var connection = this.xmpp.connection.jingle.activecall.peerconnection;
|
1182
|
|
- if (!connection) {
|
1183
|
|
- logger.warn("cannot sendTones: no conneciton");
|
|
1190
|
+ if (!this.jingleSession) {
|
|
1191
|
+ logger.warn("cannot sendTones: no jingle session");
|
1184
|
1192
|
return;
|
1185
|
1193
|
}
|
1186
|
1194
|
|
1187
|
|
- var tracks = this.getLocalTracks().filter(function (track) {
|
1188
|
|
- return track.isAudioTrack();
|
1189
|
|
- });
|
1190
|
|
- if (!tracks.length) {
|
|
1195
|
+ const peerConnection = this.jingleSession.peerconnection;
|
|
1196
|
+ if (!peerConnection) {
|
|
1197
|
+ logger.warn("cannot sendTones: no peer connection");
|
|
1198
|
+ return;
|
|
1199
|
+ }
|
|
1200
|
+
|
|
1201
|
+ const localAudio = this.getLocalAudioTrack();
|
|
1202
|
+ if (!localAudio) {
|
1191
|
1203
|
logger.warn("cannot sendTones: no local audio stream");
|
1192
|
1204
|
return;
|
1193
|
1205
|
}
|
1194
|
|
- this.dtmfManager = new JitsiDTMFManager(tracks[0], connection);
|
|
1206
|
+ this.dtmfManager = new JitsiDTMFManager(localAudio, peerConnection);
|
1195
|
1207
|
}
|
1196
|
1208
|
|
1197
|
1209
|
this.dtmfManager.sendTones(tones, duration, pause);
|