My Java program that opens up a webcam stream and streams the captured video to a Swing component works, but when I launch it, it causes Windows to switch to the Basic theme. This is an excerpt from my code:
String str1 = "vfw:Logitech USB Video Camera:0";
String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
captureDeviceInfo = CaptureDeviceManager.getDevice(str2);
Format[] formats = captureDeviceInfo.getFormats();
for (Format format : formats) {
System.out.println(format);
}
mediaLocator = captureDeviceInfo.getLocator();
try {
player = Manager.createRealizedPlayer(mediaLocator);
player.start();
Component comp;
if ((comp = player.getVisualComponent()) != null) {
playerPanel.add(comp);
add(playerPanel, BorderLayout.NORTH);
}
If I comment out the line where the I add comp to playerPanel, it doesn't switch to the basic theme, so I assume that's where it goes wrong. From what I understand JMF is not maintained anymore and probably isn't fully compatible with Windows 7 Aero Theme. But still, is there a way to fix this? Why does it switch?
Okay so, the answer to this one was to install the webcam drivers. I'm using a Logitech QuickCam Pro 9000, so I just downloaded the driver from Logitech's website. Apparently if you use the generic webcam driver that Windows provides you can get the behavior I described earlier.