i am trying to access my video devices for live streaming using the code
public class WebCam {
private static Player player=null;
//private static Processor processor=null;
public static void main(String[] args){
try {
MediaLocator mediaLocator=new MediaLocator("vfw://0");
player=Manager.createRealizedPlayer(mediaLocator);
player.start();
Component video=player.getVisualComponent();
if(video!=null){
JFrame mediaTest = new JFrame("My WebCam");
mediaTest.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mediaTest.add(video);
mediaTest.setSize(300, 300);
mediaTest.setVisible(true);
}
} catch (NoPlayerException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (CannotRealizeException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
the code works fine but when i use
Vector deviceList=CaptureDeviceManager.getDeviceList(new YuvFormat());
CaptureDeviceInfo device=(CaptureDeviceInfo) deviceList.firstElement();
it throws an error what might be the possible error