1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
Vector v = CaptureDeviceManager.getDeviceList(null);
CaptureDeviceInfo webcamInfooo = new CaptureDeviceInfo("Camera", new MediaLocator("vfw://0" ),null);
MediaLocator webcamMediaLocator =webcamInfooo.getLocator();
Player player = null;
Player stop = null;
try {
// now we are creating the player but this time using the medialocator of the cam 37
player = Manager.createRealizedPlayer(webcamMediaLocator);//Creating Player 38
} catch (IOException ex) {
Logger.getLogger(test_jmf1.class.getName()).log(Level.SEVERE, null, ex);
} catch (NoPlayerException ex) {
Logger.getLogger(test_jmf1.class.getName()).log(Level.SEVERE, null, ex);
} catch (CannotRealizeException ex) {
Logger.getLogger(test_jmf1.class.getName()).log(Level.SEVERE, null, ex);
}
player.prefetch();
Component comp = null;
if ((comp = player.getVisualComponent()) != null) {
panel1.add(comp);
panel1.setSize(900,800);
panel1.add(player.getControlPanelComponent(),BorderLayout.LINE_END)
player.start();
stop.close(); |
Partager