How to identify any external webcame is connected to laptop using C# code ?

Ankit 1 Reputation point
2022-04-05T07:27:44.067+00:00

how to identify tusing .Net and C# code that any external webcams is connected to laptop weather it is a USB webcams or any network webcam ?
Possible solutins i am seeking:

  1. find out if any external webcame is connected to system.

Image and camera class from device manager doesn't give exact answer because sometime built in webcame also can shows in image class.

Developer technologies | Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,866 Reputation points
    2022-04-06T01:31:14.867+00:00

    Hello,
    Welcome to Microsoft Q&A!

    For accessing camera device, we need to add Webcam for current project manifest. In general, we use FindAllAsync method to find all VideoCapture device like following.

    var allVideoDevices = await DeviceInformation.FindAllAsync(DeviceClass.VideoCapture);  
    

    Please refer to our official code sample here that contains compete code.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.