miroslavpejic85 / mirotalk

🚀 WebRTC - P2P - Simple, Secure, Fast Real-Time Video Conferences Up to 4k and 60fps, compatible with all browsers and platforms.
https://p2p.mirotalk.com
GNU Affero General Public License v3.0
2.6k stars 502 forks source link

Alternate audio devices not remembered correctly #208

Closed AtmanActive closed 3 months ago

AtmanActive commented 3 months ago

Bug Report

IMPORTANT: We primarily use GitHub as an issue tracker. Just open an issue here if you have encountered a bug in MiroTalk. If you have ideas, suggestions, questions, doubts about MiroTalk or need support, please use the MiroTalk Forum instead:

👉 https://discord.gg/rgGYfeYW3N

Describe the bug

On windows, for users with several audio cards, p2p.mirotalk.com DOES NOT remember the device choice correctly. On first subsequent start, the screen SHOWS correct device selection but the ACTUAL audio is still routed to default audio device (instead of the one previously chosen). On second start, audio devices selection is back to default, as if someone reset the selection behind our backs.

To reproduce

Steps to reproduce the behavior:

  1. On a windows machine with muliple audio devices, where device A is windows system default and device B is free:
  2. Open any chromium based browser, go to p2p.mirotalk.com.
  3. Choose audio device B as your audio input and output.
  4. Enter the session - everything is working correctly.
  5. Now close the tab/browser and start it again.
  6. Audio device selection screen looks like it remembered your previous choice, so don't touch anything there, just join the session.
  7. No audio! That's because MiroTalk opened audio device A even though it did show that it will open device B.
  8. Close the tab/browser and start it again.
  9. Audio device selection screen shows device A (default) as selected even though the last time you touched those controls you did set it to use device B.

Expected behavior

Once I chose an audio device B as my input and output, I expect MiroTalk to automatically use it each and every time I open that same browser.

Screenshots

If applicable, add screenshots to help explain your problem.

Desktop - Mobile

Please complete the following information:

Additional context

Add any other context about the problem here.

miroslavpejic85 commented 3 months ago

Hi @AtmanActive, Can you please try now? & Thank you!

AtmanActive commented 3 months ago

Hi @miroslavpejic85 ,

Thanks for the quick patch.

Unfortunately, now it is even worse. :-)

Now the UI does show properly the remembered choice but the audio engine completely ignores it.

So:

  1. We set our choice to audio device B
  2. Everything is working as expected.
  3. Close browser, start again
  4. UI showing audio device B
  5. No audio!
  6. Close browser, start again
  7. UI showing audio device B
  8. No audio!
  9. The only way to make it work again is to deliberately switch to audio device A, start session (of course, no audio), close the browser, start again, manually set to device B, and thus we are back to point number 2.

At least before, the UI was showing that something is off, after a few restarts, but now the UI is showing that everything is ok, while in fact, there is no audio.

In other words, it works only the first time we set it to audio device B and never again. Until we rejig the UI controls deliberately to make it work again.

Thanks.

miroslavpejic85 commented 3 months ago

Hi @AtmanActive, you're welcome ;)

Try to clear the cache to see if it resolves the problem. Here are some steps you can take to troubleshoot and potentially resolve the audio issue:

  1. Clear Browser Cache:

    • Clear the browser cache to ensure that there are no conflicting or outdated settings causing the problem.
  2. Check Audio Device Settings:

    • Confirm that the audio device settings in your operating system are correctly configured. Sometimes, issues can arise if there are conflicts or incorrect settings at the system level.
  3. Update Browser and Audio Drivers:

    • Ensure that your browser is up-to-date. An outdated browser version might have compatibility issues.
    • Similarly, make sure that your audio drivers are up-to-date. Check the manufacturer's website for the latest drivers for your audio device.
  4. Try a Different Browser:

    • If the issue persists, try using a different browser to see if the problem is specific to the browser you are currently using.
  5. Check for Browser Extensions:

    • Some browser extensions or add-ons might interfere with audio settings. Disable extensions one by one to identify if any of them are causing the issue.

[!NOTE]

Please note that the selected video and audio devices will be retained if the count of it before and after the modification remains the same. If a device is removed or a new one is added, the default video/audio will be preserved.

Let me know and thank to you.

miroslavpejic85 commented 3 months ago

Please note that the selected video and audio devices will be retained if the count of it before and after the modification remains the same. If a device is removed or a new one is added, the default video/audio will be preserved.

WIP: I want to enhance the logic by checking if the previous selected ID exists rather than comparing the count of devices. If the previous selected ID does not exist, will be selected to the default one.

miroslavpejic85 commented 3 months ago

The issue of switching between video (camera) and audio (microphone) devices while preserving the previous state has been addressed. However, the audio speakers related issue remains unresolved at the moment. As a temporary measure, the system has been reverted to its default state before join room until a resolution is found.

Useful snippets:

miroslavpejic85 commented 3 months ago

Hi @AtmanActive, Should be fixed.

AtmanActive commented 3 months ago

Sorry, I'm bed ridden with fever at the moment, will test it out as soon as I get back on my feet.

Thanks.

miroslavpejic85 commented 3 months ago

I'm sorry to hear that you're not feeling well. Take the time you need to rest and recover.

miroslavpejic85 commented 3 months ago

[!NOTE]

In the audio output (speaker), you will exclusively hear the voices of other participants. If you find yourself alone in the room, you won't perceive any audio. This design intentionally excludes self-auditory feedback, as it lacks practical significance to hear oneself. :)

miroslavpejic85 commented 3 months ago

I'm closing the task now as I've tested it and everything seems to be working correctly to not bother. The alternate audio devices are being remembered as expected. I invite anyone in the future to join our forum and discuss there too. 🙏 Thank you!