MediaControl Class

[Es posible que MediaControl se haya modificado o que no esté disponible para versiones posteriores a Windows 8.1. En su lugar, use SystemMediaTransportControls.]

Describe el objeto con el que se registran las aplicaciones para recibir el foco multimedia y notificaciones de control de transporte.

Sintaxis


var mediaControl = Windows.Media.MediaControl;

Atributos

[Deprecated()]
[MarshalingBehavior(Agile)]
[Threading(MTA)]
[Version(0x06020000)]

Members

A continuación se indican los tipos de miembros de MediaControl (Clase):

Eventos

A continuación se indican los eventos de MediaControl (Clase).

EventoDescripción
ChannelDownPressed Event raised when a ChannelDown command is issued to the application.
ChannelUpPressed Event raised when a ChannelUp command is issued to the application.
FastForwardPressed Event raised when a FastForward command is issued to the application.
NextTrackPressed Event raised when a NextTrack command is issued to the application.
PausePressed Event raised when a Pause command is issued to the application.
PlayPauseTogglePressed Event raised when a PlayPauseToggle command is issued to the application.
PlayPressed Event raised when a Play command is issued to the application.
PreviousTrackPressed Event raised when a PreviousTrack command is issued to the application.
RecordPressed Event raised when a Record command is issued to the application.
RewindPressed Event raised when a Rewind command is issued to the application.
SoundLevelChanged Event raised when the sound level changes.
StopPressed Event raised when a Stop command is issued to the application.

 

Métodos

The MediaControl Clase hereda métodos de Object Clase (C#/VB/C++).

Propiedades

MediaControlClase tiene estas propiedades.

PropiedadTipo de accesoDescripción

AlbumArt

Lectura/escrituraGets or sets the path to the artwork for the album cover.

ArtistName

Lectura/escrituraGets or sets the name of the artist.

IsPlaying

Lectura/escrituraGets or sets the state of the Play button.

SoundLevel

De sólo lecturaGets the current sound level.

TrackName

Lectura/escrituraGets or sets the track name.

 

Comentarios

La clase MediaControl proporciona acceso a los eventos de presionar botón. Estos eventos se pueden supervisar y pueden modificar la respuesta y el comportamiento de una aplicación para audio. A continuación se muestra un fragmento de código JavaScript que muestra cómo agregar agentes de escucha de eventos a un objeto MediaControl. A continuación muestra cómo escribir código para controlar esos eventos.


// 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


Para ver la lista completa de este ejemplo, vea el tema sobre cómo configurar claves para controles multimedia.

Requisitos

Cliente mínimo admitido

Windows 8 [Solo aplicaciones de la Tienda Windows]

Servidor mínimo admitido

Windows Server 2012 [Solo aplicaciones de la Tienda Windows]

Final del soporte del cliente

Windows 8.1

Final del soporte de servidor

Windows Server 2012 R2

Espacio de nombres

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

Metadatos

Windows.winmd

Vea también

Cómo configurar claves para controles multimedia

 

 

Mostrar:
© 2015 Microsoft