|
|
@@ -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
|
|
|
@@ -1229,38 +1227,6 @@ JitsiConference.prototype._fireMuteChangeEvent = function(track) {
|
|
1229
|
1227
|
this.eventEmitter.emit(JitsiConferenceEvents.TRACK_MUTE_CHANGED, track, actorParticipant);
|
|
1230
|
1228
|
};
|
|
1231
|
1229
|
|
|
1232
|
|
-/**
|
|
1233
|
|
- * Returns the list of local tracks that need to be added to the peerconnection on join.
|
|
1234
|
|
- * This takes the startAudioMuted/startVideoMuted flags into consideration since we do not
|
|
1235
|
|
- * want to add the tracks if the user joins the call audio/video muted. The tracks will be
|
|
1236
|
|
- * added when the user unmutes for the first time.
|
|
1237
|
|
- * @returns {Array<JitsiLocalTrack>} - list of local tracks that are unmuted.
|
|
1238
|
|
- */
|
|
1239
|
|
-JitsiConference.prototype._getInitialLocalTracks = function() {
|
|
1240
|
|
- // Always add the audio track on certain platforms:
|
|
1241
|
|
- // * Safari / WebKit: because of a known issue where audio playout doesn't happen
|
|
1242
|
|
- // if the user joins audio and video muted.
|
|
1243
|
|
- // * React Native: after iOS 15, if a user joins muted they won't be able to unmute.
|
|
1244
|
|
- return this.getLocalTracks()
|
|
1245
|
|
- .filter(track => {
|
|
1246
|
|
- const trackType = track.getType();
|
|
1247
|
|
-
|
|
1248
|
|
- if (trackType === MediaType.AUDIO
|
|
1249
|
|
- && (!(this.isStartAudioMuted() || this.startMutedPolicy.audio)
|
|
1250
|
|
- || browser.isWebKitBased()
|
|
1251
|
|
- || browser.isReactNative())) {
|
|
1252
|
|
- return true;
|
|
1253
|
|
- } else if (trackType === MediaType.VIDEO && !this.isStartVideoMuted() && !this.startMutedPolicy.video) {
|
|
1254
|
|
- return true;
|
|
1255
|
|
- }
|
|
1256
|
|
-
|
|
1257
|
|
- // Remove the track from the conference.
|
|
1258
|
|
- this.onLocalTrackRemoved(track);
|
|
1259
|
|
-
|
|
1260
|
|
- return false;
|
|
1261
|
|
- });
|
|
1262
|
|
-};
|
|
1263
|
|
-
|
|
1264
|
1230
|
/**
|
|
1265
|
1231
|
* Clear JitsiLocalTrack properties and listeners.
|
|
1266
|
1232
|
* @param track the JitsiLocalTrack object.
|
|
|
@@ -1825,6 +1791,31 @@ JitsiConference.prototype.onMemberJoined = function(
|
|
1825
|
1791
|
}
|
|
1826
|
1792
|
|
|
1827
|
1793
|
this._maybeSetSITimeout();
|
|
|
1794
|
+ const { startAudioMuted, startVideoMuted } = this.options.config;
|
|
|
1795
|
+
|
|
|
1796
|
+ // Ignore startAudio/startVideoMuted settings if the media session has already been established.
|
|
|
1797
|
+ // Apply the policy if the number of participants exceeds the startMuted thresholds.
|
|
|
1798
|
+ if ((this.jvbJingleSession && this.getActiveMediaSession() === this.jvbJingleSession)
|
|
|
1799
|
+ || ((typeof startAudioMuted === 'undefined' || startAudioMuted === -1)
|
|
|
1800
|
+ && (typeof startVideoMuted === 'undefined' || startVideoMuted === -1))) {
|
|
|
1801
|
+ return;
|
|
|
1802
|
+ }
|
|
|
1803
|
+
|
|
|
1804
|
+ let audioMuted = false;
|
|
|
1805
|
+ let videoMuted = false;
|
|
|
1806
|
+ const numberOfParticipants = this.getParticipantCount();
|
|
|
1807
|
+
|
|
|
1808
|
+ if (numberOfParticipants > this.options.config.startAudioMuted) {
|
|
|
1809
|
+ audioMuted = true;
|
|
|
1810
|
+ }
|
|
|
1811
|
+
|
|
|
1812
|
+ if (numberOfParticipants > this.options.config.startVideoMuted) {
|
|
|
1813
|
+ videoMuted = true;
|
|
|
1814
|
+ }
|
|
|
1815
|
+
|
|
|
1816
|
+ if ((audioMuted && !this.startMutedPolicy.audio) || (videoMuted && !this.startMutedPolicy.video)) {
|
|
|
1817
|
+ this._updateStartMutedPolicy(audioMuted, videoMuted);
|
|
|
1818
|
+ }
|
|
1828
|
1819
|
};
|
|
1829
|
1820
|
|
|
1830
|
1821
|
/* eslint-enable max-params */
|
|
|
@@ -2264,7 +2255,7 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
|
|
2264
|
2255
|
// Open a channel with the videobridge.
|
|
2265
|
2256
|
this._setBridgeChannel(jingleOffer, jingleSession.peerconnection);
|
|
2266
|
2257
|
|
|
2267
|
|
- const localTracks = this._getInitialLocalTracks();
|
|
|
2258
|
+ const localTracks = this.getLocalTracks();
|
|
2268
|
2259
|
|
|
2269
|
2260
|
try {
|
|
2270
|
2261
|
jingleSession.acceptOffer(
|
|
|
@@ -2633,11 +2624,9 @@ JitsiConference.prototype.setStartMutedPolicy = function(policy) {
|
|
2633
|
2624
|
return;
|
|
2634
|
2625
|
}
|
|
2635
|
2626
|
|
|
2636
|
|
- // Do not apply the startMutedPolicy locally on the moderator, the moderator should join with available local
|
|
2637
|
|
- // sources and the policy needs to be applied only on users that join the call after.
|
|
2638
|
|
- // this.startMutedPolicy = policy;
|
|
2639
|
|
- // TODO: to remove using presence for startmuted policy after old clients update
|
|
2640
|
|
- // we keep presence to update UI of old clients
|
|
|
2627
|
+ logger.info(`Setting start muted policy: ${JSON.stringify(policy)} in presence and in conference metadata`);
|
|
|
2628
|
+
|
|
|
2629
|
+ // TODO: to remove using presence for startmuted policy after old clients update to using metadata always.
|
|
2641
|
2630
|
this.room.addOrReplaceInPresence('startmuted', {
|
|
2642
|
2631
|
attributes: {
|
|
2643
|
2632
|
audio: policy.audio,
|
|
|
@@ -2646,9 +2635,6 @@ JitsiConference.prototype.setStartMutedPolicy = function(policy) {
|
|
2646
|
2635
|
}
|
|
2647
|
2636
|
}) && this.room.sendPresence();
|
|
2648
|
2637
|
|
|
2649
|
|
- // we want to ignore applying startMutedPolicy locally when we set it
|
|
2650
|
|
- this._ignoreFirstStartMutedPolicyUpdate = true;
|
|
2651
|
|
-
|
|
2652
|
2638
|
this.getMetadataHandler().setMetadata('startMuted', {
|
|
2653
|
2639
|
audio: policy.audio,
|
|
2654
|
2640
|
video: policy.video
|
|
|
@@ -2662,9 +2648,8 @@ JitsiConference.prototype.setStartMutedPolicy = function(policy) {
|
|
2662
|
2648
|
* @param {boolean} video if video should be muted.
|
|
2663
|
2649
|
*/
|
|
2664
|
2650
|
JitsiConference.prototype._updateStartMutedPolicy = function(audio, video) {
|
|
2665
|
|
- if (this._ignoreFirstStartMutedPolicyUpdate) {
|
|
2666
|
|
- this._ignoreFirstStartMutedPolicyUpdate = false;
|
|
2667
|
|
-
|
|
|
2651
|
+ // Update the start muted policy for the conference only if the meta data is received before conference join.
|
|
|
2652
|
+ if (this.isJoined()) {
|
|
2668
|
2653
|
return;
|
|
2669
|
2654
|
}
|
|
2670
|
2655
|
|
|
|
@@ -2696,20 +2681,6 @@ JitsiConference.prototype.getStartMutedPolicy = function() {
|
|
2696
|
2681
|
return this.startMutedPolicy;
|
|
2697
|
2682
|
};
|
|
2698
|
2683
|
|
|
2699
|
|
-/**
|
|
2700
|
|
- * Check if audio is muted on join.
|
|
2701
|
|
- */
|
|
2702
|
|
-JitsiConference.prototype.isStartAudioMuted = function() {
|
|
2703
|
|
- return this.startAudioMuted;
|
|
2704
|
|
-};
|
|
2705
|
|
-
|
|
2706
|
|
-/**
|
|
2707
|
|
- * Check if video is muted on join.
|
|
2708
|
|
- */
|
|
2709
|
|
-JitsiConference.prototype.isStartVideoMuted = function() {
|
|
2710
|
|
- return this.startVideoMuted;
|
|
2711
|
|
-};
|
|
2712
|
|
-
|
|
2713
|
2684
|
/**
|
|
2714
|
2685
|
* Returns measured connectionTimes.
|
|
2715
|
2686
|
*/
|