1
import javax.media.*;
import java.util.*;

public class ListCaptureDevices {

    public static void main(String[] args) {

        Vector info = CaptureDeviceManager.getDeviceList(null);
        if (info == null)
            System.out.println("No Capture devices known to JMF");
        else {
            System.out.println("The following " + info.size()
                    + " capture devices are known to the JMF");
            for (int i = 0; i < info.size(); i++)
                System.out
                        .println("\t" + (CaptureDeviceInfo) info.elementAt(i));
        }
    }
}

Above is the code to list the capture devices. It does not return null vector but still it print the size of the vector as 0 and says no devices are found. What is wrong with this code?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Valmik
  • 11
  • 3
  • Welcome to SO. Please format code samples. To do that, select the sample and click the `{}` button above the message posting/editing form. – Andrew Thompson Feb 10 '12 at 04:13

1 Answers1

2

It is not necessary to use JMF to discover the sound capture devices. See the MediaTypes class on this answer for example source.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433