Windows Media Player 11 SDK Logging Stream Data 

Windows Media Player SDK banner art

Logging Stream Data

Logged information can be acquired and used to determine viewer behavior, for example, how often a stream is viewed, or if a specific user viewed a stream and for how long at what quality.

Logging information is automatically sent to the server from which the playlist originated. You can also send logging information to additional servers, including Web servers you use exclusively for logging. To do this, use the LOGURL element, specifying a valid URL for the HREF attribute. You can include LOGURL elements as children of the ASX element and as children of individual ENTRY elements. When the playlist is first opened, logging information is sent to the origin server and to each URL specified in LOGURL children of the ASX element. Then, as each entry is reached, logging information specific to that entry is sent to each URL specified in LOGURL children of the ENTRY element.

The Windows Media Format SDK supports the LOGURL element through the IWMSReaderNetworkConfig interface and the following methods:

HRESULT AddLoggingUrl(LPCWSTR pwszUrl);
HRESULT GetLoggingUrl(DWORD dwIndex, LPCWSTR pwszUrl, DWORD *pcchUrl);
HRESULT GetLoggingUrlCount(DWORD *pdwUrlCount);
HRESULT ResetLoggingUrlList();

In addition to the information that is automatically logged, a metafile playlist can log custom information through the use of the PARAM element. To use the PARAM element in this way, set the NAME attribute to "log:" followed by a log field name and an optional XML namespace separated from the field name by another colon (":"). Everything after the second colon is treated as a namespace, so the field name should not contain a colon.

The log field specified in the NAME attribute is set to the value of the VALUE attribute. If the log does not already contain a field with the specified name, it will be added.

Example Code

<ASX version="3.0">
  <LOGURL href="" />
    <REF href="mms://" />
    <LOGURL href="" />
    <LOGURL href="" />
    <PARAM name="log:cs-media-role" value="Advertisement"/>
    <PARAM name="log:cs-media-name:namespace" value="Music"/>
    <REF href=rtsp://"/>
    <REF href="mms://"/>

See Also