IWMSPlayer.Status (C#)

banner art

Previous Next

IWMSPlayer.Status (C#)

The Status property retrieves the status of the player.

Syntax

  WMS_CLIENT_STATUS = IWMSPlayer.Status;

Property Value

A member of a WMS_CLIENT_STATUS enumeration type that indicates the status of the player. This must be one of the following values.

Value Description
WMS_CLIENT_DISCONNECTED The player has been disconnected.
WMS_CLIENT_IDLE The player is connected to the server but no content is being streamed.
WMS_CLIENT_OPEN The player is connected to the server and a resource has been opened to stream. Players that send a pause or stop command also have this status.
WMS_CLIENT_STREAMING The player is connected to the server and content is being streamed.

Remarks

This property is read-only. If a client has been disconnected, you can use the IWMSPlayers.Refresh method to update the IWMSPlayers collection.

Example Code

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

// Declare variables.
WMSServer          Server;
IWMSPlayers        Players;
IWMSPlayer         Player;

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

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

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

        // Retrieve the client status.
        WMS_CLIENT_STATUS pStatus;
        pStatus = Player.Status;

        switch (pStatus)
        {
            case WMS_CLIENT_STATUS.WMS_CLIENT_DISCONNECTED:
                // TODO: Handle disconnected clients.
                break;
            case WMS_CLIENT_STATUS.WMS_CLIENT_IDLE:
                // TODO: Handle idle clients.
                break;
            case WMS_CLIENT_STATUS.WMS_CLIENT_OPEN:
                // TODO: Handle open clients.
                break;
            case WMS_CLIENT_STATUS.WMS_CLIENT_STREAMING:
                // TODO: Handle streaming clients.
                break;
        }
    }
}
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.

See Also

Previous Next