MediaPlayer.AudioStateMonitor MediaPlayer.AudioStateMonitor MediaPlayer.AudioStateMonitor MediaPlayer.AudioStateMonitor MediaPlayer.AudioStateMonitor Property

Definition

Gets an AudioStateMonitor object that allows a UWP app to determine if any of the app's audio streams are currently being muted or having their volume reduced by the system.

public : AudioStateMonitor AudioStateMonitor { get; }
AudioStateMonitor AudioStateMonitor();
public AudioStateMonitor AudioStateMonitor { get; }
Public ReadOnly Property AudioStateMonitor As AudioStateMonitor
var audioStateMonitor = mediaPlayer.audioStateMonitor;

Property Value

Additional features and requirements

Device family
Windows 10, version 1803 (introduced v10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v6)

Remarks

Windows dynamically mutes or lowers the level of audio streams in response to system events. For example, the volume of a podcast app's audio render stream may be lowered while an alarm is ringing. AudioStateMonitor allows apps to respond to changes in the level of their audio streams. For example, a podcast app may choose to pause playback when the sound level is lowered by the system and then resume playback when the volume level returns to normal.

Use the AudioStateMonitor.SoundLevel property to determine the current sound level of the MediaPlayer. Register a handler for the SoundLevelChanged event to receive notifications when the sound level of the MediaPlayer changes, and then check the SoundLevel property to determine the new current audio level.