IWMSActiveMedia.Live (Visual Basic .NET)

banner art

Previous Next

IWMSActiveMedia.Live (Visual Basic .NET)

The Live property retrieves a Boolean value that indicates whether the media element originates from a live source.

Syntax

  Boolean = IWMSActiveMedia.Live

Property Value

A Boolean that indicates whether the media element is live.

Remarks

This property is read-only. Windows Media Player for Windows XP and later client versions will return this property correctly; however older client versions will always report content as being live.

Example Code

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

Private Sub IsLive()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Players As IWMSPlayers
    Dim Player As IWMSPlayer
    Dim Playlist As IWMSPlaylist
    Dim ActiveMedia As IWMSActiveMedia

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

    ' Retrieve the IWMSPlayers object.
    Players = Server.Players

    ' If players are connected, retrieve first IWMSPlayer object
    ' in the IWMSPlayers collection.
    If Server.Players.Count > 0 Then
        Player = Server.Players.Item(0)
    End If

    ' 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 Not Playlist Is Nothing Then

        ' Retrieve the IWMSActiveMedia object.
        ActiveMedia = Playlist.CurrentMediaInformation

        ' Retrieve a Boolean value indicating whether the stream is live.
        If ActiveMedia.Live = True Then

            ' TODO: Handle any live stream specific tasks here.
        End If

    End If

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

End Sub

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