File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes usb web camera and JMF  Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "usb web camera and JMF  Problem" Watch "usb web camera and JMF  Problem" New topic
Author

usb web camera and JMF Problem

hassan ali
Ranch Hand

Joined: Apr 23, 2006
Posts: 127
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);
}
}
}
 
Consider Paul's rocket mass heater.
 
subject: usb web camera and JMF Problem
 
Similar Threads
NoSuchElmentException in program
WebCam Through Java
USB camera and JMF problrm
JMF application not detecting web camera
Camera class and device path...