Name Property

Summary

(Read-only).

Syntax
C#
VB
C++
public string Name { get; } 
Public ReadOnly Property Name As String 
public: 
property String^ Name { 
   String^ get(); 
} 

Property Value

A string that receives the device's name.

Remarks

(Read-only). Gets the device's unique name. The returned string can be used to uniquely identify a device. A program can save this value to persistent storage and used later to restore the device selection.

Example
C#
VB
using Leadtools; 
using Leadtools.MediaStreaming; 
 
 
public Server _server = null; 
public bool _result = false; 
 
public void PrintCaptureDevicesExample() 
{ 
   try 
   { 
      string strDevices = ""; 
 
      // create an instance of the server object 
      _server = new Leadtools.MediaStreaming.Server(); 
 
      // retrieve a copy of the Live Streams 
      LiveStreams Streams = _server.GetLiveStreams(); 
 
      // create live stream just to enumerate the devices 
      LiveStream stream = Streams.CreateLiveStream(); 
 
      // print the capture devices to a string 
      strDevices += "--- Live Stream Devices---\n\n"; 
 
      //Get the Video Devices  
      Devices VideoDevices = stream.VideoDevices; 
 
      strDevices += string.Format("--- Video Devices (count = {0}) ---\n\n", VideoDevices.Count.ToString()); 
 
      // Print Video Devices 
      int nIndex = 0; 
      foreach (Device Device in VideoDevices) 
      { 
         strDevices += string.Format("Device[{0}]: FriendlyName = \"{1}\".\n", nIndex.ToString(), Device.FriendlyName); 
         strDevices += string.Format("Name =  \"{0}\".\n", nIndex.ToString(), Device.Name); 
         if (Device.Selected) 
            strDevices += "Selected = \"true\" \n"; 
         else 
            strDevices += "Selected = \"false\" \n"; 
 
         nIndex++; 
      } 
 
      //Get the Audio Devices  
      Devices AudioDevices = stream.AudioDevices; 
 
      strDevices += string.Format("--- Audio Devices (count = {0}) ---\n\n", AudioDevices.ToString()); 
 
      // Print Audio Devices 
      nIndex = 0; 
      foreach (Device Device in AudioDevices) 
      { 
         strDevices += string.Format("Device[{0}]: FriendlyName = \"{1}\".\n", nIndex.ToString(), Device.FriendlyName); 
         strDevices += string.Format("Name =  \"{0}\".\n", nIndex.ToString(), Device.Name); 
         if (Device.Selected) 
            strDevices += "Selected = \"true\" \n"; 
         else 
            strDevices += "Selected = \"false\" \n"; 
 
         nIndex++; 
      } 
 
      // display a message contains the Devices information string 
      MessageBox.Show(strDevices, "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 PrintCaptureDevicesExample() 
   Try 
      Dim strDevices 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() 
 
      ' create live stream just to enumerate the devices 
      Dim stream As LiveStream = Streams.CreateLiveStream() 
 
      ' print the capture devices to a string 
      strDevices &= "--- Live Stream Devices---" & Constants.vbLf + Constants.vbLf 
 
      'Get the Video Devices  
      Dim VideoDevices As Devices = stream.VideoDevices 
 
      strDevices &= String.Format("--- Video Devices (count = {0}) ---" & Constants.vbLf + Constants.vbLf, VideoDevices.Count.ToString()) 
 
      ' Print Video Devices 
      Dim nIndex As Integer = 0 
      For Each Device As Device In VideoDevices 
         strDevices &= String.Format("Device[{0}]: FriendlyName = ""{1}""." & Constants.vbLf, nIndex.ToString(), Device.FriendlyName) 
         strDevices &= String.Format("Name =  ""{0}""." & Constants.vbLf, nIndex.ToString(), Device.Name) 
         If Device.Selected Then 
            strDevices &= "Selected = ""true"" " & Constants.vbLf 
         Else 
            strDevices &= "Selected = ""false"" " & Constants.vbLf 
         End If 
 
         nIndex += 1 
      Next Device 
 
      'Get the Audio Devices  
      Dim AudioDevices As Devices = stream.AudioDevices 
 
      strDevices &= String.Format("--- Audio Devices (count = {0}) ---" & Constants.vbLf + Constants.vbLf, AudioDevices.ToString()) 
 
      ' Print Audio Devices 
      nIndex = 0 
      For Each Device As Device In AudioDevices 
         strDevices &= String.Format("Device[{0}]: FriendlyName = ""{1}""." & Constants.vbLf, nIndex.ToString(), Device.FriendlyName) 
         strDevices &= String.Format("Name =  ""{0}""." & Constants.vbLf, nIndex.ToString(), Device.Name) 
         If Device.Selected Then 
            strDevices &= "Selected = ""true"" " & Constants.vbLf 
         Else 
            strDevices &= "Selected = ""false"" " & Constants.vbLf 
         End If 
 
         nIndex += 1 
      Next Device 
 
      ' display a message contains the Devices information string 
      MessageBox.Show(strDevices, "LEADTOOLS Media Streaming Examples", MessageBoxButtons.OK, MessageBoxIcon.Information) 
 
      _result = True 
   Catch e1 As Exception 
      _result = False 
   End Try 
End Sub 

Requirements

Target Platforms

See Also

Reference

Device Class

Device 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