←Select platform

LiveStreamState Enumeration

Summary

Defines the possible live stream states.

Syntax
C#
VB
C++
public enum LiveStreamState 
Public Enum LiveStreamState 
public: 
   enum class LiveStreamState sealed 

Members

ValueMemberDescription
0StoppedIndicates that the server is stopped.
1ActivatingIndicates that the live stream is activating.
2ActiveIndicates that the live stream is active and available to the client.
3InactiveIndicates that the live stream is currently inactive.
4ErrorIndicates that the stream encountered an error while activating.

Example
C#
VB
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; 
   } 
} 
Imports Leadtools 
Imports Leadtools.MediaStreaming 
 
 
Public _server As Server = Nothing 
Public _result As Boolean = False 
 
Public Sub PrintLiveStreamControlsExample() 
   Try 
      Dim strLiveStreams As String = "" 
 
      ' create an instance of the server object 
      _server = New Leadtools.MediaStreaming.Server() 
 
      ' retrieve a copy of the Live Stream Controls 
      Dim Streams As LiveStreamControls = _server.GetLiveStreamControls() 
 
      strLiveStreams += String.Format("--- Live Stream Controls (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 LiveStreamControl = Streams(nIndex) 
 
         strLiveStreams += String.Format("Live Stream Control[{0}]: Path = ""{1}""." & vbLf, nIndex.ToString(), stream.Path) 
 
         Dim s As String = "" 
 
         strLiveStreams += String.Format("Handle = ""0x{0:X8}""." & vbLf, stream.Handle) 
 
 
         Select Case stream.State 
            Case LiveStreamState.Stopped 
               s = "Stopped" 
               Exit Select 
            Case LiveStreamState.Activating 
               s = "Activating" 
               Exit Select 
            Case LiveStreamState.Active 
               s = "Active" 
               Exit Select 
            Case LiveStreamState.Inactive 
               s = "Inactive" 
               Exit Select 
            Case LiveStreamState.[Error] 
               s = "Error" 
               Exit Select 
         End Select 
         strLiveStreams += String.Format("State = ""{0}""." & vbLf, s) 
 
         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("IdleTime = ""{0}""." & vbLf, stream.IdleTime.ToString()) 
 
         strLiveStreams += String.Format("IdleTimeOut = ""{0}""." & vbLf, stream.IdleTimeOut.ToString()) 
 
         Select Case stream.VideoEncoding 
            Case LiveStreamVideoEncoding.None 
               s = "None" 
               Exit Select 
            Case LiveStreamVideoEncoding.H264_Source 
               s = "Source" 
               Exit Select 
            Case LiveStreamVideoEncoding.H264_Software 
               s = "Software" 
               Exit Select 
            Case LiveStreamVideoEncoding.H264_QSV 
               s = "QSV" 
               Exit Select 
            Case LiveStreamVideoEncoding.H264_CUDA 
               s = "CUDA" 
               Exit Select 
         End Select 
 
         strLiveStreams += String.Format("VideoEncoding = ""{0}""." & vbLf, s) 
 
 
         Select Case stream.AudioEncoding 
            Case LiveStreamAudioEncoding.None 
               s = "None" 
               Exit Select 
            Case LiveStreamAudioEncoding.AAC_Source 
               s = "Source" 
               Exit Select 
            Case LiveStreamAudioEncoding.AAC_Software 
               s = "Software" 
               Exit Select 
         End Select 
 
 
         strLiveStreams += String.Format("AudioEncoding = ""{0}""." & vbLf, s) 
      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

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