Método MediaCollection.getByName

[La característica asociada a esta página, Reproductor multimedia de Windows SDK, es una característica heredada. Se ha reemplazado por MediaPlayer. MediaPlayer se ha optimizado para Windows 10 y Windows 11. Microsoft recomienda encarecidamente que el nuevo código use MediaPlayer en lugar de Reproductor multimedia de Windows SDK, siempre que sea posible. Microsoft sugiere que el código existente que usa las API heredadas se reescriba para usar las nuevas API si es posible.

El método getByName recupera una lista de reproducción de los elementos multimedia con el nombre especificado.

Sintaxis

retVal = MediaCollection.getByName(
  name
)

Parámetros

name [in]

Cadena que contiene el nombre.

Valor devuelto

Este método devuelve un objeto Playlist .

Observaciones

Para usar este método, se requiere acceso de lectura a la biblioteca. Para obtener más información, vea Acceso a bibliotecas.

Ejemplos

En el siguiente ejemplo de JScript se usa MediaCollection. getByName para recuperar tres elementos de la biblioteca. A continuación, cada elemento se anexa a la lista de reproducción actual. El objeto Player se creó con ID="Player".

// In each case, use the name exactly as it appears in the library.
// Windows Media Player does not include file name extensions or file paths
// in the name. Internet URLs include the entire path, but not the 
// file name extension.

// Get a playlist object that contains an Internet URL.
var One = Player.mediaCollection.getByName("https://www.proseware.com/Media/Laure");
 
// Get a playlist object that contains a file on a network server.
var Two = Player.mediaCollection.getByName("Jeanne");

// Get a playlist object that contains a file on a local drive.
var Three = Player.mediaCollection.getByName("house");

// Append each item to the current playlist. Since each playlist retrieved
// using getByName contains one digital media item, use Playlist.item with
// an index of zero to reference that item.
Player.currentPlaylist.appendItem(One.item(0));
Player.currentPlaylist.appendItem(Two.item(0));
Player.currentPlaylist.appendItem(Three.item(0));

Requisitos

Requisito Value
Versión
Reproductor multimedia de Windows versión 7.0 o posterior.
Archivo DLL
Wmp.dll

Consulte también

Objeto MediaCollection

Objeto Playlist

Settings.mediaAccessRights

Settings.requestMediaAccessRights