MediaControl.SoundLevelChanged | soundlevelchanged event

Applies to Windows only

[MediaControl may be altered or unavailable for releases after Windows 8.1. Instead, use SystemMediaTransportControls.]

Event raised when the sound level changes.


function onSoundLevelChanged(eventArgs) { /* Your code */ }
// addEventListener syntax
mediaControl.addEventListener("soundlevelchanged", onSoundLevelChanged);
mediaControl.removeEventListener("soundlevelchanged", onSoundLevelChanged);
- or -

mediaControl.onsoundlevelchanged = onSoundLevelChanged;

Event information

DelegateEventHandler [JavaScript] | System.EventHandler<Object> [.NET] | Windows.Foundation.EventHandler<Object> [C++]


Here is a JavaScript code snippet that shows how to add event listeners to a MediaControl object. It then shows how to write code to handle some of those events. The code snippet assumes that there is a corresponding HTML file that contains an <audio> tag, with its element ID set to "audiotag."

// Assign the Windows.Media.MediaControl button object to 
// the user-defined mediaControls variable
mediaControls = Windows.Media.MediaControl;

// Add event listeners for the buttons
mediaControls.addEventListener(“PlayPressed”, play, false);
mediaControls.addEventListener(“PausePressed”, pause, false);
mediaControls.addEventListener(“PlayPauseTogglePressed”, playpausetoggle, false);
mediaControls.addEventListener(“NextTrackPressed”, nexttrack, false);
mediaControls.addEventListener(“PreviousTrackPressed”, previoustrack, false);
mediaControls.addEventListener(“SoundLevelChanged”, soundlevelchanged, false);

// Add code for event handlers for the events
   function play() {

   function pause() {

   function playpausetoggle() {
      //<code goes here to handle the PlayPauseToggle event> 
   // Additional code to handle the other events
   // For example, add event handler code for the following events:
   // NextTrackPressed
   // PreviousTrackPressed
   // SoundLevelChanged

To see the complete listing for this example, see How to configure keys for media controls.


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

None supported

End of client support

Windows 8.1

End of server support

Windows Server 2012 R2


Windows::Media [C++]



See also

How to configure keys for media controls



© 2015 Microsoft