Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(client): receive audioLevels when joined the call with mic muted #1202

Closed
wants to merge 4 commits into from

Conversation

khushal87
Copy link
Member

@khushal87 khushal87 commented Nov 28, 2023

Client Changes:

  • The muteStream API is changed now to muteOrDestroyStream.
  • The unmuteStream API is changed to unmuteOrCreateStream.
  • We have introduced a disableTrackWhilePublish argument that will not enable the track while publish, which currently happens every time here.

@khushal87 khushal87 changed the title fix(react-native): receive audioLevels when joined the call with mic muted fix(client): receive audioLevels when joined the call with mic muted Nov 28, 2023
@santhoshvai
Copy link
Member

if we have
If there is no stream we create one and publish it first.
do we still need?
// In case of React Native we need to publish the stream everytime to get the audioLevels

const defaultConstraints = this.state.defaultConstraints;
const constraints: MediaTrackConstraints = {
...defaultConstraints,
deviceId: this.state.selectedDevice,
};
stream = await this.getStream(constraints as C);
this.state.setMediaStream(stream);
await this.muteOrDestroyStream(this.state.disableMode === 'stop-tracks');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
await this.muteOrDestroyStream(this.state.disableMode === 'stop-tracks');
await this.muteOrDestroyStream(false);

We always want to just mute the stream here, if we call it with stop-tracks we destroy the stream that we've just created

stream = this.state.mediaStream;
this.unmuteTracks();
} else {
if (!this.state.mediaStream && settings && settings.createMutedStream) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can do this with less copy-paste, and we can remove this whole if statement, see below

...defaultConstraints,
deviceId: this.state.selectedDevice,
};
stream = await this.getStream(constraints as C);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check here if we need to mute

if (settings && settings.createMutedStream) {
  await this.muteOrDestroyStream(false);
}

@khushal87 khushal87 closed this Nov 28, 2023
@oliverlaz oliverlaz deleted the khushal87/initial-mic-issue-fix branch April 23, 2024 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants