IWMSActiveStream Object (C#)

The IWMSActiveStream object contains information about specific audio and video streams in the active media element. The IWMSActiveMediaIWMSActiveMedia Object (C#) provides information about the active element.

The IWMSActiveStream object exposes the following properties.

Property

Description

BitRate

Retrieves the maximum bit rate of a stream.

Name

Retrieves the stream name.

Type

Retrieves an enumeration value that indicates whether the stream is audio or video.

Example

The following example illustrates how to retrieve an IWMSActiveStream object.

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

// Declare variables.
WMSServer          Server;
IWMSActiveMedia    ActiveMedia;
IWMSActiveStreams  ActiveStreams;
IWMSActiveStream   ActiveStream;
IWMSPlayers        Players;
IWMSPlayer         Player;
IWMSPlaylist       Playlist;

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

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

    // If players are connected, retrieve first IWMSPlayer object
    // in the IWMSPlayers collection.
    if (Server.Players.Count > 0)
    {
        Player = Server.Players[0];

        // Retrieve the IWMSPlaylist object for the player.
        // NOTE: A valid playlist file is not always returned.
        // This may be the case, for example, if the user requested
        // a specific content file or if a broadcast publishing point
        // is being used.
        Playlist = Player.RequestedPlaylist;

        if (Playlist != null)
        {
            // Retrieve the IWMSActiveMedia object.
            ActiveMedia = Playlist.CurrentMediaInformation;

            // Retrieve the IWMSActiveStreams object.
            ActiveStreams = ActiveMedia.Streams;

            // Retrieve information about each active stream.
            for (int i = 0; i < ActiveStreams.Count; i++)
            {
                // Retrieve the IWMSActiveStream object.
                ActiveStream = ActiveStreams[i];
            }
        }
    }
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Reference

IWMSActiveMedia Object (C#)

IWMSActiveStreams Object (C#)

Concepts

Server Object Model (C#)