livekit / client-sdk-flutter

Flutter Client SDK for LiveKit

Home Page:https://docs.livekit.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows Communication Detection Caused System Volume to be Lowered Significantly

KiriRainCat opened this issue · comments

Describe the bug
When voice chat started, on Windows, the system volume is lowered by 80%. Although, this can be solved by asking the user to manually change the setting, but this wasn't the proper approach.

To Reproduce
Publish a microphone track via room.localParticipant?.setMicrophoneEnabled(true);

Expected behavior
The Windows' system volume shouldn't be lowered when microphone track is published.

Platform information

  • Flutter version: 3.21.0-1.0.pre.2
  • Plugin version: 2.1.2
  • OS: Windows
  • OS version: Windows 11 (10.0.22631)

Manually fixed by using the package win32_registry to set the DWORD key UserDuckingPreference to 3 under the path 计算机\HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Audio

const String keyPath = r"Software\Microsoft\Multimedia\Audio";
final RegistryKey key = Registry.openPath(
  RegistryHive.currentUser,
  path: keyPath,
  desiredAccessRights: AccessRights.allAccess,
);

if (key.getValueAsInt("UserDuckingPreference") == 3) return;
key.createValue(const RegistryValue("UserDuckingPreference", RegistryValueType.int32, 3));
key.close();