CdromCollection.item method

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The item method retrieves the Cdrom object at the given index.

Syntax

retVal = CdromCollection.item(
  index
)

Parameters

index [in]

Number (long) containing the index.

Return value

This method returns a Cdrom object.

Remarks

To use this method, read access to the library is required. For more information, see Library Access.

Windows Media Player 10 Mobile: This method is not supported.

Examples

The following JScript example uses CdromCollection.item to print the playlist name from each CD available on the computer. If the drive actually contains DVD content, Windows XP or later is required. An HTML TextArea element was created with ID = "playlists". The Player object was created with ID = "Player".

// Create an array to store the CD playlists.
var cdPlaylists = new Array();

// Loop through the available CD drives.
for (var i = 0; i < Player.cdromCollection.count; i++){

     // Fill the cdPlaylists array with playlist objects.
     cdPlaylists[i] = Player.cdromCollection.item(i).Playlist;

     // Print each drive specifier.
     playlists.value+=Player.cdromCollection.item(i).driveSpecifier + " ";

     // Print the name of each CD playlist to the text area.
     playlists.value += cdPlaylists[i].name + "\n";
}

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Cdrom.driveSpecifier

CdromCollection Object

CdromCollection.count

Playlist.name

Settings.mediaAccessRights

Settings.requestMediaAccessRights