GetLiveStreams Method

Summary

Retrieves a copy of the server's live stream collection. A LiveStreams collection.

Syntax
C#
VB
C++
public LiveStreams GetLiveStreams() 
Public Function GetLiveStreams() As LiveStreams 
public: 
LiveStreams^ GetLiveStreams();  

Return Value

A LiveStreams collection.

Example
C#
VB
using Leadtools; 
using Leadtools.MediaStreaming; 
 
 
public Server _server = null; 
public bool _result = false; 
 
public void PrintLiveStreamsExample() 
{ 
   try 
   { 
      string strLiveStreams = ""; 
 
      // create an instance of the server object 
      _server = new Leadtools.MediaStreaming.Server(); 
 
      // retrieve a copy of the Live Streams 
      LiveStreams Streams = _server.GetLiveStreams(); 
 
      strLiveStreams += string.Format("--- Live Streams (count = {0}) ---\n\n", Streams.Count.ToString()); 
 
      // print the all live streams properties to a string 
 
      for (int nIndex = 0; nIndex < Streams.Count; nIndex++) 
      { 
         LiveStream stream = Streams.GetLiveStream(nIndex); 
 
         strLiveStreams += string.Format("Live Stream[{0}]: Path = \"{1}\".\n", nIndex.ToString(), stream.Path); 
 
         int nSelection = stream.VideoDevices.Selection; 
         string strDevice = ""; 
         if (nSelection < 0) 
            strDevice = "<none selected>"; 
         else 
            strDevice = stream.VideoDevices[nSelection].FriendlyName; 
 
         strLiveStreams += string.Format("Video Device = \"{0}\".\n", strDevice); 
 
         nSelection = stream.AudioDevices.Selection; 
         strDevice = ""; 
         if (nSelection < 0) 
            strDevice = "<none selected>"; 
         else 
            strDevice = stream.AudioDevices[nSelection].FriendlyName; 
 
         strLiveStreams += string.Format("Audio Device = \"{0}\".\n", strDevice); 
 
         strLiveStreams += string.Format("Video Width = \"{0}\".\n", stream.VideoWidth.ToString()); 
 
         strLiveStreams += string.Format("Video Height = \"{0}\".\n", stream.VideoHeight.ToString()); 
 
         if (stream.UseVideoInputSize) 
            strLiveStreams += string.Format("Use Video Input Size = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("Use Video Input Size = \"false\".\n"); 
 
         strLiveStreams += string.Format("Video Frame Rate = \"{0}\".\n", stream.VideoFrameRate.ToString()); 
 
         if (stream.UseVideoInputFrameRate) 
            strLiveStreams += string.Format("Use Video Input Frame Rate = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("Use Video Input Frame Rate = \"false\".\n"); 
 
         strLiveStreams += string.Format("Video Bit Rate = \"{0}\".\n", stream.VideoBitRate.ToString()); 
 
         if (stream.QSVAcceleration) 
            strLiveStreams += string.Format("QSVAcceleration = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("QSVAcceleration = \"false\".\n"); 
 
         if (stream.CUDAAcceleration) 
            strLiveStreams += string.Format("CUDAAcceleration = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("CUDAAcceleration = \"false\".\n"); 
 
         nSelection = stream.AudioTypes.Selection; 
         string strType = ""; 
         if (nSelection < 0) 
            strType = "<none selected>"; 
         else 
            strType = stream.AudioTypes[nSelection].FriendlyName; 
 
         if (stream.UseDeviceEncoding) 
            strLiveStreams += string.Format("Use Device Encoding = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("Use Device Encoding = \"false\".\n"); 
 
         strLiveStreams += string.Format("Minimum Fragment Duration = \"{0}\".\n", stream.MinimumFragmentDuration.ToString()); 
 
         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("IdleTimeOut = \"{0}\".\n", stream.IdleTimeOut.ToString()); 
 
         if (stream.CUDADecoding) 
            strLiveStreams += string.Format("CUDADecoding = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("CUDADecoding = \"false\".\n"); 
 
         if (stream.QSVDecoding) 
            strLiveStreams += string.Format("QSVDecoding = \"true\".\n"); 
         else 
            strLiveStreams += string.Format("QSVDecoding = \"false\".\n"); 
 
         if (stream.HasVideoDeviceURL) 
         { 
            strLiveStreams += string.Format("VideoDeviceURL = \"{0}\".\n", stream.VideoDeviceURL); 
         } 
 
      } 
 
      // 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; 
   } 
} 
Imports Leadtools 
Imports Leadtools.MediaStreaming 
 
 
Public _server As Server = Nothing 
Public _result As Boolean = False 
 
Public Sub PrintLiveStreamsExample() 
   Try 
      Dim strLiveStreams As String = "" 
 
      ' create an instance of the server object 
      _server = New Leadtools.MediaStreaming.Server() 
 
      ' retrieve a copy of the Live Streams 
      Dim Streams As LiveStreams = _server.GetLiveStreams() 
 
      strLiveStreams += String.Format("--- Live Streams (count = {0}) ---" & vbLf & vbLf, Streams.Count.ToString()) 
 
      ' print the all live streams properties to a string 
 
      For nIndex As Integer = 0 To Streams.Count - 1 
         Dim stream As LiveStream = Streams.GetLiveStream(nIndex) 
 
         strLiveStreams += String.Format("Live Stream[{0}]: Path = ""{1}""." & vbLf, nIndex.ToString(), stream.Path) 
 
         Dim nSelection As Integer = stream.VideoDevices.Selection 
         Dim strDevice As String = "" 
         If nSelection < 0 Then 
            strDevice = "<none selected>" 
         Else 
            strDevice = stream.VideoDevices(nSelection).FriendlyName 
         End If 
 
         strLiveStreams += String.Format("Video Device = ""{0}""." & vbLf, strDevice) 
 
         nSelection = stream.AudioDevices.Selection 
         strDevice = "" 
         If nSelection < 0 Then 
            strDevice = "<none selected>" 
         Else 
            strDevice = stream.AudioDevices(nSelection).FriendlyName 
         End If 
 
         strLiveStreams += String.Format("Audio Device = ""{0}""." & vbLf, strDevice) 
 
         strLiveStreams += String.Format("Video Width = ""{0}""." & vbLf, stream.VideoWidth.ToString()) 
 
         strLiveStreams += String.Format("Video Height = ""{0}""." & vbLf, stream.VideoHeight.ToString()) 
 
         If stream.UseVideoInputSize Then 
            strLiveStreams += String.Format("Use Video Input Size = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("Use Video Input Size = ""false""." & vbLf) 
         End If 
 
         strLiveStreams += String.Format("Video Frame Rate = ""{0}""." & vbLf, stream.VideoFrameRate.ToString()) 
 
         If stream.UseVideoInputFrameRate Then 
            strLiveStreams += String.Format("Use Video Input Frame Rate = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("Use Video Input Frame Rate = ""false""." & vbLf) 
         End If 
 
         strLiveStreams += String.Format("Video Bit Rate = ""{0}""." & vbLf, stream.VideoBitRate.ToString()) 
 
         If stream.QSVAcceleration Then 
            strLiveStreams += String.Format("QSVAcceleration = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("QSVAcceleration = ""false""." & vbLf) 
         End If 
 
         If stream.CUDAAcceleration Then 
            strLiveStreams += String.Format("CUDAAcceleration = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("CUDAAcceleration = ""false""." & vbLf) 
         End If 
 
         nSelection = stream.AudioTypes.Selection 
         Dim strType As String = "" 
         If nSelection < 0 Then 
            strType = "<none selected>" 
         Else 
            strType = stream.AudioTypes(nSelection).FriendlyName 
         End If 
 
         If stream.UseDeviceEncoding Then 
            strLiveStreams += String.Format("Use Device Encoding = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("Use Device Encoding = ""false""." & vbLf) 
         End If 
 
         strLiveStreams += String.Format("Minimum Fragment Duration = ""{0}""." & vbLf, stream.MinimumFragmentDuration.ToString()) 
 
         If stream.Enable Then 
            strLiveStreams += String.Format("Enable = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("Enable = ""false""." & vbLf) 
         End If 
 
         If stream.ActivateOnDemand Then 
            strLiveStreams += String.Format("ActivateOnDemand = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("ActivateOnDemand = ""false""." & vbLf) 
         End If 
 
         strLiveStreams += String.Format("IdleTimeOut = ""{0}""." & vbLf, stream.IdleTimeOut.ToString()) 
 
         If stream.CUDADecoding Then 
            strLiveStreams += String.Format("CUDADecoding = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("CUDADecoding = ""false""." & vbLf) 
         End If 
 
         If stream.QSVDecoding Then 
            strLiveStreams += String.Format("QSVDecoding = ""true""." & vbLf) 
         Else 
            strLiveStreams += String.Format("QSVDecoding = ""false""." & vbLf) 
         End If 
 
         If stream.HasVideoDeviceURL Then 
            strLiveStreams += String.Format("VideoDeviceURL = ""{0}""." & vbLf, stream.VideoDeviceURL) 
 
         End If 
      Next 
 
      ' display a message contains the Live Streams information string 
      MessageBox.Show(strLiveStreams, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information) 
 
      _result = True 
   Catch generatedExceptionName As Exception 
      _result = False 
   End Try 
End Sub 

Requirements

Target Platforms

See Also

Reference

Server Class

Server Members

Help Version 20.0.2020.3.31
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.MediaStreaming Assembly