IWMSPlaylist.CueStream (C#)

The CueStream method prepares the next stream in the queue.

Playlist.CueStream(
  IXMLDOMElement  pPlaylistEntry
);

Arguments

pPlaylistEntry

[in] IXMLDOMElement containing a playlist element.

Return Value

This method does not return a value.

If this method fails, it throws an exception.

Number

Meaning

0xC00D14B4L

Indicates that pPlaylistEntry is already playing.

0xC00D14B7L

Indicates that pPlaylistEntry is not a media element.

Remarks

The IWMSPlaylist.get_IsStreamCued property can be used to determine whether the stream was successfully cued. The get_IsStreamCued property retrieves a Boolean value indicating whether a specific playlist element has been initialized and is ready to stream. This method is asynchronous, so an immediate call to get_IsStreamCued may return false even though CueStream returned S_OK. To be notified when the stream is actually cued, the application can catch the WMS_EVENT_PLAYLIST_CUE event.

Example

using interop_msxml;
using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer          Server;
IWMSPlayers        Players;
IWMSPlayer         Player;
IWMSPlaylist       Playlist;
IXMLDOMElement     PlaylistEntry;

bool               bVal;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSPlayers object.
    Players = Server.Players;

    // Retrieve information about each requested playlist.
    for (int i = 0; i < Players.Count; i++)
    {
        Player = Players[i];

        // Retrieve the playlist that was requested
        // by the client, if one exists.
        Playlist = Player.RequestedPlaylist;

        // Retrieve information about the current playlist entry.
        PlaylistEntry = Playlist.CurrentPlaylistEntry;

        // Retrieve the next playlist entry.
        PlaylistEntry = Playlist.get_CallerEntry(PlaylistEntry);

        // Retrieve information about each playlist entry.
        while (PlaylistEntry != null)
        {
            // Retrieve a Boolean value indicating whether this
            // playlist entry is cued.
            bVal = Playlist.get_IsStreamCued(PlaylistEntry);

            // Cue the playlist entry if it is not yet cued.
            if (bVal == false)
            {
                Playlist.CueStream (PlaylistEntry);
            }

            PlaylistEntry = Playlist.get_CallerEntry(PlaylistEntry);
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

Requirements

Reference: Add a reference to Microsoft.WindowsMediaServices

Namespace: Microsoft.WindowsMediaServices.Interop

Assembly: Microsoft.WindowsMediaServices.dll

Library: WMSServerTypeLib.dll

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