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

Disable microphone while muted #1329

Open
1 of 3 tasks
szechyjs opened this issue Apr 27, 2024 · 6 comments · Fixed by #1335
Open
1 of 3 tasks

Disable microphone while muted #1329

szechyjs opened this issue Apr 27, 2024 · 6 comments · Fixed by #1335
Assignees
Labels
enhancement New feature or request react-native React Native SDK issues

Comments

@szechyjs
Copy link

Which package/packages do you use?

  • @stream-io/video-react-sdk
  • @stream-io/video-react-native-sdk
  • @stream-io/video-client

Describe the solution you'd like
Currently when the microphone is muted via micrphone.disable() it just disables the track/stream. However, the microphone is still enabled on the device and is actively listening, I believe this is to support the SpeakingWhileMutedDetection. It would be nice if it was possible to truly disable the microphone while muted, this is particularly useful in a PTT type of application. Without this our users see the microphone privacy/notification constantly active on their device, even though they muted (not pushing PTT).

@szechyjs szechyjs added the enhancement New feature or request label Apr 27, 2024
@oliverlaz
Copy link
Member

hi @szechyjs, thanks for reporting this. Your assumption is correct, we use the mic for the speaking-while-muted notification.
It is an already known issue, and we will fix it soon.

@oliverlaz oliverlaz self-assigned this Apr 29, 2024
oliverlaz added a commit that referenced this issue May 3, 2024
A joint PR that fixes a couple of related issues:
- Adds an API that disables speaking while muted notifications - fixes #1329
- The selected device can't be reliably detected when audio or video filters are used
- Audio tracks are now stopped (instead of disabled) on the Web - this should release the mic allocation
- Fixed an issue in `usePersistedDevicePreferences()` where the camera and mic were automatically enabled after a call had been left
- Pronto and Video Demo now remember the last used video filter and they enable it automatically
@oliverlaz
Copy link
Member

oliverlaz commented May 3, 2024

hi @szechyjs, we have just released a new SDK version that exposes the following APIs:

  • call.microphone.disableSpeakingWhileMutedNotification()
  • call.microphone.enableSpeakingWhileMutedNotification()

Docs: https://getstream.io/video/docs/reactnative/core/camera-and-microphone/#speaking-while-muted-detection

@szechyjs
Copy link
Author

szechyjs commented May 3, 2024

Thanks for the update. However, it seems that the microphone in use alert still displays in Android, even after setting call.microphone.disableSpeakingWhileMutedNotification();

edit: here is a rough example...

const call = client.call('ptt', 'foo');
call.microphone.disableSpeakingWhileMutedNotification();

return (
  <StreamVideo client={client}>
    <StreamCall call={call} mediaDeviceInitialState={{ initialAudioEnabled: false }}>
      <PTT />
    </StreamCall>
  </StreamVideo>
);

// ptt.tsx
const { microphone, isMute } = useMicrophoneState();

const ptt = async () => {
  // on initial load of component, there is no mic alert until pressed as expected
  await microphone.enable();
};

const pttEnd = async () => {
  if (!isMute) {
    // setting to disabled does not cause the mic alert to go away
    await microphone.disable();
  }
};

return (
  <FAB
    onPressIn={ptt}
    onPressOut={pttEnd}
  />
);

I wonder if it's related to: #1335 (comment)

@oliverlaz
Copy link
Member

hi @szechyjs,

Yes, the behavior you are describing is related to the linked comment. I didn't want to change the existing behavior for React Native as I wasn't sure about the impact. We will for sure revisit this change.

In the meantime, I'll re-open this issue.

@oliverlaz oliverlaz reopened this May 3, 2024
@oliverlaz oliverlaz added the react-native React Native SDK issues label May 3, 2024
@szechyjs
Copy link
Author

szechyjs commented May 4, 2024

I tried using microphone.disable(true) which should have the same effect as the disableMode: 'stop-track' and the microphone privacy indicator still remains. I'm guessing there is something else that is causing this on Android.

@oliverlaz
Copy link
Member

hi @szechyjs, getting back to this. disable(true) should stop the tracks completely as you already described.
@santhoshvai, can you check if there is something that still keeps the mic streams active on Android?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request react-native React Native SDK issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants