1

I want to make a Audio/Video settings window like existing in Skype, which allow the user to select devices used in the calls and test them, Now i have a two problems:|

  1. How to get availabe Audio/Video devices.
  2. I want to test these devices as following:
    • Mic: display a bar based on input voice (same as Skype Audio Setting).
    • Camera: View a preview from selected camera (same as Skype Setting).
    • Speaker: button to play audio file.

I found some a solution for #1 using Microsoft Expression Encoder as following:

        var vidDevices = EncoderDevices.FindDevices(EncoderDeviceType.Video);
        var audDevices = EncoderDevices.FindDevices(EncoderDeviceType.Audio);

this require to Add the Microsoft Expression Encoder which will increase the size of our program, i think there should be a native way to communicate with Audio/Video devices without the need of external libraries.

Alex
  • 4,821
  • 16
  • 65
  • 106
Anas
  • 711
  • 7
  • 24
  • 2
    Take a look at the [How Do I get list of audio/video and capture devices in C#?](http://stackoverflow.com/questions/11662015/how-do-i-get-list-of-audio-video-and-capture-devices-in-c) or [Get default audio/video device](http://stackoverflow.com/questions/6438628/get-default-audio-video-device) questions here on Stack Overflow. – Sheridan Mar 24 '14 at 08:57
  • @Sheridan thanks this is helpful for problem #1, what about #2? – Anas Mar 24 '14 at 11:06
  • Anas, this is *not* a site where you can come to ask people to do *your* work for you... I provided you with a number of links to resources that *you* can use to answer your own second point. The correct thing to do is for *you* to actually attempt to implement your requirements and then come back here and ask a new, specific question, *if* you have a problem with implementing a particular part of your requirements. – Sheridan Mar 24 '14 at 11:54
  • In my opinion stack overflow is a place to share knowledge and helping people, so if any one experience this he can help otherwise he don't have to search for answer, that how i answer the questions for other users. – Anas Mar 24 '14 at 14:14
  • My comment was not telling you about *my opinion*... it was telling you about the rules and regulations of this website, as are set out in the various pages of the Stack Overflow [Help Center](http://stackoverflow.com/help). You can choose to follow the advice given there, or not. As most people *do* follow these guidelines, you'll see that my comment is actually good advice and aimed at getting an answer to your *specific* problem(s). My point was that no one will answer your question when you don't try yourself and don't follow the rules. However, if you think you know best, it's up to you. – Sheridan Mar 24 '14 at 14:52

1 Answers1

1

Part 1. This is non-trivial from .NET. You need to integrate with Direct Show and COM to do this, or possibly use some WMI queries. However, it is a giant pain in the ass. The documentation that @Sheridan provided is a great starting point. Another piece of advice, there are other frameworks like libvlc and gstreamer that do this sort of thing for you. You could try looking at the dshowvideosrc and dshowaudiosrc code for gstreamer and see the exact direct-show code you need.

Part 2. You will probably have to implement this yourself. You may get lucky on the display part as there is probably a directx filter that you can plug in to your media graph which will handle the heavy lifting for you. The viewing of the camera isn't too bad, you just need a window handle to pass to the media graph. Playing the audio is similarly easy once you have the media graph built.

I know this doesn't seem like much of an answer, but this is not something we can give you a full solution on via this medium. You have two options, learn DirectX, DShow, and COM. Or, find a good framework that abstracts all of this away such as gstreamer or libvlc.

Jonathan Henson
  • 8,076
  • 3
  • 28
  • 52
  • thank you very much your answer very helpful, i am not experience with Devices in .Net, i used to do these tasks in Flash using 10 lines of code, also HTML5 draft now adding simple methods to do this, and i thought .Net have a ready functions to enumerate devices simply and get input from them, this is lack in the framework i think. – Anas Mar 25 '14 at 08:38