IWMSPlaylist::get_NestedPlaylist

The get_NestedPlaylist method retrieves a nested playlist object.

HRESULT get_NestedPlaylist(
  IXMLDOMElement*  pPlaylistEntry,
  IWMSPlaylist**  ppPlaylist
);

Arguments

pPlaylistEntry

[in] Pointer to a playlist entry object.

ppPlaylist

[out] Pointer to a pointer to a new IWMSPlaylistIWMSPlaylist Interface. This method calls AddRef internally. To avoid memory leaks, you must call Release when you are finished using the interface.

Return Value

If the method succeeds, it returns S_OK. If it fails, it returns an HRESULT error code.

Return code

Number

Meaning

E_FAIL

0x80004005

pPlaylistEntry is not a nested playlist.

E_INVALIDARG

0x80070057

pPlaylistEntry or ppPlaylist is a NULL pointer argument.

Remarks

This method gets a nested playlist. If the first parameter of the playlist is not a media element that references a playlist file, or if the media element is not cued or is not the current element, an error code is returned.

The IsStreamCued property can be used to determine whether the media element is cued.

Example Playlist File

In the following playlist, the src attribute for "media2" references another playlist.

<seq>
<media id="media1" src="BumperAd1.asf" />
<media id="media2" src="playlist.wsx" />
<media id="media3" src="BumperAd2.asf"/>
</seq>

The nested playlist (playlist.wsx) contains the following syntax.

<seq>
<media id="nested_media1" src="movie1.asf" />
<media id="nested_media2" src="movie2.asf" />
<media id="nested_media3" src="movie3.asf"/>
</seq>

A short time after the server starts streaming "media1" from the first playlist, it cues "nested_media1" in the nested playlist. At this point, the get_NestedPlaylist method can be used to retrieve an IWMSPlaylist interface for the nested playlist. After the server finishes streaming all of the items in the nested playlist, it returns to the parent playlist and starts streaming "media3". At this point "media2" is no longer cued, and you can no longer use the get_NestedPlaylist method to retrieve an IWMSPlaylist object for it. However, you can always use the CueStream method to re-cue the nested playlist.

Example

#include <windows.h>
#include <atlbase.h>    // Includes CComVariant.
#include "wmsserver.h"

// Declare variables and interfaces.
IWMSServer      *pServer;
IWMSPlayers     *pPlayers;
IWMSPlayer      *pPlayer;
IWMSPlaylist    *pPlaylist;
IWMSPlaylist    *pNestedPlaylist;
IXMLDOMElement  *pCurPlaylistEntry;
IXMLDOMElement  *pPlaylistEntry;

HRESULT         hr;
CComVariant     varIndex;
long            lCount;

// Initialize the COM library and retrieve a pointer
// to an IWMSServer interface.
hr = CoInitialize(NULL);
hr = CoCreateInstance(CLSID_WMSServer,
                      NULL,
                      CLSCTX_ALL,
                      IID_IWMSServer,
                      (void **)&pServer);
if (FAILED(hr)) goto EXIT;

// Retrieve a pointer to an IWMSPlayers interface
// and retrieve the total count of current connections.
hr = pServer->get_Players(&pPlayers);
if (FAILED(hr)) goto EXIT;
hr = pPlayers->get_Count(&lCount);
if (FAILED(hr)) goto EXIT;

// Retrieve information about each requested playlist.
for (long x = 0; x < lCount; x++)
{
    varIndex = x;
    hr = pPlayers->get_Item(varIndex, &pPlayer);
    if (FAILED(hr)) goto EXIT;

    // Retrieve the playlist requested by the client
    // if one exists.
    hr = pPlayer->get_RequestedPlaylist(&pPlaylist);
    if (FAILED(hr)) goto EXIT;

    // Retrieve information about the current playlist entry.
    hr = pPlaylist->get_CurrentPlaylistEntry(&pPlaylistEntry);
    if (FAILED(hr)) goto EXIT;

    // Retrieve information about each playlist entry.
    while (pPlaylistEntry != NULL)
    {
        pCurPlaylistEntry = pPlaylistEntry;

        // Retrieve the next playlist entry.
        hr = pPlaylist->get_CallerEntry(pCurPlaylistEntry,
                                        &pPlaylistEntry);
        if (FAILED(hr)) goto EXIT;

        // Retrieve the nested playlist object if one exists.
        hr = pPlaylist->get_NestedPlaylist(pPlaylistEntry,
                                           &pNestedPlaylist);
        if (FAILED(hr)) goto EXIT;
    }

    // Release temporary COM objects.
    pPlayer->Release();
    pPlaylist->Release();
    pPlaylistEntry->Release();
    pCurPlaylistEntry->Release();
    pNestedPlaylist->Release();
}

EXIT:
    // TODO: Release temporary COM objects and uninitialize COM.

Requirements

Header: wmsserver.h

Library: WMSServerTypeLib.dll

Platform: Windows Server 2003 family, Windows Server 2008 family.