IWMSPlayer.ID (C#)
Previous | Next |
IWMSPlayer.ID (C#)
The ID property retrieves a unique value identifying a player that is receiving content from the server.
Syntax
int = IWMSPlayer.ID;
Property Value
int containing the ID.
Remarks
This property is read-only. This is not the same as a player's GUID. If a client uses multiple instances of a specific version of the player to connect to the server, each connection to the server by one of the instances of the player will have a unique session ID. However, the client GUID will be the same for all instances of the player.
Also, the ID number for each connection is based on the total amount of clients connected to the server since Windows Media Services was started. For example, if three clients connected to the server after the service starts, they would have ID numbers from one to three. If they disconnect from the server and another client connects to the server, it would have an ID number of four.
Example Code
using Microsoft.WindowsMediaServices.Interop; using System.Runtime.InteropServices; // Declare variables. WMSServer Server; IWMSPlayers Players; IWMSPlayer Player; int iValue; 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 ID of the client. iValue = Player.ID; } } 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 |