File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

usb web camera and JMF Problem

 
hassan ali
Ranch Hand
Posts: 127
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
i have tried many example to work with usb web camera but exception said that no device connected

while camera fine and work under windwos

this is th code thank you for help

import javax.media.Player;
import javax.media.CaptureDeviceInfo;
import javax.media.MediaLocator;
import javax.media.CaptureDeviceManager;
import javax.media.Manager;
import javax.media.format.*;

import java.util.Vector;
import java.awt.*;

public class TestJMF4 {
CaptureDeviceInfo device;
MediaLocator ml;
Player player;
Component videoScreen;
public static void main(String args[]){
new TestJMF4();
}

TestJMF4(){
try
{ //gets a list of devices how support the given videoformat
Vector deviceList = CaptureDeviceManager.getDeviceList(new YUVFormat());


device = (CaptureDeviceInfo) deviceList.firstElement();


ml = device.getLocator();

player = Manager.createRealizedPlayer(ml);

player.start();

videoScreen = player.getVisualComponent();
Frame frm=new Frame();
frm.setBounds(10,10,300,300);

frm.add(videoScreen);
frm.setVisible(true);

}
catch(Exception e)
{
System.out.println(e);
}
}
}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic