如何在 Windows 11 22H2 的应用程序中支持呼叫静音(通用静音)?

cit*_*lao 3 windows windows-runtime windows-11

Windows 22H2 引入了一个新的热键(Win+Alt+K[请参阅“Windows 徽标键快捷方式”下的Windows 中的键盘快捷方式])来使呼叫静音。对应任务栏中的UI:

任务栏中的麦克风使用按钮

当我使用 Teams 时它有效,但当我使用 Mumble 时它不起作用:

没有支持用于麦克风静音的应用程序

快捷方式指南表明它在 Windows 11 22H2 中适用于支持“呼叫静音”的应用程序:

在支持呼叫静音的应用程序中切换麦克风静音。从 Windows 11 版本 22H2 开始可用。

我需要使用哪些 API 才能支持这个新热键?

免责声明:我在微软工作。

cit*_*lao 6

要在您自己的应用程序中支持通用静音按钮,需要执行 2 个步骤:

  1. VoipPhoneCall使用 .创建一个新的VoipCallCoordinator
  2. 当您的应用程序响应静音/取消静音时,处理VoipCallCoordinator.MuteStateChanged事件并触发相应的NotifyMuted或函数。NotifyUnmuted

例如:

using Windows.ApplicationModel.Calls;

var coordinator = VoipCallCoordinator.GetDefault();
coordinator.MuteStateChanged += (e, args) => {
    Console.WriteLine($"Mute changed! - {args.Muted}");

    // Respond that the app has muted/unmuted.
    if (args.Muted) {
        coordinator.NotifyMuted();
    } else {
        coordinator.NotifyUnmuted();
    }
};

// No change until you press enter here:
Console.WriteLine("Press Enter to 'start' a call. Ctrl-C to exit.");
Console.ReadLine();

var call = coordinator.RequestNewOutgoingCall("context_link_todo", "Satya Nadella", "DummyPhone", VoipPhoneCallMedia.Audio);
call.NotifyCallActive();

// Win-Alt-K will display your app muted/unmuted until you press enter:
Console.WriteLine("Press Enter to 'end' the call.");
Console.ReadLine();
call.NotifyCallEnded();
Run Code Online (Sandbox Code Playgroud)

有关完整的 C# 演示,请参阅https://github.com/citelao/Universal-Mute ;有关实现此功能的插件,请参阅https://github.com/citelao/mumble-universal-mute/releases/tag/v0.0.1为了曼布尔。

麦克风取消静音(DummyPhone)弹出窗口

  • 这真是太好了,现在您可以将此信息发送给制作 Edge 的人员,以便他们可以将其公开在网络上吗? (2认同)