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));
}
}
}
以上是列出捕获设备的代码。它不会返回null
向量,但仍会将向量的大小打印为0
,并且表示未找到任何设备。这段代码有什么问题?