First Of all, I am trying to implement a video conferencing system using JMF. I want to access webcam of a remote computer to take images.I have successfully captured images from my local camera.But when i try to do this from "A" computer to access webcam of "B" computer , i am not being successful. Can you please help me ??

Recommended Answers

JMF is ancient. they stopped supporting it years ago. you may want to look for a somewhat more 'up to date' technology.

So, you tried something, but it's not successful. Can you show us what you tried and tell us what exactly went wrong?

Jump to Post

Please see the link above for best technology.

Java + webcam = no

Jump to Post

All 6 Replies

JMF is ancient. they stopped supporting it years ago. you may want to look for a somewhat more 'up to date' technology.

So, you tried something, but it's not successful. Can you show us what you tried and tell us what exactly went wrong?

Basically, I am looking for a way so that everyone dont have to install JMF on their machine.The JMF would be installed only on the server machine.And When a client login to server through his system.Then the following code should run and it should gather the devices on his system and do the rest part of code.

I have searched a lot but being unable to find such a way.Help me on that.
Also if any other way of achieving video conferencing is there. Tell me about that too. But condition is that i want to acheive it that i want to acheive conferencing from a client browser to another client browser in JSP.

The following is a way to transmit an audio in a network.
I want to know how can i
1. transmit video in the same way
2. deploy the same code in JSP so that a client A (192.168.1.11) can communicate to client B(192.168.1.22) through server (192.168.1.5).

If i have to capture image from webcam and store it in the database when a client login (Using JSP) how can i do that.

``
I have made the changes that should be made in the code on the first line of main() to represent the MediaLocator.

--------------------------------------------------
Transmitter.java
---------------------------------------------------

import javax.media.*;
import javax.media.control.*;
import javax.media.protocol.*;
import javax.media.format.*;

import java.io.IOException;
import java.io.File;
import java.util.Vector;

public class Transmitter {

private MediaLocator mediaLocator = null;
private DataSink dataSink = null;

private Processor mediaProcessor = null;
private static final Format[] FORMATS = new Format[] {
new AudioFormat(AudioFormat.ULAW_RTP)};

private static final ContentDescriptor CONTENT_DESCRIPTOR =
new ContentDescriptor(ContentDescriptor.RAW_RTP);

public Transmitter(MediaLocator locator) {
mediaLocator = locator;
}

public void startTransmitting() throws IOException {

mediaProcessor.start(); 
dataSink.open();
dataSink.start();
}

public void stopTransmitting() throws IOException {

dataSink.stop();
dataSink.close(); 
mediaProcessor.stop();
mediaProcessor.close();
}


public void setDataSource(DataSource ds) throws IOException,
NoProcessorException, CannotRealizeException, NoDataSinkException {


mediaProcessor = Manager.createRealizedProcessor(
new ProcessorModel(ds, FORMATS, CONTENT_DESCRIPTOR));


dataSink = Manager.createDataSink(mediaProcessor.getDataOutput(),
mediaLocator);
}

public static void main(String[] args) {
try {

MediaLocator locator = new MediaLocator("rtp://192.168.56.1:339/audio");   
Transmitter transmitter = new Transmitter(locator);
System.out.println("-> Created media locator: '" +
locator + "'");

Vector devices=CaptureDeviceManager.getDeviceList ( null ); 
CaptureDeviceInfo cdi= (CaptureDeviceInfo) devices.elementAt ( 0 ); 

DataSource source = Manager.createDataSource(
cdi.getLocator());

transmitter.setDataSource(source);
System.out.println("-> Set the data source on the transmitter");

transmitter.startTransmitting();
System.out.println("-> Transmitting...");
System.out.println(" Press the Enter key to exit");

System.in.read();
System.out.println("-> Exiting");
transmitter.stopTransmitting();

} catch (Throwable t) {
t.printStackTrace();
}

System.exit(0);
}

----------------------------------------------------


Receiver.java
----------------------------------------------------

import javax.media.*;

import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;

public class Receiver {
private Player audioPlayer = null;

public Receiver(MediaLocator url) throws IOException, NoPlayerException,
CannotRealizeException {
audioPlayer = Manager.createRealizedPlayer(url);
}

public void play() {
audioPlayer.start();
}


public void stop() {
audioPlayer.stop();
audioPlayer.close();
}
public static void main(String[] args) {
try {
MediaLocator loc=new MediaLocator("rtp://192.168.56.1:331/audio");      //getRemoteAddr(); can be used here
Receiver player = new Receiver(loc);
System.out.println(" Press the Enter key to exit");
player.play(); 
System.in.read();
System.out.println("-> Exiting");
player.stop(); 

} catch (Exception ex) {
ex.printStackTrace();
}

System.exit(0);
}
}
}

again: don't use jmf.
suppose you were an expert in OS's, would you rather work for a company that works on Windows '95 or installed Windows 8 ?

suppose you were an expert in OS's, would you rather work for a company that works on Windows '95 or installed Windows 8 ?

Neither, windows 3.1

With flash at least video support works 100% of the time all the time. I don't like the idea of java.

I also stumbled accross this with a flash fallback

https://github.com/jhuckaby/webcamjs

I understand what you say but i want to implement it in jsp.Is this Possible or not? Also, Tell me which new technology is considered best today for me (As a java Programmer).

Please see the link above for best technology.

Java + webcam = no

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.