Compartir a través de


Caching and Proxying Server-side Playlists

A Windows Media cache proxy server can cache a playlist unless the upstream server issues an authentication challenge. If the cache plug-in requests that the playlist be cached, the cache proxy server rejects the request. Furthermore, the WMS_DATA_ CONTAINER_VERSION_ALLOW_PROXY_CACHING flag must be set by the upstream server. The flags are stored in a content information context that is downloaded with the content. Your plug-in can retrieve the flags by using the GetCacheFlags method on the IWMSDataContainerVersion interface.

Although a cached playlist can consist of several entries, a Windows Media cache proxy server manages it as if it is a single object. Therefore, the cache proxy server cannot perform a freshness check or receive authentication challenges on a specific playlist entry, but only on the playlist as a whole. If the cache server determines from the freshness check that the playlist is out of date, the entire playlist must be replaced or removed.

When a server is caching a playlist, it will notify the cache plug-in about the progress of each item by calling the OnDownloadContentProgress method on the IWMSCacheProxyServerCallback interface at the beginning and end of each entry. The server indicates that an item has started downloading by sending a WMS_RECORD_PROGRESS_OPCODE of WMS_RECORD_PROGRESS_ARCHIVE_STARTED, and that an item has finished downloading with WMS_RECORD_PROGRESS_ARCHIVE_FINISHED. When all items in the playlist have been cached, the server calls the OnDownloadContentFinished method on the IWMSCacheProxyServerCallback interface. For example, if the server is caching a playlist that contains two items, it will take the following steps:

  1. Call OnDownloadContentProgress and specify WMS_RECORD_PROGRESS_ARCHIVE_STARTED.

  2. Save the first entry in the playlist.

  3. Call OnDownloadContentProgress and specify WMS_RECORD_PROGRESS_ARCHIVE_FINISHED.

  4. Call OnDownloadContentProgress and specify WMS_RECORD_PROGRESS_ARCHIVE_STARTED.

  5. Save the second entry in the playlist.

  6. Call OnDownloadContentProgress and specify WMS_RECORD_PROGRESS_ARCHIVE_FINISHED.

  7. Call OnDownloadContentFinished.

To determine whether the content requested by the client is a server-side playlist, a cache plug-in can call the GetContentInformation method on the IWMSCacheProxyServer interface.

The Windows Media server queries the origin server for information about the requested content and responds to the plug-in by calling the OnGetContentInformation method on the IWMSCacheProxyServerCallback interface.

The server returns a pointer to a cache information context. If the WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE field contains WMS_CACHE_CONTENT_TYPE_PLAYLIST, the content is a playlist.

Note

   The WMS_CACHE_CONTENT_INFORMATION_CONTENT_TYPE field can contain any combination of the flags in the WMS_CACHE_CONTENT_TYPE_FLAGS enumeration type.

See Also (General)

See Also (Visual Basic .NET)

See Also (C#)

See Also (C++)