Dela via


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:
 property AudioStateMonitor ^ AudioStateMonitor { AudioStateMonitor ^ get(); };
AudioStateMonitor AudioStateMonitor();
public AudioStateMonitor AudioStateMonitor { get; }
var audioStateMonitor = mediaPlayer.audioStateMonitor;
Public ReadOnly Property AudioStateMonitor As AudioStateMonitor

Property Value

An AudioStateMonitor object.

Windows requirements

Device family
Windows 10, version 1803 (introduced in 10.0.17134.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v6.0)

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.

Applies to