Java Forum / General / August 2007
JMF Applet without client side installation
amitatgroups@gmail.com - 26 Jul 2007 19:33 GMT HI,
I need to create an Applets and applications that will transmitt and recieve media using RTP in [JMF]Java Compatible environment--including Web browsers--without having to worry about client side JMF installation.Will it be possible to deploy a java applet on a client browser without having the client to install stuff?
Thanks...
amitatgroups@gmail.com - 27 Jul 2007 08:39 GMT On Jul 26, 11:33 pm, amitatgro...@gmail.com wrote:
> HI, > [quoted text clipped - 6 lines] > > Thanks... My Applet will run on client machine and need to capture and play audio and video using JMF. My Applet also needs JMF classes so, i send jmf.jar file with my applet. My Applet is also signed.
I also try with some alternate on client machine where JMF is not installed. I keep perform.wav on client machine at location c:\perform.wav and try to create Processor object using MediaLocator but it is also not working.
MediaLocator ml = new MediaLocator("file://c:/perform.wav");
above line works but :->
processor = Manager.createProcessor(ml);
is not working.
so can any one clear that, for creating Processor object we also need JMF installation at client machine even we send jmf.jar file with our applet.
Note here I am not trying to Capture Client Device
amitatgroups@gmail.com - 27 Jul 2007 08:49 GMT Find here with my code:->
import javax.media.*; import javax.media.control.*; import javax.media.datasink.*; import javax.media.format.*; import javax.media.protocol.*; import javax.media.control.TrackControl; import jmapps.util.StateHelper;
import java.io.*; import java.util.*;
public class SoundApplet extends java.applet.Applet {
public void init() { //doSpeak(); //doSpeakJMF(); doRTPWork(); }
private void doRTPWork() {
MediaLocator ml = null;
Processor processor = null; StateHelper sh = null;
try{ ml = new MediaLocator("file://c:/perform.wav"); }catch(Exception ex){ System.out.println("*exceptoin* "+ex); } //http://groups.google.co.in/group/comp.lang.java.programmer/ browse_thread/thread/1fa2b20a25eadba0/965262ce1bdeb4bb?lnk=st&q=jmf +applet+without+installation&rnum=1&hl=en#965262ce1bdeb4bb try{ System.out.println("a"); processor = Manager.createProcessor(ml); System.out.println("b"); sh = new StateHelper(processor); System.out.println("c"); }/*catch (IOException e) { System.out.println("**22** io exception:-> "+e); System.exit(-1); }*/catch (NoProcessorException e) { System.out.println("*33* no processor exception:-> "+e); System.exit(-1); }catch(Exception ex){ System.out.println("*44*:-> "+ex); }
// Configure the processor processor.configure(); while (processor.getState() != Processor.Configured){ System.out.println("state:-> "+processor.getState()); System.out.println("configured:-> "+Processor.Configured); }
processor.realize(); while(processor.getState()!=Processor.Realized);
System.out.println("d"); if (!sh.configure(10000)) System.exit(-1);
System.out.println("e");
// Set the output content type and realize the processor //processor.setContentDescriptor(new FileTypeDescriptor(FileTypeDescriptor.WAVE)); //processor.setContentDescriptor(new ContentDescriptor( ContentDescriptor.RAW)); processor.setContentDescriptor(new ContentDescriptor( ContentDescriptor.RAW_RTP)); System.out.println("f");
/*if (!sh.realize(10000)) System.exit(-1);*/
// create a File protocol MediaLocator with the location of the // file to which the data is to be written MediaLocator dest = new MediaLocator("rtp://192.168.1.7:8080"); System.out.println("h"); // get the output datasource of the processor and exit // if we fail DataSource source = null;
try {
source = processor.getDataOutput(); System.out.println("i"); }catch (NotRealizedError e) { System.out.println("*5* no realized error:-> "+e); System.exit(-1); }catch (Exception e) { System.out.println("*6* exception creating datasource:-> "+e); System.exit(-1); }
// hand this datasource to manager for creating an RTP // datasink our RTP datasink will multicast the audio try{ DataSink d = Manager.createDataSink(source, dest); System.out.println("j"); d.open(); System.out.println("k"); d.start(); System.out.println("l"); processor.start(); System.out.println("m"); }catch (Exception e) { System.out.println("*7*:-> "+e); System.exit(-1); } } }
Andrew Thompson - 27 Jul 2007 10:28 GMT >HI, > >I need .. I saw your post on the other group and was wondering if I could be bothered taking yet another person through the entire applets/JMF saga.
Now I know you are a multi-poster*, I won't waste my time. Please refrain from multi-posting, in future.
* <http://www.physci.org/codes/javafaq.html#xpost>
 Signature Andrew Thompson http://www.athompson.info/andrew/
amitatgroups@gmail.com - 27 Jul 2007 11:06 GMT > amitatgro...@gmail.com wrote: > >HI, [quoted text clipped - 14 lines] > > Message posted viahttp://www.javakb.com yes i accept, i post multiple time but reason is that i need answer. If got answer in single post then i will not it post next time
Andrew Thompson - 27 Jul 2007 12:08 GMT >> amitatgro...@gmail.com wrote: >> >HI, [quoted text clipped - 3 lines] > >yes i accept, i post multiple time but reason is that i need answer. Reason is of no concern to me. Your time schedule is not my problem.
>If got answer in single post ... If you need an urgent answer, see a help desk or consultant, then offer them premium rates to consider your problem ahead of others.
>...then i will not it post next time Feel free not to post, *first* or subsequent times, if that is your attitude to these discussion forums.
 Signature Andrew Thompson http://www.athompson.info/andrew/
amitatgroups@gmail.com - 27 Jul 2007 12:14 GMT yes I got your point, I will remember next time.
can any one help
Andrew Thompson - 27 Jul 2007 16:27 GMT On Jul 27, 9:14 pm, amitatgro...@gmail.com wrote:
> ...I will remember next time. Good. That's covered and over.
We can procceed to the technical matter.
1st - are you aware of Java Web Start (JWS)?
This is relevant to your technical point in that JWS is a *much* better way to laucnh some types of applications 'from a web page'.
It is not 'embedded' in a web page as you originally requested, but I think it is a much beter way to launch media based projects (free floating, in their onw resizable windows).
Here is a 'simple' example of launching a (JMF based) movie shown in a free floating JWS window.. <http://www.javasaver.com/testjs/jmf/#test3>
Note that - - this deployment could be made much smaller for *your* project - it could probably be 'sandboxed' as opposed to asking the end user to accept code signed by 'some guy from usenet' (this is a huge advantage).
So, it comes down to "what do you (or your end user) consider to be an 'install'"? The JWS launch is much less 'Must REBOOT dialog' friendly, since it does not ask the user to do any such thing, but it is still (effectively) an installation. Is that acceptible to your 'use case'?
amitatgroups@gmail.com - 28 Jul 2007 08:23 GMT Hi, Thanks for reply,
i need/want to implement an Applet which will run on Client machine using my web page(web browser). Applet is used to establish voice chatting using VOIP but without client side Installation stuff.
Applet need to get voice from Microphone and send that voice using RTP protocol, JMF support RTP.
I already created such applet with JMF support but when i run such applet over box which contain JMF will run smoothly but when i run such applet on box which don't contain JMF fail to work.
help me to resolve the issue for box which do not have JMF. I don't want to install JMF on client machine.
Thanks...
Andrew Thompson - 28 Jul 2007 09:07 GMT ...
>i need/want to implement an Applet which will run on Client machine >using my web page(web browser). Applet is used to establish voice >chatting using VOIP but without client side Installation stuff. You explained a lot in this post, but I am still not clear on any answer to 'why not use web start'?
This will be *very* difficult to deploy as a standard applet embedded in a web page.
Note that web start does offer the ability to get an applet or application running on a client PC, "..using my web page(web browser)" that is one of its major strengths.
As to the 'without installation' part, forget it. The code *must* be present for the app. to run, there is no way around that. The real issue here (as far as I understand) is to not force the user to go through any 'special setup'* to use the app., and that can be achieved fairly easily, using web start.
* Short of OK'ing some confirmation dialogs, which is what an applet that captures audio would need to do, anyway.
As an aside, one perennial problem with capturing sound in an applet using JMF, is that even if the applet is signed, the JMF code uses a configuration setting within the JMF registry to decide whether to allow the applet to record. That setting defaults to 'no' in the JMF set-up installer, and most people accept that setting.
Besides that, there a variety of security issues with applets that might trip up this applet, people are very cautious about allowing applets out of their 'sandbox', with good cause ("the web page, that watches you back!").
 Signature Andrew Thompson http://www.athompson.info/andrew/
amitatgroups@gmail.com - 28 Jul 2007 17:29 GMT Thanks,
I got your point, You suggest me to use Java Web Start for Java Based Application, JWS will take care of installation at client machine right.
1) Is JMF based applet need installation, if yes is there no way to avoid installation stuff. 2) For applet can i use JWS because I'll suppose to develop VOICE Chat using Applet using JMF, If yes can u suggest any example.
Thanks,
Amit Jain - 09 Aug 2007 07:54 GMT Hi Andrew, I go through your suggestion and tried deployment of my applet using "Java WebStart" and succeed. But my applet is still not able to capture the client machine device.
can you suggest me next approach to resolve the problem. can you give me your email id so that i can send you my web application folder containing all .jnlp and .jar files.
Andrew Thompson - 09 Aug 2007 11:45 GMT >Hi Andrew, G'day Amit. Thanks for reminding me of this thread, I had not realised I left it 'hanging'. But your further post reminded me that it required my attention..
(and no need to mention the MP matter again - it is solved and over)
>I go through your suggestion and tried deployment of my applet using >"Java WebStart" and succeed. Great, but..
>...But my applet is still not able to >capture the client machine device. I don't think it ever will. The problem is the JMF setting that says 'no applet capture' (or whatever). A JWS <installer> might be able to change that setting to 'heck yeah, allow applets to do everything'. But that seems not to be quite fitting the basic need to do all this 'in a web page'.
>can you suggest me next approach to resolve the problem. I'm sorry, but I do not believe that the 'ease' that you are after can be achieved by an applet capturing through a *web* *page* using standard JMF.
If you went into the JMF source code and changed it, it might be possible to rebuild the JMF so that simply any 'signed and trusted' applet could do as it needs, but I am sure it would require change to the JMF code itself.
>can you give me your email id so that i can send you my web >application folder containing all .jnlp and .jar files. No. Or at least, not unless it is as consultancy, I do not provide private help for free. If your are interested in consultancy, yell and I'll be there.
 Signature Andrew Thompson http://www.athompson.info/andrew/
Amit Jain - 10 Aug 2007 07:36 GMT Thanks for replying, Really i can't understand what to do now. I found many peoples facing same problem and with no solution. I also look at sun forums and found many thread with same query with no answer. Really something is wrong with JMF and sun. JMF is dead... [ :( :( ]
Thanks
Andrew Thompson - 10 Aug 2007 09:12 GMT ...
>JMF is dead... [ :( :( ] Yeah, it is dead. There has been no development in the JMF API itself for a *long* time, and Sun is looking to hook into the native player for Java 7, so their interest in JMF will be 'slightly less than zero'.
Did that point not come up during the thread?
 Signature Andrew Thompson http://www.athompson.info/andrew/
Amit Jain - 10 Aug 2007 10:59 GMT So, It means there no way to get answer for query. " JMF Applet without client side Installation ".
It's too bad for me and persons who having same query.
Thanks
Yogesh Tiwari - 10 Aug 2007 11:05 GMT Hi, i watch this thread regularly and hoping that you people will found the solution but...
Yogesh Tiwari
Amit Jain - 18 Aug 2007 06:19 GMT Hi, when i execute below program, i didn't got any runtime exception and my program goal is to capture device and send voice data using RTP but when i check using ethereal i couldn't found any RTP packet.
please give me some guide line...
/* * JWSApplet.java * * Created on August 8, 2007, 1:02 PM * * To change this template, choose Tools | Template Manager * and open the template in the editor. */
/** * * @author Client1 Computer Amit Jain */ import javax.media.*; import javax.media.control.*; import javax.media.datasink.*; import javax.media.format.*; import javax.media.protocol.*; import javax.media.control.TrackControl;
import jmapps.util.StateHelper;
import javax.media.rtp.*; import javax.media.rtp.rtcp.*; import javax.media.rtp.event.*; import com.sun.media.rtp.*; import com.sun.media.ui.*;
import java.io.*; import java.util.*; import java.awt.*; import java.net.InetAddress; import java.applet.*;
public class JWSApplet extends Applet{
/** Initialization method that will be called after the applet is loaded * into the browser. */ public void init() { doSendProcessor(); }
private void doSendProcessor(){ CaptureDeviceInfo di = null; Processor processor = null; di = getDeviceInfo();
// create a processor for this capturedevice and exit if we cann't create it try{ processor = Manager.createProcessor(di.getLocator()); }catch(IOException ioEX){ ioEX.printStackTrace(); }catch(Exception e){ e.printStackTrace(); }
//configure the processor processor.configure(); while(processor.getState()!=processor.Configured){ //System.out.println(processor.getState()+" state "+processor.Configured); }
processor.setContentDescriptor(new ContentDescriptor(ContentDescriptor.RAW)); TrackControl track[] = processor.getTrackControls(); //value of encodingOK determine we can send GSM data or not //if value of encodingOK is true means we can send GSM data boolean encodingOK = false; //go through the tracks and try to program one of them to //output GSM Data for(int i=0;i<track.length;i++){ //System.out.println("track:-> "+track[i]); if(!encodingOK && track[i] instanceof FormatControl){ boolean abc = track[i] instanceof FormatControl; //System.out.println("track[i] instanceof FormatControl:-> "+abc);
if((track[i]).setFormat(new AudioFormat(AudioFormat.GSM_RTP,8000,8,1))==null){ track[i].setEnabled(false); }else{ encodingOK = true; } }else{ track[i].setEnabled(false); } }
//System.out.println("encodingOK:-> "+encodingOK);
//realize the processor if(encodingOK){ processor.realize(); while(processor.getState()!=Processor.Realized){ //System.out.println(processor.getState()+" real "+processor.Configured); } }
// get the output datasource of the processor and exit if we fail DataSource ds = null; try{ ds = processor.getDataOutput(); }catch(NotRealizedError e){ e.printStackTrace(); }
// use datasource fot creating an RTP datasink //our RTP datasink will multicast the audio. /* try{ String url = "rtp://192.168.1.7:5000/audio/1"; MediaLocator m = new MediaLocator(url); DataSink d = Manager.createDataSink(ds,m);
d.open();
d.start();
processor.start();
}catch(Exception e){ System.out.println(""); e.printStackTrace(); } */
//create a SessionManager and hand over the //datasource for SendStream creation
try{ SessionManager rtpsm = new RTPSessionMgr();
SessionAddress localaddr = new SessionAddress(); InetAddress destaddr = InetAddress.getByName("192.168.1.2"); SessionAddress sessaddr = new SessionAddress(destaddr, 5000,destaddr,5000+1); //ask RTPSM to generetion the local participant CName String cname = rtpsm.generateCNAME(); SourceDescription[] userdesclist = new SourceDescription[] {new SourceDescription(SourceDescription.SOURCE_DESC_EMAIL,"abc@sun.com", 1,false) ,new SourceDescription(SourceDescription.SOURCE_DESC_CNAME,cname, 1,false),new SourceDescription(SourceDescription.SOURCE_DESC_TOOL,"JMF RTP Player v2.0",1,false)};
// the session manager then needs to be initialized and started: rtpsm.initSession(localaddr,userdesclist,0.05,0.25); rtpsm.startSession(sessaddr,1,null); SendStream sendStream = rtpsm.createSendStream(ds, 0); sendStream.start(); }catch(IOException io){ //System.out.println(""); io.printStackTrace(); }catch(UnsupportedFormatException e){ //System.out.println(""); e.printStackTrace(); }catch(Exception e){ //System.out.println(""); e.printStackTrace(); } }
private CaptureDeviceInfo getDeviceInfo(){ CaptureDeviceInfo di = null; AudioFormat a = new AudioFormat (AudioFormat.LINEAR, 8000, 16, 1); Vector deviceList = CaptureDeviceManager.getDeviceList(a);
if(deviceList!=null){ if(deviceList.size()>0) di = (CaptureDeviceInfo) deviceList.elementAt(0); else System.out.println("no device is captured"); }else{ //g.drawString("Vector not Initialized",50,25); System.out.println("Vector not Initialized"); } return di; } }
Thanks...
Lew - 27 Jul 2007 12:37 GMT >> amitatgro...@gmail.com wrote: >>> HI, [quoted text clipped - 15 lines] > yes i accept, i post multiple time but reason is that i need answer. > If got answer in single post then i will not it post next time That would only make sense if you waited long enough for an answer to show up, which you did not do. Also, multiposting is bad enough that you still shouldn't do it; it divides the answers amongst several threads, reducing the value of the answers and annoying the very people who have those answers.
If you really must reach more than one group, cross-post (address multiple groups at the same time instead of in separate messages) with followup set to just one group.
Don't reject the advice to follow the netiquette as you did in your reply. For one thing, the excuse wasn't credible. You do, of course, have the freedom to be as rude as you want. That would tend to reduce the willingness of folks to help you, and thus the utility of the group to you.
If you really do "need answer" then it's better would be for you to get the helpfulness of Andrew's advice and not make implausible excuses. You'll actually /reduce/ the likelihood of getting answers and that of getting them from the most knowledgeable people by multiposting. For example, Andrew is one of the most knowledgeable people around here about applets. (Notice that by telling you that he'd answered this question before that he gave you a hint: you can search the newsgroup archives and possibly find the answer already there for you.) By multiposting, you've pretty much lost that valuable source of knowledge. By justifying it with that odd excuse, you have pretty much damaged the chance of getting that source back.
So please, do not multipost. For your own benefit.
 Signature Lew
amitatgroups@gmail.com - 27 Jul 2007 12:58 GMT Lew, I accept my mistake and i also commit next time I'll not post multiple time.
Once Again, Sorry
Amit Jain
Free MagazinesGet these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...
|
|
|