Saving Content

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

By using this SDK, an application can save downloaded or streamed content to the user's local computer, by calling the IWMReaderAdvanced2::SaveFileAs method on the reader object. For streamed content, the server must be using Fast Cache streaming, which is described in the section Enabling Fast Cache Streaming from the Client. For streamed content, the SaveFileAs method creates an ASX file that points to an ASF file containing the saved content. If the reader object is streaming a server-side playlist, each entry is saved as a separate ASF file, and the ASX file points to each of the ASF files. For downloaded content, the SaveFileAs method simply creates an ASF file.

To save content to a local file, do the following:

  1. Call IWMReader::Open with the URL. Open is an asynchronous call, and returns immediately. Wait for the operation to complete, as described in To Create a Reader and Open a File.
  2. Query the reader object for the IWMReaderAdvanced4 interface.
  3. Check whether the content can be saved by calling the IWMReaderAdvanced4::CanSaveFileAs method. If the method returns False, the content cannot be saved locally. Otherwise, proceed to step 4.
  4. Call the IWMReaderAdvanced4::IsUsingFastCache method to determine whether the server is using Fast Cache streaming.
  5. Call the IWMReaderAdvanced2::SaveFileAs with a file name for the local file. If the IsUsingFastCache method returned True, give the file name an .asx extension. Otherwise, give the file name an .asf, .wma, or .wmv extension.

The application can cancel the save operation while it is in progress, by calling the IWMReaderAdvanced4::CancelSaveFileAs method.

The saved content might be protected with DRM, so it may not be possible to play the file on another computer. For more information on content protection, see Digital Rights Management Features.

IWMReader Interface

IWMReaderAdvanced2 Interface