0

This is the code I wrote in J2SE with Native java wrapper for Gstreamer. But alas it does not work in Web Browser, I am very upset what I can do now, I have no alternative to end this project.

IS it impossible to use audio/video with Java Applet for Gstreamer or To build a CD/DVD quality audio? (this is not targeted for world wide web, only web browsers between peer to peer or peer to 10 peer).

ex: working sample as j2SE but same code does not ever work with java applet from browser.

package audio;

/* Audio, Global class */
import org.gstreamer.*;

import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger; 

// Used via applet:
// <applet code="sipphone.MainApplet" width=600 height=600 archive="Audio.jar" >
public class MyGst
{

    public static void runit()
    {
        Gst.init();
        Pipeline pipe = new Pipeline("MyGst");
        Element src = ElementFactory.make("autoaudiosrc", "Source");
        Element sink = ElementFactory.make("autoaudiosink", "Destination");
        pipe.addMany(src, sink);
        src.link(sink);
        pipe.setState(State.PLAYING);

        Gst.main();
        pipe.setState(State.NULL);      
    }

}

Note: Follow up: In any web browser this native way works, when you have java. So JAVA applet works in any browser. Those who are like me, faced this problem, do not get confused.

weston
  • 54,145
  • 21
  • 145
  • 203

3 Answers3

4

If it works natively then there's always the option of creating a signed applet. That will allow you to have full native access, which I'm guessing is what the gstreamer stuff requires (it's probably loading the gstreamer native libraries at runtime).

It'll be a little more annoying for users, as they'll have to grant it rights to run, and a little more annoying for you, as you'll have to sign the applet, but it should work.

The other option is to see if there are any pure-Java audio streaming libraries that you could use in place of gstreamer. I can't speak to that, as I've never done anything more complicated with audio than playing an audio file, but they may exist.

Herms
  • 37,540
  • 12
  • 78
  • 101
  • Unfortunately, what i am searching and getting information, almost all mentioned that Java Applet cant have native access from web browser, and which can be a impossible to implement. IF i go with other audio libraries or framework the quality of Audio will be never as good as Gstreamer does. There is my whole fall down, i cant belive the whole WEB browser world is so restricted and against creative projects.. –  Dec 16 '10 at 21:42
  • 3
    Java applets can have *full* native access from the web browser *if they are signed*. Where I worked before we had a signed applet that would download, install, and then load a DLL at runtime. Signed applets have the rights to do that, and everything else a native application can do. This is the purpose of signed applets, and it's one thing that java applets can do that Flash can't. – Herms Dec 16 '10 at 22:00
2

You could deploy your applet as a jnlp web start application

Enrique
  • 9,920
  • 7
  • 47
  • 59
-4

a little more annoying for you, as you'll have to sign the apple

WHAT? Annoying to be signed? Oh right, you are more easily caught for IP infringement, right?

"Its okay to steal, cuz its so nice to share...." Loudoun Wainwright

willemIP
  • 1
  • 1
  • 2
    Why do you assume there's any IP infringement going on? – Laurence Gonsalves Dec 16 '10 at 21:21
  • 1
    Signing adds more steps to the build process. And you may want to get a "valid" certificate instead of self-signed, which is another step. Managing signed applets is more annoying than unsigned, solely due to the extra steps. Not sure where you got IP infringement from, but it has nothing do with anything here. – Herms Dec 16 '10 at 22:01