|
@@ -187,8 +187,6 @@ export default function JitsiConference(options) {
|
187
|
187
|
this.dtmfManager = null;
|
188
|
188
|
this.somebodySupportsDTMF = false;
|
189
|
189
|
this.authEnabled = false;
|
190
|
|
- this.startAudioMuted = false;
|
191
|
|
- this.startVideoMuted = false;
|
192
|
190
|
this.startMutedPolicy = {
|
193
|
191
|
audio: false,
|
194
|
192
|
video: false
|
|
@@ -1238,38 +1236,6 @@ JitsiConference.prototype._fireMuteChangeEvent = function(track) {
|
1238
|
1236
|
this.eventEmitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track, actorParticipant);
|
1239
|
1237
|
};
|
1240
|
1238
|
|
1241
|
|
-/**
|
1242
|
|
- * Returns the list of local tracks that need to be added to the peerconnection on join.
|
1243
|
|
- * This takes the startAudioMuted/startVideoMuted flags into consideration since we do not
|
1244
|
|
- * want to add the tracks if the user joins the call audio/video muted. The tracks will be
|
1245
|
|
- * added when the user unmutes for the first time.
|
1246
|
|
- * @returns {Array<JitsiLocalTrack>} - list of local tracks that are unmuted.
|
1247
|
|
- */
|
1248
|
|
-JitsiConference.prototype._getInitialLocalTracks = function() {
|
1249
|
|
- // Always add the audio track on certain platforms:
|
1250
|
|
- // * Safari / WebKit: because of a known issue where audio playout doesn't happen
|
1251
|
|
- // if the user joins audio and video muted.
|
1252
|
|
- // * React Native: after iOS 15, if a user joins muted they won't be able to unmute.
|
1253
|
|
- return this.getLocalTracks()
|
1254
|
|
- .filter(track => {
|
1255
|
|
- const trackType = track.getType();
|
1256
|
|
-
|
1257
|
|
- if (trackType === MediaType.AUDIO
|
1258
|
|
- && (!(this.isStartAudioMuted() || this.startMutedPolicy.audio)
|
1259
|
|
- || browser.isWebKitBased()
|
1260
|
|
- || browser.isReactNative())) {
|
1261
|
|
- return true;
|
1262
|
|
- } else if (trackType === MediaType.VIDEO && !this.isStartVideoMuted() && !this.startMutedPolicy.video) {
|
1263
|
|
- return true;
|
1264
|
|
- }
|
1265
|
|
-
|
1266
|
|
- // Remove the track from the conference.
|
1267
|
|
- this.onLocalTrackRemoved(track);
|
1268
|
|
-
|
1269
|
|
- return false;
|
1270
|
|
- });
|
1271
|
|
-};
|
1272
|
|
-
|
1273
|
1239
|
/**
|
1274
|
1240
|
* Clear JitsiLocalTrack properties and listeners.
|
1275
|
1241
|
* @param track the JitsiLocalTrack object.
|
|
@@ -1834,6 +1800,31 @@ JitsiConference.prototype.onMemberJoined = function(
|
1834
|
1800
|
}
|
1835
|
1801
|
|
1836
|
1802
|
this._maybeSetSITimeout();
|
|
1803
|
+ const { startAudioMuted, startVideoMuted } = this.options.config;
|
|
1804
|
+
|
|
1805
|
+ // Ignore startAudio/startVideoMuted settings if the media session has already been established.
|
|
1806
|
+ // Apply the policy if the number of participants exceeds the startMuted thresholds.
|
|
1807
|
+ if ((this.jvbJingleSession && this.getActiveMediaSession() === this.jvbJingleSession)
|
|
1808
|
+ || ((typeof startAudioMuted === 'undefined' || startAudioMuted === -1)
|
|
1809
|
+ && (typeof startVideoMuted === 'undefined' || startVideoMuted === -1))) {
|
|
1810
|
+ return;
|
|
1811
|
+ }
|
|
1812
|
+
|
|
1813
|
+ let audioMuted = false;
|
|
1814
|
+ let videoMuted = false;
|
|
1815
|
+ const numberOfParticipants = this.getParticipantCount();
|
|
1816
|
+
|
|
1817
|
+ if (numberOfParticipants > this.options.config.startAudioMuted) {
|
|
1818
|
+ audioMuted = true;
|
|
1819
|
+ }
|
|
1820
|
+
|
|
1821
|
+ if (numberOfParticipants > this.options.config.startVideoMuted) {
|
|
1822
|
+ videoMuted = true;
|
|
1823
|
+ }
|
|
1824
|
+
|
|
1825
|
+ if ((audioMuted && !this.startMutedPolicy.audio) || (videoMuted && !this.startMutedPolicy.video)) {
|
|
1826
|
+ this._updateStartMutedPolicy(audioMuted, videoMuted);
|
|
1827
|
+ }
|
1837
|
1828
|
};
|
1838
|
1829
|
|
1839
|
1830
|
/* eslint-enable max-params */
|
|
@@ -2282,7 +2273,7 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
|
2282
|
2273
|
// Open a channel with the videobridge.
|
2283
|
2274
|
this._setBridgeChannel(jingleOffer, jingleSession.peerconnection);
|
2284
|
2275
|
|
2285
|
|
- const localTracks = this._getInitialLocalTracks();
|
|
2276
|
+ const localTracks = this.getLocalTracks();
|
2286
|
2277
|
|
2287
|
2278
|
try {
|
2288
|
2279
|
jingleSession.acceptOffer(
|
|
@@ -2653,11 +2644,9 @@ JitsiConference.prototype.setStartMutedPolicy = function(policy) {
|
2653
|
2644
|
return;
|
2654
|
2645
|
}
|
2655
|
2646
|
|
2656
|
|
- // Do not apply the startMutedPolicy locally on the moderator, the moderator should join with available local
|
2657
|
|
- // sources and the policy needs to be applied only on users that join the call after.
|
2658
|
|
- // this.startMutedPolicy = policy;
|
2659
|
|
- // TODO: to remove using presence for startmuted policy after old clients update
|
2660
|
|
- // we keep presence to update UI of old clients
|
|
2647
|
+ logger.info(`Setting start muted policy: ${JSON.stringify(policy)} in presence and in conference metadata`);
|
|
2648
|
+
|
|
2649
|
+ // TODO: to remove using presence for startmuted policy after old clients update to using metadata always.
|
2661
|
2650
|
this.room.addOrReplaceInPresence('startmuted', {
|
2662
|
2651
|
attributes: {
|
2663
|
2652
|
audio: policy.audio,
|
|
@@ -2666,9 +2655,6 @@ JitsiConference.prototype.setStartMutedPolicy = function(policy) {
|
2666
|
2655
|
}
|
2667
|
2656
|
}) && this.room.sendPresence();
|
2668
|
2657
|
|
2669
|
|
- // we want to ignore applying startMutedPolicy locally when we set it
|
2670
|
|
- this._ignoreFirstStartMutedPolicyUpdate = true;
|
2671
|
|
-
|
2672
|
2658
|
this.getMetadataHandler().setMetadata('startMuted', {
|
2673
|
2659
|
audio: policy.audio,
|
2674
|
2660
|
video: policy.video
|
|
@@ -2682,9 +2668,8 @@ JitsiConference.prototype.setStartMutedPolicy = function(policy) {
|
2682
|
2668
|
* @param {boolean} video if video should be muted.
|
2683
|
2669
|
*/
|
2684
|
2670
|
JitsiConference.prototype._updateStartMutedPolicy = function(audio, video) {
|
2685
|
|
- if (this._ignoreFirstStartMutedPolicyUpdate) {
|
2686
|
|
- this._ignoreFirstStartMutedPolicyUpdate = false;
|
2687
|
|
-
|
|
2671
|
+ // Update the start muted policy for the conference only if the meta data is received before conference join.
|
|
2672
|
+ if (this.isJoined()) {
|
2688
|
2673
|
return;
|
2689
|
2674
|
}
|
2690
|
2675
|
|
|
@@ -2716,20 +2701,6 @@ JitsiConference.prototype.getStartMutedPolicy = function() {
|
2716
|
2701
|
return this.startMutedPolicy;
|
2717
|
2702
|
};
|
2718
|
2703
|
|
2719
|
|
-/**
|
2720
|
|
- * Check if audio is muted on join.
|
2721
|
|
- */
|
2722
|
|
-JitsiConference.prototype.isStartAudioMuted = function() {
|
2723
|
|
- return this.startAudioMuted;
|
2724
|
|
-};
|
2725
|
|
-
|
2726
|
|
-/**
|
2727
|
|
- * Check if video is muted on join.
|
2728
|
|
- */
|
2729
|
|
-JitsiConference.prototype.isStartVideoMuted = function() {
|
2730
|
|
- return this.startVideoMuted;
|
2731
|
|
-};
|
2732
|
|
-
|
2733
|
2704
|
/**
|
2734
|
2705
|
* Returns measured connectionTimes.
|
2735
|
2706
|
*/
|