다음을 통해 공유


IWMSPlayer Interface

You can use the IWMSPlayer interface to retrieve properties for a specific player.

In addition to the methods inherited from IDispatch, the IWMSPlayer interface exposes the following methods.

Method

Description

get_ID

Retrieves a unique value that identifies a player that is receiving content from the server.

get_NetworkAddress

Retrieves the network address of the client that is receiving content from the server.

get_Port

Retrieves the port number of the client receiving content from the server.

get_RequestedPlaylist

Retrieves an IWMSPlaylistIWMSPlaylist Interface for the client.

get_RequestedURL

Retrieves the URL that the player used to request a connection.

get_ResolvedURL

Retrieves the URL of the content that is being streamed to the player.

get_Status

Retrieves the status of the player.

get_UserName

Retrieves the name of the authenticated player.

get_WrapperPlaylist

Retrieves a wrapper playlist object.

Note

   If you call the Release method of an IWMSPlayer interface on which the associated client connection is using an HTTP connection, it can cause the server to indicate the client status as disconnected for a minute or two, although the client will continue to stream content. This is expected behavior, caused by the nature of the HTTP/1.0 protocol.

Example

The following example illustrates how to retrieve a pointer to an IWMSPlayer interface

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

// Declare variables and interfaces.
IWMSServer      *pServer;
IWMSPlayers     *pPlayers;
IWMSPlayer      *pPlayer;

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 client connection.
for (long x = 0; x < lCount; x++)
{
    varIndex = x;
    hr = pPlayers->get_Item(varIndex, &pPlayer);
    if (FAILED(hr)) goto EXIT;

    // Release temporary COM objects.
    pPlayer->Release();
}

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

See Also

Reference

IWMSPlayers Interface

Concepts

Server Object Model Interfaces (C++)