Valmik
Valmik

Reputation: 11

Java : Audio capture device listing using Java Media Framework

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?

Upvotes: 1

Views: 1820

Answers (1)

Andrew Thompson
Andrew Thompson

Reputation: 168795

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

Upvotes: 2

Related Questions