none
How to detect All Audio/Video device from our system and check it's working or not.

    Question

  • Hi,

    I just need "how to detect All audio/video device from our system and check it's working or not, I need to implement in my web application.

    Could you please give some approach?

    Thanks.

    Friday, April 14, 2017 8:51 AM

All replies

  • For example =>

    {
                    ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_SoundDevice");
                    foreach (ManagementObject soundDevice in mos.Get())
                    {
                        String sDeviceId = soundDevice.GetPropertyValue("DeviceId").ToString();
                        String sDeviceName = soundDevice.GetPropertyValue("Name").ToString();
                        String sDeviceStatus = soundDevice.GetPropertyValue("Status").ToString();                    
                        Console.WriteLine("Device Name = {0} - Device Id = {1} - Status = {2}", sDeviceName, sDeviceId, sDeviceStatus);
                    }
                    ManagementObjectSearcher mos2 = new ManagementObjectSearcher("select * from Win32_VideoController");
                    foreach (ManagementObject videoDevice in mos2.Get())
                    {
                        String sDeviceId = videoDevice.GetPropertyValue("DeviceId").ToString();
                        String sDeviceName = videoDevice.GetPropertyValue("Name").ToString();
                        String sDeviceStatus = videoDevice.GetPropertyValue("Status").ToString();
                        Console.WriteLine("Device Name = {0} - Device Id = {1} - Status = {2}", sDeviceName, sDeviceId, sDeviceStatus);
                    }
    }




    • Edited by Castorix31 Friday, April 14, 2017 9:14 AM
    Friday, April 14, 2017 9:09 AM
  • Castorix, Thanks for your response.

    But how can we check that camera/mic is working or not ?

    Actually, My requirement is below-

    1. Get all audio (Headphone, Mic) and video devices (like camera, otoscope camera) in list

    2. Then select one video device and audio device.

    3. selected devices goes for check (is working or not).

    4. If selected device is working then will pass that device in third party API.


    • Edited by Chirag_ Friday, April 14, 2017 9:54 AM remove some confusion
    Friday, April 14, 2017 9:17 AM
  • Hi Chirag_,

    Thank you for posting here.

    According to your question is more related to web application, you could post a new thread in ASP.NET forum for suitable support.

    The Visual C# discuss and ask the C# programming language, IDE, libraries, samples and tools.

    If you have some grammar or code errors, please feel free to contact us. We will try our best to give you a solution.

    Thanks for your understanding and cooperation.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 17, 2017 8:14 AM
    Moderator