Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
.gif)
| Previous | Next |
IWMSActiveMedia Object (Visual Basic .NET)
The IWMSActiveMedia object provides information about the currently active media element in a playlist. A media element can include both audio and video streams.
The IWMSActiveMedia object exposes the following properties and methods.
| Property | Description |
| Duration | Retrieves the total length of the media element, in milliseconds. |
| Live | Retrieves a Boolean value that indicates whether the media element originates from a live source. |
| Streams | Retrieves an IWMSActiveStreams object that contains a collection of the media streams that make up the active media element. |
| TotalPackets | Retrieves the total number of data packets contained in the active media element. |
| Method | Description |
| GetProperty | Retrieves a specific property from the active media element. |
Example Code
The following example illustrates how to retrieve an IWMSActiveMedia object.
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Private Sub RetrieveObj()
' 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
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
See Also
- IWMSActiveStream Object (Visual Basic .NET)
- IWMSPlayer Object (Visual Basic .NET)
- IWMSPlaylist Object (Visual Basic .NET)
- Server Object Model (Visual Basic .NET)
| Previous | Next |