IWMSPlayer.ID (Visual Basic .NET)

The ID property retrieves a unique value identifying a player that is receiving content from the server.

Integer = IWMSPlayer.ID

Property Value

Integer containing the player ID.


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 1 to 3. If they disconnect from the server and another client connects to the server, it would have an ID number of 4.


Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices

Private Sub GetID()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Players As IWMSPlayers
    Dim Player As IWMSPlayer
    Dim iValue As Integer

    ' Create the WMSServer object.
    Server = New WMSServer()

    ' Retrieve the IWMSPlayers object.
    Players = Server.Players

    ' Retrieve information about each client connection.
    For Each Player In Players
        ' Retrieve the ID of the client.
        iValue = Player.ID

Catch excCom As COMException
    ' TODO: Handle COM exceptions.
Catch exc As Exception
    ' TODO: Handle errors.
    ' TODO: Clean-up code goes here.
End Try

End Sub


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


IWMSPlayer Object (Visual Basic .NET)