Gets or sets a value that indicates whether the stream is enabled at runtime.
public bool Enable { get; set; }
true if the stream is enabled; otherwise, the value is false.
using Leadtools;
using Leadtools.MediaStreaming;
public Server _server = null;
public bool _result = false;
public void PrintLiveStreamControlsExample()
{
try
{
string strLiveStreams = "";
// create an instance of the server object
_server = new Leadtools.MediaStreaming.Server();
// retrieve a copy of the Live Stream Controls
LiveStreamControls Streams = _server.GetLiveStreamControls();
strLiveStreams += string.Format("--- Live Stream Controls (count = {0}) ---\n\n", Streams.Count.ToString());
// print the all live streams properties to a string
for (int nIndex = 0; nIndex < Streams.Count; nIndex++)
{
LiveStreamControl stream = Streams[nIndex];
strLiveStreams += string.Format("Live Stream Control[{0}]: Path = \"{1}\".\n", nIndex.ToString(), stream.Path);
string s = "";
strLiveStreams += string.Format("Handle = \"0x{0:X8}\".\n", stream.Handle);
switch (stream.State)
{
case LiveStreamState.Stopped:
s = "Stopped";
break;
case LiveStreamState.Activating:
s = "Activating";
break;
case LiveStreamState.Active:
s = "Active";
break;
case LiveStreamState.Inactive:
s = "Inactive";
break;
case LiveStreamState.Error:
s = "Error";
break;
}
strLiveStreams += string.Format("State = \"{0}\".\n", s);
if (stream.Enable)
strLiveStreams += string.Format("Enable = \"true\".\n");
else
strLiveStreams += string.Format("Enable = \"false\".\n");
if (stream.ActivateOnDemand)
strLiveStreams += string.Format("ActivateOnDemand = \"true\".\n");
else
strLiveStreams += string.Format("ActivateOnDemand = \"false\".\n");
strLiveStreams += string.Format("IdleTime = \"{0}\".\n", stream.IdleTime.ToString());
strLiveStreams += string.Format("IdleTimeOut = \"{0}\".\n", stream.IdleTimeOut.ToString());
switch (stream.VideoEncoding)
{
case LiveStreamVideoEncoding.None:
s = "None";
break;
case LiveStreamVideoEncoding.H264_Source:
s = "Source";
break;
case LiveStreamVideoEncoding.H264_Software:
s = "Software";
break;
case LiveStreamVideoEncoding.H264_QSV:
s = "QSV";
break;
case LiveStreamVideoEncoding.H264_CUDA:
s = "CUDA";
break;
}
strLiveStreams += string.Format("VideoEncoding = \"{0}\".\n", s);
switch (stream.AudioEncoding)
{
case LiveStreamAudioEncoding.None:
s = "None";
break;
case LiveStreamAudioEncoding.AAC_Source:
s = "Source";
break;
case LiveStreamAudioEncoding.AAC_Software:
s = "Software";
break;
}
strLiveStreams += string.Format("AudioEncoding = \"{0}\".\n", s);
}
// display a message contains the Live Streams information string
MessageBox.Show(strLiveStreams, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information);
_result = true;
}
catch (Exception)
{
_result = false;
}
}