citelao
citelao

Reputation: 6056

How do I support Call Mute (Universal Mute) in my app for Windows 11 22H2?

Windows 22H2 introduces a new hotkey (Win+Alt+K [See Keyboard shortcuts in Windows under "Windows Logo Key shortucts"]) to mute calls. It corresponds to this UI in taskbar:

Microphone usage button in taskbar

It works when I use Teams, but not when I use Mumble:

No supported apps in use for mic mute

The shortcuts guide indicates that it's available in Windows 11 22H2 for apps that support "Call Mute":

Toggle microphone mute in apps that support Call Mute. Available starting in Windows 11, version 22H2.

What APIs do I need to consume in order to support this new hotkey?

Disclaimer: I work for Microsoft.

Upvotes: 4

Views: 847

Answers (1)

citelao
citelao

Reputation: 6056

There are 2 steps needed to support the Universal Mute button in your own apps:

  1. Create a new VoipPhoneCall with the VoipCallCoordinator.
  2. Handle the VoipCallCoordinator.MuteStateChanged event and fire the appropriate NotifyMuted or NotifyUnmuted function when your app has muted/unmuted in response.

For example:

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();

See https://github.com/citelao/Universal-Mute for a full C# demo and https://github.com/citelao/mumble-universal-mute/releases/tag/v0.0.1 for a plugin that makes this work for Mumble.

Mic unmuted (DummyPhone) popup

Upvotes: 7

Related Questions