MediaControl.NextTrackPressed | nexttrackpressed event

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

Event raised when a NextTrack command is issued to the application.

Syntax


public static event EventHandler<object> NextTrackPressed

Event information

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

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 (device family)

Device family

Desktop

API contract

Windows.Media.MediaControlContract, introduced version 1.0

Namespace

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

Metadata

Windows.Media.MediaControlContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

None supported

Namespace

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

Metadata

Windows.winmd

See also

How to configure keys for media controls
MediaControl

 

 

Show:
© 2015 Microsoft