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 |
IWMSActiveStreams.Count (C#)
The Count property retrieves the number of IWMSActiveStream objects in the IWMSActiveStreams collection.
Syntax
int = IWMSActiveStreams.Count;
Property Value
int containing the number of IWMSActiveStream objects.
Remarks
This property is read-only.
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;
try {
// Create a new WMSServer object.
Server = new WMSServerClass();
// Retrieve an IWMSPlayers object.
Players = Server.Players;
// If players are connected, retrieve the 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;
// Use the Count property as an iteration boundary
// when accessing individual objects in the collection.
for (int i = 0; i < ActiveStreams.Count; i++)
{
//
.
ActiveStream = ActiveStreams[i];
}
}
}
}
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
| Previous | Next |