MediaCollection.getByAuthor 方法

[與此頁面相關聯的功能Windows 媒體播放機 SDK是舊版功能。 它已被 MediaPlayer 取代MediaPlayer已針對Windows 10和Windows 11進行優化。 Microsoft 強烈建議新程式碼盡可能使用MediaPlayer,而不是Windows 媒體播放機 SDK。 Microsoft 建議盡可能重寫使用舊版 API 的現有程式碼,以使用新的 API。]

getByAuthor方法會擷取指定作者的媒體專案播放清單。

語法

retVal = MediaCollection.getByAuthor(
  author
)

參數

作者 [in]

包含作者名稱的字串

傳回值

這個方法會傳回 Playlist 物件。

備註

若要使用此方法,需要程式庫的讀取權限。 如需詳細資訊,請參閱 程式庫存取

範例

下列 JScript 範例使用 MediaCollectiongetByAuthor 可擷取媒體專案的播放清單。 播放清單包含符合使用者在名為 GetAuthor 之 HTML TEXT 輸入元素中指定作者的專案。 Player物件是以 ID = 「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