MediaCollection.getByAuthor 方法

[与此页面关联的功能(Windows 媒体播放器 SDK)是旧版功能。 它已被 MediaPlayer 取代。 MediaPlayer 已针对Windows 10和Windows 11进行了优化。 Microsoft 强烈建议新代码尽可能使用 MediaPlayer 而不是 Windows 媒体播放器 SDK。 如果可能,Microsoft 建议重写使用旧 API 的现有代码以使用新 API。]

getByAuthor 方法检索指定作者的媒体项的播放列表。

语法

retVal = MediaCollection.getByAuthor(
  author
)

parameters

author [in]

包含作者姓名的字符串

返回值

此方法返回 一个 Playlist 对象。

备注

若要使用此方法,需要对库的读取访问权限。 有关详细信息,请参阅 库访问

示例

以下 JScript 示例使用 MediaCollectiongetByAuthor 用于检索媒体项的播放列表。 播放列表包含与用户在名为 GetAuthor 的 HTML 文本输入元素中指定的作者匹配的项目。 创建 ID 为“Player”的 Player 对象。

<!-- Use an HTML BUTTON element to create the playlist and play the media items. -->
<INPUT TYPE = "BUTTON"  NAME = "PlayAuthor"  
       ID = "PlayAuthor"  
       VALUE = "Play Author"

onClick = "
    /* Retrieve the author name text from the user. */
    var author = GetAuthor.value;

    /* Create the playlist by using getByAuthor. */
    var pl = Player.mediaCollection.getByAuthor(Author);

    /* Make the new playlist the current playlist. */
    Player.currentPlaylist = pl;

    /* Play the media items in the new playlist. */
               Player.controls.play();
">

要求

要求
版本
Windows 媒体播放器版本 7.0 或更高版本。
DLL
Wmp.dll

另请参阅

MediaCollection 对象

Playlist 对象

Settings.mediaAccessRights

Settings.requestMediaAccessRights