0 out of 1 rated this helpful - Rate this topic

MediaControl.SoundLevelChanged | soundlevelchanged event

Event raised when the sound level changes.

Syntax


public:
static event EventHandler<object>^ SoundLevelChanged {
   Windows::Foundation::EventRegistrationToken add(EventHandler<object>^ value);
   void remove(Windows::Foundation::EventRegistrationToken token);
}

Event information

Delegate EventHandler(Object)

Remarks

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() {
	     document.getElementById(“audiotag”).play();
   }

   function pause() {
	     document.getElementById(“audiotag”).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.

Requirements

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Namespace

Windows.Media
Windows::Media [C++]

Metadata

Windows.winmd

See also

How to configure keys for media controls
MediaControl

 

 

Build date: 12/4/2012

© 2013 Microsoft. All rights reserved.