IWMSPlaylist::put_CurrentPlaylistEntry

banner art

Previous Next

IWMSPlaylist::put_CurrentPlaylistEntry

The put_CurrentPlaylistEntry property specifies the server's current position in the playlist.

Syntax

  HRESULT put_CurrentPlaylistEntry(
  
  IXMLDOMElement*
  
  pPlaylistEntry
  
  );

Parameters

pPlaylistEntry

[in] Pointer to an IXMLDOMElement interface.

Return Values

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

Remarks

There are no restrictions on what element the server's position can be changed to. When put_CurrentPlaylistEntry is used to make an element that is not currently on the call stack the current element, all items above its parent element are removed from the call stack.

Unlike the FireEvent method, when this property is used to change the server's current position in the playlist, there are no restrictions on what element the server's current position can be changed to.

When this property is used to set the position of the server in the playlist and the element is currently on the call stack, the server removes all elements above the element on the call stack. If the element is not currently on the call stack, the server removes all elements above its parent element.

  • Note   The CallerEntry property can be used to discover which items are on the playlist call stack.

Example Code

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

// Declare variables and interfaces.
IWMSServer      *pServer;
IWMSPlayers     *pPlayers;
IWMSPlayer      *pPlayer;
IWMSPlaylist    *pPlaylist;
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;
    }
    // Set the current playlist entry to the last entry in 
    // the playlist.
    hr = pPlaylist->put_CurrentPlaylistEntry(pCurPlaylistEntry);
    if (FAILED(hr)) goto EXIT;

    // Release temporary COM objects.
    pPlayer->Release();
    pPlaylist->Release();
    pPlaylistEntry->Release();
    pCurPlaylistENtry->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.

See Also

Previous Next