tags:

views:

951

answers:

1

Hi there, I have been developing a chat application. And so, I want to create a webcam support to my application, like as mercury, so i had tryed search a lot of more with google, but i didnt find a good article, or tutorial, or something. I have readed the jmf guide, but what write in it, just a media player, and sound player, it is not enough for me.

So Can somebody give me a good article, or a short example source what demonstrate the webcam streaming ?

Thanks

+1  A: 

There is a good thread over at the Sun Java forums here: forums.sun.com/thread.jspa?threadID=247253 (sorry for the lack of a link, new users can't post links)

Also, here is a rough overview of what you need to do:

// This will grab the first supported device that is connected to your machine
// If you have more than one device, you will need to alter this code
Vector<?> deviceList = CaptureDeviceManager.getDeviceList(new YUVFormat());
CaptureDeviceInfo device = (CaptureDeviceInfo) deviceList.firstElement();

MediaLocator ml = device.getLocator();
Player player = Manager.createRealizedPlayer(ml);
player.start();

Finally, you can add the Player's visual component to your application using:

Component videoScreen = player.getVisualComponent();
thedude19