user9921008
user9921008

Reputation:

Mute windows 10 master volume using C# in .NET Core or UWP

Anyone know how to programmatically mute the Windows 10 Volume using C# in .NET Core or in Universal Windows platform. I searched a lot but couldn't find any straight forward standard API for this in .NET Core for windows UWP Apps.

Upvotes: 6

Views: 1409

Answers (1)

André B
André B

Reputation: 1709

Specifically about UWP, the following links might be of some value to you:

However as the links's description might indicate, it only explains how we can control the sound inside the application, either by controlling the integrated sound system in UWP, or the audio in a control such as MediaPlayer.

For instance, imagining that it isn't desired to have any kind off sound in an UWP app, we could perform the following set:

ElementSoundPlayer.State = ElementSoundPlayerState.Off;

However, when it comes to actually override the System's Volume, that does not seem possible. As it is mentioned in the documentation, the app's sound can't get any louder than the system's sound. In this example,

ElementSoundPlayer.Volume = 1.0;

The Volume property has been set to it's maximum value, but that only means that the sound volume will be the same as the system's volume.

The API does not seem to provide a way to directly change the System's Volume. It's all about the ecosystem of the app itself being managed by the system and not the opposite.

Upvotes: 1

Related Questions