VideoDevices Property

Summary
Gets the video device collection object.
Syntax
C#
C++/CLI
[EditorAttribute(System.Type, System.Type)] 
public virtual VideoDevices VideoDevices { get; } 
public: 
virtual property VideoDevices^ VideoDevices { 
   VideoDevices^ get(); 
} 

Property Value

A VideoDevices collection object.

Remarks

The VideoDevices object is used to enumerate the available video capture devices.

Example
C#
using Leadtools; 
using Leadtools.Multimedia; 
using LeadtoolsMultimediaExamples.Fixtures; 
 
 
public bool _result = false; 
public CaptureCtrlForm _form = new CaptureCtrlForm(); 
public CaptureCtrl _capturectrl; 
public TestCtrlSubForm _csbform; 
 
public void DevicesExample() 
{ 
   // reference the capture control 
   _capturectrl = _form.CaptureCtrl; 
 
   // input file 
   string outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_Source.avi"); 
 
   try 
   { 
      // create the sub form for devices listbox 
      _csbform = new TestCtrlSubForm(); 
 
      _csbform.Load += new EventHandler(Form_Load); 
      _csbform.buttonRefresh.Click += new EventHandler(Refresh_Click); 
      _csbform.List.Click += new EventHandler(List_Click); 
 
      // show the devices form 
      _csbform.ShowDialog(); 
 
      // get the selected device index 
      int selectedRenderer = _capturectrl.AudioDevices.Selection; 
 
      // set the result to what we expect  
      _result = (_csbform.List.SelectedItem != null && _capturectrl.AudioDevices.Selection != -1); 
   } 
   catch (Exception) 
   { 
      _result = false; 
   } 
} 
 
void Form_Load(object sender, EventArgs e) 
{ 
   //  build the audio device list 
   EnumerateDevices(_capturectrl.AudioDevices, _csbform.List); 
} 
 
void List_Click(object sender, EventArgs e) 
{ 
   //  select the audio device 
   SelectDevice(_capturectrl.AudioDevices, _csbform.List); 
} 
 
void Refresh_Click(object sender, EventArgs e) 
{ 
   //  refresh audio devices 
   RefreshDevices(_capturectrl.AudioDevices, _csbform.List); 
} 
 
void EnumerateDevices(AudioDevices Devices, ListBox List) 
{ 
   //  Build the device's list box 
   int Selected = -1; 
 
   // empty the list box 
   List.Items.Clear(); 
 
   // add the available audio devices to the list box 
   for (int i = 0; (i <= (Devices.Count - 1)); i++) 
   { 
      List.Items.Add(Devices[i]); 
      if (Devices[i].Selected) 
      { 
         Selected = i; 
      } 
   } 
   //  highlight the current selection 
   List.SelectedIndex = Selected; 
} 
 
void RefreshDevices(AudioDevices Devices, ListBox List) 
{ 
   string SelectedName = string.Empty; 
 
   //  save the currently selected device's name 
   if (Devices.Selection >= 0) 
      SelectedName = Devices[Devices.Selection].FriendlyName; 
 
   //  refresh the device collection 
   Devices.Refresh(); 
 
   //  if there was a previously selected device, reselect it 
   if (SelectedName != string.Empty) 
      Devices.Selection = Devices.IndexOf(SelectedName); 
 
   //  rebuild the listbox 
   EnumerateDevices(Devices, List); 
} 
 
void SelectDevice(AudioDevices Devices, ListBox List) 
{ 
   //  select the highlighted device 
   Devices.Selection = Devices.IndexOf(List.Items[List.SelectedIndex] as Device); 
} 
 
static class LEAD_VARS 
{ 
   public const string MediaDir = @"C:\LEADTOOLS22\Media"; 
} 
Requirements

Target Platforms

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

Leadtools.Multimedia Assembly

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.