IWMSActiveMedia.Streams (C#)
.gif)
| Previous | Next |
IWMSActiveMedia.Streams (C#)
The Streams property retrieves an IWMSActiveStreams object that contains a collection of the media streams that make up the active media element.
Syntax
IWMSActiveStreams = IWMSActiveMedia.Streams;
Property Value
An IWMSActiveStreams object.
Example Code
using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;
// Declare variables.
WMSServer Server;
IWMSActiveMedia ActiveMedia;
IWMSActiveStreams ActiveStreams;
IWMSActiveStream ActiveStream;
IWMSPlayers Players;
IWMSPlayer Player;
IWMSPlaylist Playlist;
int iBitrate;
string bstrName;
try {
// Create a new WMSServer object.
Server = new WMSServerClass();
// Retrieve an IWMSPlayers object.
Players = Server.Players;
// If players are connected, retrieve first IWMSPlayer object
// in the IWMSPlayers collection.
if (Server.Players.Count > 0)
{
Player = Server.Players[0];
// 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 (Playlist != null)
{
// Retrieve the IWMSActiveMedia object.
ActiveMedia = Playlist.CurrentMediaInformation;
// Retrieve the IWMSActiveStreams object.
ActiveStreams = ActiveMedia.Streams;
// Retrieve information about each active stream.
for (int i = 0; i < ActiveStreams.Count; i++)
{
// Retrieve the IWMSActiveStream object.
ActiveStream = ActiveStreams[i];
// Retrieve the bit rate.
iBitrate = ActiveStream.BitRate;
// Retrieve the stream name.
bstrName = ActiveStream.Name;
// Retrieve the stream type.
WMS_ACTIVE_STREAM_TYPE astType;
astType = ActiveStream.Type;
}
}
}
}
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
- IWMSActiveMedia Object (C#)
- IWMSActiveStream Object (C#)
- IWMSActiveStreams Object (C#)
- IWMSPlayer Object (C#)
- IWMSPlaylist Object (C#)
| Previous | Next |