Share via


IWMSActiveStream.Type (Visual Basic .NET)

banner art

Previous Next

IWMSActiveStream.Type (Visual Basic .NET)

The Type property retrieves an enumeration value that indicates whether the stream is audio or video.

Syntax

  WMS_ACTIVE_STREAM_TYPE = IWMSActiveStream.Type

Property Value

A WMS_ACTIVE_STREAM_TYPE enumeration type indicating whether the stream is audio or video. This must be one of the following values.

Value Description
WMS_STREAM_TYPE_VIDEO The stream is video.
WMS_STREAM_TYPE_AUDIO The stream is audio.
WMS_STREAM_TYPE_OTHER The stream is neither audio nor video.

Remarks

This property is read-only.

Example Code

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

Private Sub GetStreamType()

    ' Declare variables.
    Dim Server As WMSServer
    Dim Players As IWMSPlayers
    Dim Player As IWMSPlayer
    Dim Playlist As IWMSPlaylist
    Dim ActiveMedia As IWMSActiveMedia
    Dim ActiveStreams As IWMSActiveStreams
    Dim ActiveStream As IWMSActiveStream
    Dim astType As WMS_ACTIVE_STREAM_TYPE

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 the IWMSActiveStreams object.
        ActiveStreams = ActiveMedia.Streams

        ' Retrieve information about each active stream.
        For Each ActiveStream In ActiveStreams
            ' Retrieve the stream type.
            astType = ActiveStream.Type
        Next
    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