Partager via


DownloadCollection.startDownload 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.]

Note

This section describes functionality designed for use by online stores. Use of this functionality outside the context of an online store is not supported.

The startDownload method queues a download.

Syntax

retVal = DownloadCollection.startDownload(
  sourceURL,
  type
)

Parameters

sourceURL [in]

String specifying the URL of the download.

type [in]

String specifying the type of download. Contains one of the following values.

Value Description
background (Windows XP and later.) The download occurs as a background process as processor time becomes available. Download states persist even when Windows Media Player or Windows XP is shut down.
real time (All supported operating systems.) The download occurs all at once. No download states persist between sessions.

Return value

This method returns a DownloadItem object.

Remarks

When a new download is started, Download Manager adds it as an item to the download collection that initiated the download.

Only the following digital media formats can be downloaded:

  • Advanced Systems Format (ASF)
  • MP3
  • Windows Media Audio (WMA)
  • Windows Media Video (WMV)

The sourceURL parameter does not support Unicode-encoded strings. It must point to valid content. Redirects are not supported.

When using Windows XP, audio files are automatically placed into appropriate My Music subfolders based upon file-level metadata values. Video files are placed into \My Music\download\random number\type, where random number is a random value generated by Windows Media Player for each user, and type is either "real time" or "background", depending upon the download type.

When using Windows Media Player 9 Series with Windows 98 and Windows Millennium Edition (ME), audio and video files are placed into \My Music\download\random number\type, where random number is a random value generated by the Player for each user, and type is either "real time" or "background", depending upon the download type.

Note that files may be renamed based upon metadata attributes contained in the file and rules specified by the user in the Options dialog box. Files that don't contain metadata, such as Album or Artist, may be moved to folders labeled Unknown Artist or Unknown Album.

Requirements

Requirement Value
Version
Windows Media Player 9 Series or later
DLL
Wmp.dll

See also

DownloadCollection Object

DownloadItem Object