Video in applet

Hi,
Is it possible to insert a video clip in an applet?

You need the Java Media Framework for that. Google also finds this: [http://www.cs.cityu.edu.hk/~jia/cs4273/applet.doc] which has an example.

Similar Messages

  • Video recording applet

    Hi all,
    I have to create an applet which can record a video/audio from webcam and upload it to the server afterwards.
    Can anyone help me create this?(JMF)
    Or point me to a link where I can get some help regarding same.
    Any help would be appreciated.
    Regards,
    Vikram Chhetry

    is it required for the client to have jmf installed on its machine.Obviously yaar,once you scroll down the article configuration ke baare mein usne discuss kiya tha..
    David Fischer's application is not able to detect my
    web cam. I m using quantum's webcam.well according to his point of view oo bandaa keh raha hein ki
    Most of USB cameras.Kya aap USB cam hee use kaar rahe ho kya ??
    why don't u give it a try with tht...
    and the better advice which i can give it you use make a Swing application using JMF ensure tht everything is working fine.
    Agaar woh theek raha toe applet ka zayadaa problem hooni nahin chahiye....
    I wanna float video recording applet, Wat do u mean by float video applet

  • Show video while applet loading

    Hi;
    Is it possible to play a video during applet loading? The video format may be swf or flv anything. I can show an animated gif by using param tag. But i want to play a video.
    Thanks in advance.
    Edited by: akk512 on Jun 10, 2010 4:54 AM

    Not with current applet architecture, no.
    But you might be able to do something clever with showing/hiding divs and javascript ...

  • CTD bug in simple video streaming applet.

    I'm trying to write a simple applet to use JMF to allow an end-user to view a video stream that's being served up by VLC. It doesn't have to look immensely pretty (in fact, streamlined is what I want most). I swiped some code from the jicyshout project (http://jicyshout.sourceforge.net) which handles streaming MP3s, and borrowed a framework for an applet from one of Sun's example applets for the JMF.
    Here's my code so far:
    ** begin file SimpleVideoDataSource.java **
    import java.lang.String;
    import java.net.*;
    import java.io.*;
    import java.util.Properties;
    import javax.media.*;
    import javax.media.protocol.*;
    /* The SeekableStream and DataSource tweaks are based on the code from
    * jicyshout (jicyshout.sourcefourge.net), which was written by Chris Adamson.
    * The code was simplified (no need for mp3 metadata here), cleaned up, then
    * extended for our puposes.
    * This is a DataSource using a SeekableStream suitable for
    * streaming video using the default parser supplied by JMF.
    public class SimpleVideoDataSource extends PullDataSource {
    protected MediaLocator myML;
    protected SeekableInputStream[] seekStreams;
    protected URLConnection urlConnection;
    // Constructor (trivial).
    public SimpleVideoDataSource (MediaLocator ml) throws MalformedURLException {
    super ();
    myML = ml;
    URL url = ml.getURL();
    public void connect () throws IOException {
    try {
    URL url = myML.getURL();
    urlConnection = url.openConnection();
    // Make the stream seekable, so that the JMF parser can try to parse it (instead
    // of throwing up).
    InputStream videoStream = urlConnection.getInputStream();
    seekStreams = new SeekableInputStream[1];
    seekStreams[0] = new SeekableInputStream(videoStream);
    } catch (MalformedURLException murle) {
    throw new IOException ("Malformed URL: " + murle.getMessage());
    } catch (ArrayIndexOutOfBoundsException aioobe) {
    fatalError("Array Index OOB: " + aioobe);
    // Closes up InputStream.
    public void disconnect () {
    try {
    seekStreams[0].close();
    } catch (IOException ioe) {
    System.out.println ("Can't close stream. Ew?");
    ioe.printStackTrace();
    // Returns just what it says.
    public String getContentType () {
    return "video.mpeg";
    // Does nothing, since this is a stream pulled from PullSourceStream.
    public void start () {
    // Ditto.
    public void stop () {
    // Returns a one-member array with the SeekableInputStream.
    public PullSourceStream[] getStreams () {
    try {
    // **** This seems to be the problem. ****
    if (seekStreams != null) {
    return seekStreams;
    } else {
    fatalError("sourceStreams was null! Bad kitty!");
    return seekStreams;
    } catch (Exception e) {
    fatalError("Error in getStreams(): " + e);
    return seekStreams;
    // Duration abstract stuff. Since this is a theoretically endless stream...
    public Time getDuration () {
    return DataSource.DURATION_UNBOUNDED;
    // Controls abstract stuff. No controls supported here!
    public Object getControl (String controlName) {
    return null;
    public Object[] getControls () {
    return null;
    void fatalError (String deathKnell) {
    System.err.println(":[ Fatal Error ]: - " + deathKnell);
    throw new Error(deathKnell);
    ** end file SimpleVideoDataSource.java **
    ** begin file SeekableInputStream.java **
    import java.lang.String;
    import java.net.*;
    import java.io.*;
    import java.util.Properties;
    import javax.media.*;
    import javax.media.protocol.*;
    /* The SeekableStream and DataSource tweaks are based on the code from
    * jicyshout (jicyshout.sourcefourge.net), which was written by Chris Adamson.
    * The code was simplified (no need for mp3 metadata here), cleaned up, then
    * extended for our puposes.
    /* This is an implementation of a SeekableStream which extends a
    * BufferedInputStream to basically fake JMF into thinking that
    * the stream is seekable, when in fact it's not. Basically, this
    * will keep JMF from puking over something it expects but can't
    * actually get.
    public class SeekableInputStream extends BufferedInputStream implements PullSourceStream, Seekable {
    protected int tellPoint;
    public final static int MAX_MARK = 131072; // Give JMF 128k of data to "play" with.
    protected ContentDescriptor unknownCD;
    // Constructor. Effectively trivial.
    public SeekableInputStream (InputStream in) {
    super (in, MAX_MARK);
    tellPoint = 0;
    mark (MAX_MARK);
    unknownCD = new ContentDescriptor ("unknown");
    // Specified size constructor.
    public SeekableInputStream (InputStream in, int size) {
    super (in, Math.max(size, MAX_MARK));
    tellPoint = 0;
    mark(Math.max(size, MAX_MARK));
    unknownCD = new ContentDescriptor ("unknown");
    // Reads a byte and increments tellPoint.
    public int read () throws IOException {
    int readByte = super.read();
    tellPoint++;
    return readByte;
    // Reads bytes (specified by PullSourceStream).
    public int read (byte[] buf, int off, int len) throws IOException {
    int bytesRead = super.read (buf, off, len);
    tellPoint += bytesRead;
    return bytesRead;
    public int read (byte[] buf) throws IOException {
    int bytesRead = super.read (buf);
    tellPoint += bytesRead;
    return bytesRead;
    // Returns true if in.available() <= 0 (that is, if there are no bytes to
    // read without blocking or end-of-stream).
    public boolean willReadBlock () {
    try {
    return (in.available() <= 0);
    } catch (IOException ioe) {
    // Stick a fork in it...
    return true;
    // Resets the tellPoint to 0 (meaningless after you've read one buffer length).
    public void reset () throws IOException {
    super.reset();
    tellPoint = 0;
    // Skips bytes as expected.
    public long skip (long n) throws IOException {
    long skipped = super.skip(n);
    tellPoint += skipped;
    return skipped;
    // Trivial.
    public void mark (int readLimit) {
    super.mark (readLimit);
    // Returns the "unknown" ContentDescriptor.
    public ContentDescriptor getContentDescriptor () {
    return unknownCD;
    // Lengths? We don't need no stinkin' lengths!
    public long getContentLength () {
    return SourceStream.LENGTH_UNKNOWN;
    // Theoretically, this is always false.
    public boolean endOfStream () {
    return false;
    // We don't provide any controls, either.
    public Object getControl (String controlName) {
    return null;
    public Object[] getControls () {
    return null;
    // Not really... but...
    public boolean isRandomAccess () {
    return true;
    // This only works for the first bits of the stream, while JMF is attempting
    // to figure out what the stream is. If it tries to seek after that, bad
    // things are going to happen (invalid-mark exception).
    public long seek (long where) {
    try {
    reset();
    mark(MAX_MARK);
    skip(where);
    } catch (IOException ioe) {
    ioe.printStackTrace();
    return tell();
    // Tells where in the stream we are, adjusted for seeks, resets, skips, etc.
    public long tell () {
    return tellPoint;
    void fatalError (String deathKnell) {
    System.err.println(":[ Fatal Error ]: - " + deathKnell);
    throw new Error(deathKnell);
    ** end file SeekableInputStream.java **
    ** begin file StreamingViewerApplet.java **
    * This Java Applet will take a streaming video passed to it via the applet
    * command in the embedded object and attempt to play it. No fuss, no muss.
    * Based on the SimplePlayerApplet from Sun, and uses a modified version of
    * jicyshout's (jicyshout.sourceforge.net) tweaks to get JMF to play streams.
    * Use it like this:
    * <!-- Sample HTML
    * <APPLET CODE="StreamingViewerApplet.class" WIDTH="320" HEIGHT="240">
    * <PARAM NAME="code" VALUE="StreamingViewerApplet.class">
    * <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
    * <PARAM NAME="streamwidth" VALUE="width (defaults to 320, but will resize as per video size)">
    * <PARAM NAME="streamheight" VALUE="height (defaults to 240, but will resize as per video size)">
    * <PARAM NAME="stream" VALUE="insert://your.stream.address.and:port/here/">
    * </APPLET>
    * -->
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import java.lang.String;
    import java.lang.ArrayIndexOutOfBoundsException;
    import java.net.URL;
    import java.net.MalformedURLException;
    import java.net.*;
    import java.io.*;
    import java.io.IOException;
    import java.util.Properties;
    import javax.media.*;
    import javax.media.protocol.*;
    public class StreamingViewerApplet extends Applet implements ControllerListener {
    Player player = null;
    Component visualComponent = null;
    SimpleVideoDataSource dataSource;
    URL url;
    MediaLocator ml;
    Panel panel = null;
    int width = 0;
    static int DEFAULT_VIDEO_WIDTH = 320;
    int height = 0;
    static int DEFAULT_VIDEO_HEIGHT = 240;
    String readParameter = null;
    // Initialize applet, read parameters, create media player.
    public void init () {
    try {
    setLayout(null);
    setBackground(Color.white);
    panel = new Panel();
    panel.setLayout(null);
    add(panel);
    // Attempt to read width from applet parameters. If not given, use default.
    if ((readParameter = getParameter("streamwidth")) == null) {
    width = DEFAULT_VIDEO_WIDTH;
    } else {
    width = Integer.parseInt(readParameter);
    // Ditto for height.
    if ((readParameter = getParameter("streamheight")) == null) {
    height = DEFAULT_VIDEO_HEIGHT;
    } else {
    height = Integer.parseInt(readParameter);
    panel.setBounds(0, 0, width, height);
    // Unfortunately, this we can't default.
    if ((readParameter = getParameter("stream")) == null) {
    fatalError("You must provide a stream parameter!");
    try {
    url = new URL(readParameter);
    ml = new MediaLocator(url);
    dataSource = new SimpleVideoDataSource(ml);
    } catch (MalformedURLException murle) {
    fatalError("Malformed URL Exception: " + murle);
    try {
    dataSource.connect();
    player = Manager.createPlayer(dataSource);
    } catch (IOException ioe) {
    fatalError("IO Exception: " + ioe);
    } catch (NoPlayerException npe) {
    fatalError("No Player Exception: " + npe);
    if (player != null) {
    player.addControllerListener(this);
    } else {
    fatalError("Failed to init() player!");
    } catch (Exception e) {
    fatalError("Error opening player. Details: " + e);
    // Start stream playback. This function is called the
    // first time that the applet runs, and every time the user
    // re-enters the page.
    public void start () {
    try {
    if (player != null) {
    player.realize();
    while (player.getState() != Controller.Realized) {
    Thread.sleep(100);
    // Crashes... here?
    player.start();
    } catch (Exception e) {
    fatalError("Exception thrown: " + e);
    public void stop () {
    if (player != null) {
    player.stop();
    player.deallocate();
    } else {
    fatalError("stop() called on a null player!");
    public void destroy () {
    // player.close();
    // This controllerUpdate function is defined to implement a ControllerListener
    // interface. It will be called whenever there is a media event.
    public synchronized void controllerUpdate(ControllerEvent event) {
    // If the player is dead, just leave.
    if (player == null)
    return;
    // When the player is Realized, get the visual component and add it to the Applet.
    if (event instanceof RealizeCompleteEvent) {
    if (visualComponent == null) {
    if ((visualComponent = player.getVisualComponent()) != null) {
    panel.add(visualComponent);
    Dimension videoSize = visualComponent.getPreferredSize();
    width = videoSize.width;
    height = videoSize.height;
    visualComponent.setBounds(0, 0, width, height);
    } else if (event instanceof CachingControlEvent) {
    // With streaming, this doesn't really matter much, does it?
    // Without, a progress bar of some sort would be appropriate.
    } else if (event instanceof EndOfMediaEvent) {
    // We should never see this... but...
    player.stop();
    fatalError("EndOfMediaEvent reached for streaming media. ewe ewe tea eff?");
    } else if (event instanceof ControllerErrorEvent) {
    player = null;
    fatalError(((ControllerErrorEvent)event).getMessage());
    } else if (event instanceof ControllerClosedEvent) {
    panel.removeAll();
    void fatalError (String deathKnell) {
    System.err.println(":[ Fatal Error ]: - " + deathKnell);
    throw new Error(deathKnell);
    ** end file StreamingViewerApplet.java **
    Now, I'm still new to the JMF, so this might be obvious to some of you... but it's exploding on me, and crashing to desktop (both in IE and Firefox) with some very fun errors:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x21217921, pid=3200, tid=3160
    # Java VM: Java HotSpot(TM) Client VM (1.5.0_06-b05 mixed mode, sharing)
    # Problematic frame:
    # C 0x21217921
    --------------- T H R E A D ---------------
    Current thread (0x058f7280): JavaThread "JMF thread: com.sun.media.amovie.AMController@506411[ com.sun.media.amovie.AMController@506411 ] ( realizeThread)" [_thread_in_native, id=3160]
    siginfo: ExceptionCode=0xc0000005, writing address 0x034e6360
    (plenty more here, I can post the rest if necessary)
    The problem seems to be coming from the "return seekStreams" statement in the first file; when I have execution aborted before that (with a fatalError call), it doesn't crash.
    Any tips/hints/suggestions?

    You should write your own Applet, where you can easily get the visual component (getVisualComponent())and show it directly in your Applet (you call it "embedded"). As far as I know, all examples (AVReceive* etc.) use the component which opens a new window.
    Best regards from Germany,
    r.v.

  • Streaming Video in Applets

    Hello,
    Can I stream video (through WebCam) and audio (through Mic) in Applets?
    Can I access the user WebCam from Applet?
    Thanks

    Hello,
    Can I stream video (through WebCam) and audio (through
    Mic) in Applets?
    Can I access the user WebCam from Applet?
    ThanksTo access the user WebCam from Applet, you can use the Java Twain package http://www.gnome.sk
    There is a tutorial with many code examples. One part of the tutorial deals specially with remote applications - there are applet code examples.
    On the http://www.gnome.sk there are online examples for the remote applications too - if you have a webcam connected to your computer, the Upload Applet will get an image from your webcam and upload it to the server.
    Erika Kupkova

  • Error Msg Prompted when exit a Video Capture applet

    I converted a sample Video Capture App to a applet, when i stoped capturing and exit, this massage prompted:
    "The instruction at '0X05a82f30' referernced memory at '0x05aa20f8', The memory could not be 'read'. Click on OK to ternimate the program".
    This app will write the captured video file onto local disk, but i've setted the security options in JMF Preference config.
    I just wonder why this error message occur?
    i'm now working on this applet for my JSP page, i want users can captrue pictures from the WebCam and then save as JPEG images.
    I realy appreciate it if any guys can give me some suggestion?

    I also writing a applet to do that. But I can work in application model. When I run it in browser . It throw out an error. Following is my code....
    FrameGrabbingControl fgc = (FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");
    tt.setText(fgc.toString()+"\r\n");
    Buffer buf = fgc.grabFrame();
    tt.append(buf.toString()+"\r\n");
    BufferToImage btoi = new BufferToImage((VideoFormat)buf.getFormat());
    tt.append(btoi.toString()+"\r\n");
    java.awt.image.BufferedImage img = (java.awt.image.BufferedImage)btoi.createImage(buf);
    tt.append(img.toString()+"\r\n");
    try {
    File file = new File("c:\\Testing.jpg");
    FileOutputStream out = new FileOutputStream(file);
    JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(out);
    JPEGEncodeParam param = encoder.getDefaultJPEGEncodeParam(img);
    param.setQuality(0.7f, false);
    encoder.setJPEGEncodeParam(param);
    //encoder.encode(buffImg);
    encoder.encode(img);
    out.close();
    } catch (Exception ex) {
    ex.printStackTrace();

  • Video Capture Applet

    Hi all, I wanted to write a code that allows me to capture video from my webcam and show me in the applet window. But the I have seen the webcam being activated but I can't see anything on the screen when I terminate the applet the camera switches of (diactivated). Please tell me the problems with applets? Basically I used a processor to capture the video and used it to produce a data source. I then used a player to play the data source. I have used createrelizedplayer method. If you need the code I will post it.
    Thank you.

    Hi Talha thank you for your prompt response. BTW, I removed all calls to system.exit(0) method and the error code changed. Also I was using the file protocol (file: as FILE:) so after I change everything, the error chnaged. I will post it below. To answer your questions:
    -- Which OS are you using? Vista? (then there are little chances that you would succeed) - XP (with SP3)
    -- Have you tried running the applet in Applet Viewer? - I tried IE and Firefox (I will try Applet viewer)
    -- Are you sure your program is foolproof, i.e. Is is working as Application? - I am sorry I don't get you.
    -- You can post your effort at code ( enclose it in tags) - You mean I should post my code. If you mean that I will post it after the erro message.
    Thank you again.
    ------- the error message ------
    java.security.AccessControlException: access denied (java.io.FilePermission \foo.avi read)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
         at java.security.AccessController.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkPermission(Unknown Source)
         at java.lang.SecurityManager.checkRead(Unknown Source)
         at java.io.File.exists(Unknown Source)
         at com.sun.media.datasink.file.Handler.open(Handler.java:263)
         at JMFAppletCapture5.init(JMFAppletCapture5.java:108)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
         at JMFAppletCapture5.start(JMFAppletCapture5.java:139)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception: java.lang.NullPointerException
    ------ my code----- the following code in init() method:
         MediaLocator videoMediaLocator = new MediaLocator("vfw:Microsoft WDM Image Capture (Win32):0");
         try{
         processor = Manager.createProcessor(videoMediaLocator);
         }catch (Exception e) { Stdout.logAndAbortException(e);}
         processor.configure();
         try{
         Thread.sleep(4000);
         } catch( Exception e ) { System.out.println( "Error:" + e ); }
         processor.setContentDescriptor(new
                      FileTypeDescriptor(FileTypeDescriptor.MSVIDEO));
         processor.realize();
         try{
         Thread.sleep(4000);
         } catch( Exception e ) { System.out.println( "Error:" + e ); }
         MediaLocator dest = new MediaLocator("FILE://foo.avi");
          DataSink filewriter = null;
          try {
              filewriter = Manager.createDataSink(processor.getDataOutput(), dest);
              filewriter.open();
          } catch (NoDataSinkException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } catch (SecurityException e) {
              e.printStackTrace();
    ---- and the following in start() method-----
         try{
         processor.start();
         }      catch (Exception e) { Stdout.logAndAbortException(e);}
         try {
              filewriter.start();
          } catch (IOException e) {
              e.printStackTrace();
         try{
         Thread.sleep(10000);
         } catch( Exception e ) { System.out.println( "Error:" + e ); }
         processor.stop();
         processor.close();
         filewriter.close();
    ------- the exception  java.lang.NullPointerException   was raised  by      processor.start();  statement. I think I should start the processor after the datasink.
    Edited by: Zelalem on Jan 24, 2009 8:17 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Video receiving applet in JMF

    Hello,
    I'm creating a webcam based video channel system but i have problems receiving the signal from the pc in the server. I send it using JMStudio but i'm unable to interpret.
    This is the code i use:
    import java.applet.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import java.awt.*;
    import java.net.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.media.*;
    import javax.media.rtp.*;
    import javax.media.rtp.event.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.AudioFormat;
    import javax.media.format.VideoFormat;
    import javax.media.Format;
    import javax.media.format.FormatChangeEvent;
    import javax.media.control.BufferControl;
    public class RecibeVideoApplet extends Applet implements ReceiveStreamListener, SessionListener
         String ip = "my ip"; // Estas direcciones variaran dependiendo del transmisor
         int puerto =0000;
         String puerto1;
         RTPManager rtpm = RTPManager.newInstance();
         Object datoSinc = new Object();
         boolean datoRecibido = false;
         Panel panelCam = new Panel(new BorderLayout());
         Button cerrar =new Button("Salir");
         Player player=null;
         // Funcion que inicializa el Applet
         public void init()
              // Recogemos el parametro de la pagina HTML
              ip = getParameter("IP");
              //puerto1 = getParameter("PUERTO");
              ///puerto = Integer.valueOf(puerto1).intValue();
              try
                   System.out.println("Ip" +ip);
                   InetAddress dirIp = InetAddress.getByName(ip);
                   System.out.println("dirIP" +dirIp);
                   SessionAddress dirLocal = new SessionAddress(InetAddress.getByName("000.000.000.000"),puerto);
                   System.out.println("dirLocal" +dirLocal);
                   SessionAddress dirDest = new SessionAddress(dirIp,puerto);
                   rtpm.addSessionListener(this);
                   rtpm.addReceiveStreamListener(this);
                   rtpm.initialize(dirLocal);
                   rtpm.addTarget(dirDest);          
              catch (Exception e)
                   System.out.println("No se pudo crear la sesion RTP" + e.getMessage());
              // Esperamos a que lleguen los datos
              long then = System.currentTimeMillis();
              long periodoEspera = 60000; // esperamos como maximo 60segundos
              try{
              synchronized (datoSinc)
                   while (!datoRecibido &&
                        System.currentTimeMillis() - then < periodoEspera)
                   if (!datoRecibido)
                        System.err.println("Esperando datos RTP...");
                   datoSinc.wait(1000);
              catch (Exception e) {}
              if (!datoRecibido) {
              System.err.println("No se ha recibido ningn dato RTP");
         // Funciones que esperan a que llegue un evento y avisan de ello
         public synchronized void update (SessionEvent evento)
              if (evento instanceof NewParticipantEvent)
                   Participant participante = ((NewParticipantEvent)evento).getParticipant();
                   System.out.println("Acaba de unirse un nuevo participante:"+ participante.getCNAME());
         public synchronized void update (ReceiveStreamEvent evento)
              RTPManager rtpm = (RTPManager)evento.getSource();
              Participant participante =evento.getParticipant();
              ReceiveStream stream = evento.getReceiveStream();
              if (evento instanceof NewReceiveStreamEvent)
                   try
                        stream = ((NewReceiveStreamEvent)evento).getReceiveStream();
                        DataSource ds =stream.getDataSource();
                        // Creamos el player para visualizar el video
                        player = Manager.createRealizedPlayer(ds);
                        if (player == null)
                             return;
                        // Comenzamos la transmision
                        player.start();
                        // Cogemos el componente visual para a�adirlo al panel
                        Component comp;
                   if ((comp = player.getVisualComponent()) == null)
                        return;
                   panelCam.add("Center", comp);
                   panelCam.add("South", cerrar);
                   add("Center",panelCam);
                   this.setSize(800,800);
                   this.setVisible(true);
                   //Avisamos al metodo inicializar de que hemos recibido datos
                   synchronized (datoSinc)
                        datoRecibido = true;
                        datoSinc.notifyAll();
                   catch (Exception e)
                        System.out.println("Error: " + e.getMessage());
                        return;
         // Metodo que utilizamos para poder cerrar la transmisi�n mediante un bot�n
         public boolean action(Event evt,Object arg)
              if(evt.target.equals(cerrar))
                   close();
              else
              return super.action (evt,arg);
              return true;
         // Metodo para cerrar el player de la transmision
         public void close()
         try
              player.close();
              rtpm.removeTargets("Cerrando sesion desde RecibeVideo");
              rtpm.dispose();
              rtpm = null;
         catch (Exception e)
                   System.out.println("No se ha podido cerrar correctamente");
         //Metodo para destruir el applet
         public void destroy()
    The names are in spanish but i think that the main function can be understood
    and this is the output i get from the webpage:
    java.lang.Error: Unresolved compilation problems:
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         ReceiveStreamListener cannot be resolved to a type
         SessionListener cannot be resolved to a type
         RTPManager cannot be resolved to a type
         RTPManager cannot be resolved
         Player cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         rtpm cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         SessionEvent cannot be resolved to a type
         NewParticipantEvent cannot be resolved to a type
         Participant cannot be resolved to a type
         NewParticipantEvent cannot be resolved to a type
         ReceiveStreamEvent cannot be resolved to a type
         RTPManager cannot be resolved to a type
         RTPManager cannot be resolved to a type
         Participant cannot be resolved to a type
         ReceiveStream cannot be resolved to a type
         NewReceiveStreamEvent cannot be resolved to a type
         NewReceiveStreamEvent cannot be resolved to a type
         DataSource cannot be resolved to a type
         player cannot be resolved
         Manager cannot be resolved
         player cannot be resolved
         player cannot be resolved
         player cannot be resolved
         player cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         at RecibeVideoApplet.<init>(RecibeVideoApplet.java:12)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    java.lang.Error: Unresolved compilation problems:
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         The import javax.media cannot be resolved
         ReceiveStreamListener cannot be resolved to a type
         SessionListener cannot be resolved to a type
         RTPManager cannot be resolved to a type
         RTPManager cannot be resolved
         Player cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         SessionAddress cannot be resolved to a type
         rtpm cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         SessionEvent cannot be resolved to a type
         NewParticipantEvent cannot be resolved to a type
         Participant cannot be resolved to a type
         NewParticipantEvent cannot be resolved to a type
         ReceiveStreamEvent cannot be resolved to a type
         RTPManager cannot be resolved to a type
         RTPManager cannot be resolved to a type
         Participant cannot be resolved to a type
         ReceiveStream cannot be resolved to a type
         NewReceiveStreamEvent cannot be resolved to a type
         NewReceiveStreamEvent cannot be resolved to a type
         DataSource cannot be resolved to a type
         player cannot be resolved
         Manager cannot be resolved
         player cannot be resolved
         player cannot be resolved
         player cannot be resolved
         player cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         rtpm cannot be resolved
         at RecibeVideoApplet.<init>(RecibeVideoApplet.java:12)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at sun.applet.AppletPanel.createApplet(Unknown Source)
         at sun.plugin.AppletViewer.createApplet(Unknown Source)
         at sun.applet.AppletPanel.runLoader(Unknown Source)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    If anyone knows how to solve the problems i have, please let me know.
    Thank you

    MHP and OCAP only use JMF 1.0, which does not include support for capturing video. You will not be able to do this in any current MHP/OCAP imlementation that I know of.
    Steve.

  • Popup fields rendered behind video player applet

    Hi,
    We are embedding a video player using Windows media player. The code is like:
    <object id="MediaPlayer4" width="302"
    height="165"
    classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
    standby="Loading Windows Media Player components..."
    type="application/x-oleobject"
    codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
    style="margin:11.0px;">
    <param name="filename"
    value="${pageFlowScope.newAssetBean.asset_preview_url}"/>
    <param name="Showcontrols" value="True"/>
    <param name="autoplay" value="false"/>
    <param name="autoStart" value="0"/>
    <embed type="application/x-mplayer2"
    src="${pageFlowScope.newAssetBean.asset_preview_url}"
    width="302" height="165"
    autostart="false"></embed>
    </object>
    Once a popup is shown above this player, the fields in the popup get behind the embedded player.
    How do we fix this?

    Hi,
    not knowing your JDeveloper version, there is known bug for 11g R2 --> bug 13492597. It seems that this is fixed in a backport for 11.1.1.6
    Frank

  • Live Video in an Applet

    I have a program which captures live video from a video card and puts it on a frame.
    When I try to put this in an appplet the sound streams through from the datasource but I can not get the visual aspect to come through.
    Are there any issues putting live video into an applet versus putting it into a frame? Are applets capable of
    displaying live video?
    Thanks
    Melissa

    You can display visual video components using JMF2.0 (Java Media Framework). You can call getVisualComponent() method of your Player and add it to a Frame on your applet. However the Player has to be realized b4 you can call the getVisualComponent. It's a little tricky, so let me know if you have problems realizing your player. I'm also looking for a Video Player Applet that does not require JMF. So let me know if you find one yourself :)

  • Web Cam applet is not working in great consistency

    Hi... My video capturing applet is not working very well.
    The image stream is displayed on the web page in JPEG format with 0.5 quality. However, it crashes after a while and the it does not release the vfw resource.
    I have to restart my machine in order to execute it again.
    Can anyone please help?
    Thanks.
    Carter

    Ok. Thanks.
    Sender Applet
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    /*<applet code="myGUIApplet.class" width="300" height="300"></applet>*/
    public class myGUIApplet extends JApplet implements ActionListener
         private JPanel bottom=new JPanel();
         private JPanel centVisual=new JPanel();
         private JPanel connectionAddress=new JPanel();
         private JButton capture=new JButton("Start Capturing");
         private JButton stops=new JButton("Stop");
         private JMenuBar menubar=new JMenuBar();
         private JMenu file=new JMenu("file");     
         private JMenuItem fileItem1=new JMenuItem("Exit");
         private JLabel serverip=new JLabel("Server IP");
         private JTextField setIP=new JTextField();
         public static JTextField ServerInfo=new JTextField();
         private MyTransmitter mytrans;
         private String ip;
         public static final String DEFAULT_MULTICAST_IP="226.10.10.20";
         public static final String DEFAULT_PORT="80";
         public void init()
              //setSize(400,400);               
              setLayout(new BorderLayout());
              menubar.add(file);
              file.add(fileItem1);
              bottom.setLayout(new BorderLayout());
              bottom.setBackground(Color.black);
              bottom.add("West",capture);
              bottom.add("East",stops);
              connectionAddress.setLayout(new BorderLayout());
              connectionAddress.add("North",serverip);
              connectionAddress.add("South",setIP);
              ServerInfo.setEditable(false);
              connectionAddress.add("Center",ServerInfo);
              setIP.addActionListener(this);
              setIP.setText("");
              capture.setBackground(Color.lightGray);
              capture.addActionListener(this);
              stops.addActionListener(this);
              fileItem1.addActionListener(this);
              add("South",bottom);
              add("North",menubar);     
              add("Center",connectionAddress);          
         public void actionPerformed(ActionEvent ae){
              Object source=ae.getSource();
              if(source==capture){
              if(setIP.getText().equals(""))
                        ip=DEFAULT_MULTICAST_IP;
              else{
                   ip=setIP.getText();
                   if(mytrans!=null){
                        mytrans.stopTransmitter();
                        mytrans=null;                         
                   System.out.println(" - Connecting to "+ip+" port: "+DEFAULT_PORT);
                   ServerInfo.setText(" - Connecting to "+ip+" port: "+DEFAULT_PORT);
                   mytrans=new MyTransmitter(ip,DEFAULT_PORT,ServerInfo);
                   mytrans.start();               
              if(source==stops){
                   if(mytrans!=null)
                        mytrans.stopTransmitter();
                   System.exit(0);
              if(source==fileItem1){
                   if(mytrans!=null)
                        mytrans.stopTransmitter();     
                   System.exit(0);
         public void destroy(){
              if(mytrans!=null){
                   mytrans.stopTransmitter();
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.util.*;
    import java.net.InetAddress;
    import javax.media.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.format.*;
    import javax.media.control.TrackControl;
    import javax.media.control.QualityControl;
    import javax.media.rtp.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.rtp.*;
    import java.io.InputStream;
    import javax.media.rtp.RTPManager;
    public class MyTransmitter extends Thread
         private MediaLocator videoLocator;
         private String ipAddress;
         private int basePort;
         private Integer stateLock=new Integer(0);
         private boolean failure;
         private Processor processor;
         private DataSource videoDataInput,videoDataOutput;
         private RTPManager rtpMgrs[];
         private VideoFormat JPEG_VIDEO=new VideoFormat(VideoFormat.JPEG_RTP);
         private SendStream sendStream;
         private SourceDescription descriptionList[];
         private JTextField infoField;
         public MyTransmitter(String ips,String ports,JTextField ServerInfo){
              infoField=ServerInfo;
              ipAddress=ips;
              Integer bPort=Integer.valueOf(ports);
              if(bPort!=null)
                   basePort=bPort.intValue();
         public void run()
              initializeVideo();
              if(videoLocator!=null){
                   createMyProcessor();
                   createMyManager();
              // May be should put inside the if..else statements
              //createMyTransmitter();
         // Initailize the video
         public void initializeVideo()
              // Stre the devices in a vector
              VideoFormat format=new VideoFormat(VideoFormat.RGB);
              Vector deviceList=CaptureDeviceManager.getDeviceList(format);
              CaptureDeviceInfo deviceInfo=null;
              // If there is more than one device detected
              if(deviceList.size()>0){
                   // Set the first device to device Info
                   // GEt the media locator of the devie
                   deviceInfo=(CaptureDeviceInfo)deviceList.elementAt(0);
                   videoLocator=deviceInfo.getLocator();
              }else{
                   System.out.println(" --X No device found...");
                   infoField.setText(" --X No device found...");
         public void createMyProcessor()
              boolean result=false;
              DataSource ds=null;
              // Check if the media locator is null
              if(videoLocator==null){
                   System.out.println(" --X No video locator..");
                   infoField.setText(" --X No video locator...");
              System.out.println(" - Trying to create a Processor..");
              infoField.setText(" - Trying to create a Processor..");
              // Attempt to create DataSource from media locator
              try{
                   ds=Manager.createDataSource(videoLocator);
              }catch(Exception ex){
                   System.out.println(" --X Unable to create dataSource : "+ex.getMessage());
              System.out.println(" - Video data source is created..");
              infoField.setText(" - Video data source is created..");
              // Try to create Processor from DataSource
              try{
                   processor=Manager.createProcessor(ds);
              }catch(NoProcessorException npe){
                   System.out.println(" --X Unable to create Processor: "+npe.getMessage());
                   infoField.setText(" --X Unable to create Processor: "+npe.getMessage());
              catch(IOException ioe){
                   System.out.println(" --X IOException creating Processor..");
                   infoField.setText(" --X IOException creating Processor..");
              // Wait for the processor to be configured
              result=waitForState(processor,Processor.Configured);
              if(result==false){
                   System.out.println(" --X Could not configure processor..");
                   infoField.setText(" --X Could not configure processor..");
              // Set the track controls for processor
              TrackControl []tracks=processor.getTrackControls();
              if(tracks==null || tracks.length<1){
                   System.err.println(" --X No track is found..");
                   infoField.setText(" --X No track is found..");
              // Set the content description of processor to RAW_RTP format
              // This will limit the supported formats to reported from
              // Track.getSupportedFormats() to valid RTP format
              ContentDescriptor cdes=new ContentDescriptor(ContentDescriptor.RAW_RTP);
              processor.setContentDescriptor(cdes);
              Format []supported;
              Format chosen=null;
              boolean atLeastOneTrack=false;
              for(int i=0;i<tracks.length;i++){
                   Format format=tracks.getFormat();
                   if(tracks[i].isEnabled()){
                        supported=tracks[i].getSupportedFormats();
                        // WE've set the output content to RAW_RTP.
                        // So, all the supporte formats should work with RAW_RTP.
                        // We will pick the first one.
                        if(supported.length>0){
                             if(supported[0] instanceof VideoFormat){                              
                                  chosen=checkVideoSize(tracks[i].getFormat(),supported[0]);
                             }else
                                  chosen=supported[0];
                             tracks[i].setFormat(chosen);
                             System.out.println(" Track "+i+" is transmitted in "+chosen+" format.. ");
                             infoField.setText(" Track "+i+" is transmitted in "+chosen+" format.. ");
                             atLeastOneTrack=true;
                        }else{
                             // If no format is suitable, track is disabled
                             tracks[i].setEnabled(false);
                   }else
                        tracks[i].setEnabled(false);          
              if(!atLeastOneTrack)
                   System.out.println("atLeastOneTrack: "+atLeastOneTrack);
                   System.out.println(" --X Could Not find track to RTP format..");
                   infoField.setText("atLeastOneTrack: "+atLeastOneTrack);
                   infoField.setText(" --X Could Not find track to RTP format..");
              result=waitForState(processor,Controller.Realized);
              if(result==false){
                   System.out.println(" --X Could NOT realize processor...");
                   infoField.setText(" --X Could NOT realize processor...");
              // Set the JPEG Quality to value 0.5
              setJPEGQuality(processor,0.5f);
              // Set the output Data Source
              videoDataOutput=processor.getDataOutput();
              //Start the processor
              processor.start();          
         public void setJPEGQuality(Processor p,float values)
              Control []cs=p.getControls();
              QualityControl qc=null;
              VideoFormat JPEGFmt=new VideoFormat(VideoFormat.JPEG);
              // Loop through the ocntrols to find the Quality control for the JPEG encoder
              for(int i=0;i<cs.length;i++){
                   if(cs[i] instanceof QualityControl && cs[i] instanceof Owned){
                        Object owner=((Owned)cs[i]).getOwner();
                        // Check if the owner is the Codec
                        // Check the format of output as well
                        if(owner instanceof Codec){
                             Format fmts[]=((Codec)owner).getSupportedOutputFormats(null);
                             // Loop through the supported format and set the quality to 0.5
                             for(int j=0;j<fmts.length;j++){
                                  qc=(QualityControl)cs[i];
                                  qc.setQuality(values);
                                  System.out.println(" - Quality is set to "+values+" on "+qc);
                                  infoField.setText(" - Quality is set to "+values+" on "+qc);
                                  break;
                   if(qc!=null)
                        break;
         public Format checkVideoSize(Format originalFormat,Format supported)
              int width,height;
              Dimension size=((VideoFormat)originalFormat).getSize();     
              Format jpegFormat=new Format(VideoFormat.JPEG_RTP);
              Format h263fmt=new Format(VideoFormat.H263_RTP);
              if(supported.matches(jpegFormat)){
                   width=(size.width%8 == 0 ? size.width:(int)(size.width%8)*8);
                   height=(size.height%8 == 0 ? size.height:(int)(size.height%8)*8);
              }else if(supported.matches(h263fmt)){
                   if(size.width<128){
                        width=128;
                        height=96;
                   }else if(size.width<176){
                        width=176;
                        height=144;
                   }else{
                        width=352;
                        height=288;
              }else{
                   // Unknown format, just return it.
                   return supported;
              return (new VideoFormat(null,new Dimension(width,height),Format.NOT_SPECIFIED,null,Format.NOT_SPECIFIED)).intersects(supported);
         public boolean waitForState(Processor p,Integer status)
              p.addControllerListener(new StateListener());
              failure=false;
              if(status==Processor.Configured){
                   p.configure();               
              }else if(status==Processor.Realized){
                   p.realize();
              //Wait until an event that confirms the success of the method, or failure of an event
              while(p.getState()<status && !failure){
                   synchronized(getStateLock()){
                        try{
                             // Wait
                             getStateLock().wait();
                        }catch(InterruptedException ie){
                             return false;
              if(failure)
                   return false;
              else
                   return true;
         public Integer getStateLock(){
              return stateLock;
         public void setFailure(){
              failure=true;
         public void createMyManager()
              SessionAddress destAddress;
              InetAddress ipAddr;
              int port;
              SourceDescription srcDesList[];
              PushBufferDataSource pbds=(PushBufferDataSource)videoDataOutput;
              PushBufferStream pbss[]=pbds.getStreams();          
              rtpMgrs=new RTPManager[pbss.length];          
              for(int a=0;a<pbss.length;a++){
              try{
                   // RTP Managers or RTP Manager?????
                   rtpMgrs[a]=RTPManager.newInstance();
                   port=basePort;
                   ipAddr=InetAddress.getByName(ipAddress);
                   SessionAddress localAddr=new SessionAddress(InetAddress.getLocalHost(),port+20);
                   destAddress=new SessionAddress(ipAddr,port,1);
                   Integer myipprefix=Integer.valueOf(ipAddress.substring(0,3));
                   if((myipprefix.intValue()>223) && (myipprefix.intValue()<240)){
                        rtpMgrs[a].initialize(destAddress);
                   }else{
                        rtpMgrs[a].initialize(localAddr);
                   rtpMgrs[a].addTarget(destAddress);
                   System.out.println(" Created RTP session: "+ipAddress+" "+port+" to "+destAddress);
                   infoField.setText(" Created RTP session: "+ipAddress+" "+port+" to "+destAddress);
                   if(videoDataOutput!=null){
                        sendStream=rtpMgrs[a].createSendStream(videoDataOutput,0);
                        sendStream.start();
                        System.out.println(" RTP stream is started..");
                        infoField.setText(" RTP stream is started..");
              }catch(UnsupportedFormatException ex){
                   System.out.println(" --X Unsupported Format : "+ex);
                   infoField.setText(" --X Unsupported Format : "+ex);
              catch(IOException ioe){
                   System.out.println(" --X IOException : "+ioe.getMessage());
                   infoField.setText(" --X IOException : "+ioe.getMessage());
              catch(Exception ex){
                   System.out.println(" --X Unable to create RTP Manager...");
                   System.out.println(ex.getMessage());
                   infoField.setText(" --X Unable to create RTP Manager..."+ex.getMessage());
         /*public void createMyTransmitter()
         try{
              if(videoDataOutput!=null){
                   sendStream=rtpMgrs[i].createSendStream(videoDataOutput,0);
                   sendStream.start();
         }catch(UnsupportedFormatException ex){
                   System.out.println(" --X Unsupported Format : "+ex);
                   infoField.setText(" --X Unsupported Format : "+ex);
         catch(IOException ioe){
                   System.out.println(" --X IOException : "+ioe.getMessage());
                   infoField.setText(" --X IOException : "+ioe.getMessage());
         public void stopTransmitter(){
              if(processor!=null){
                   processor.stop();
                   processor.close();
                   processor=null;
                   // Loop through RTP Managers and close all managers..
                   // Dispose them for garbage collection
                   for(int i=0;i<rtpMgrs.length;i++){
                        rtpmgrs[i].removeSendStream(this);
                        rtpMgrs[i].removeTargets("Session ended..");
                        rtpMgrs[i].dispose();
                   //rtpMgrs.removeTargets("Session ended..");
                   //rtpMgrs.dispose();
         * StateListener class to handle Controller events
         class StateListener implements ControllerListener{
              public void controllerUpdate(ControllerEvent ce){
                   if(ce instanceof ControllerClosedEvent){
                        processor.close();
                   /* Handle all controller events and notify all
                   waiting thread in waitForState method */
                   if(ce instanceof ControllerEvent){
                        synchronized(getStateLock()){
                             getStateLock().notifyAll();
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    Client Applet
    import javax.media.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.control.BufferControl;
    import javax.media.control.*;
    import javax.media.format.*;
    import javax.media.rtp.*;
    import javax.media.rtp.rtcp.*;
    import javax.media.rtp.event.*;
    import com.sun.media.rtp.RTPSessionMgr;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import java.net.URL;
    import java.net.Socket;
    /*<applet code="clientPlayerApplet.class" width="400" height="300">
         <param name=ServerIPS value="192.168.0.9">
         <param name=ServerPort value="80">
         <param name=TimeToLive value="1">
         <param name=archive value="clientPlayerApplet.jar">
    </applet> */
    public class clientPlayerApplet extends JApplet implements ControllerListener, ReceiveStreamListener,SessionListener
         String sessions[]=null;
         RTPManager rtpmgrs[]=null;     
         boolean dataReceived=false;
         Object myDataSync=new Object();
         private Player player;
         //private String serveripadd="226.10.10.20";
         //private int serverPort=2020;
         //private int timeToLive=1;
         private JPanel panel;
         private Vector currentParticipant;
         public void init()
              panel=new JPanel();
              setLayout(new BorderLayout());
              add("Center",panel);
              //String[] urls;
              /*urls[0]=getParameter("ServerIPS");
              urls[1]="/";
              urls[2]=getParameter("ServerPort");*/
              String []urls={new String(getParameter("ServerIPS")+"/"+getParameter("ServerPort")+"/"+getParameter("TimeToLive"))};
              sessions=urls;          
              initializePlayer();
         public void initializePlayer(){
              try{
                   InetAddress ipAddr;
                   SessionAddress localAddr=new SessionAddress();
                   SessionAddress destAddr;
                   rtpmgrs=new RTPManager[sessions.length];
                   currentParticipant=new Vector();
                   //rtpmgrs=new RTPManager();
                   SessionLabel session=null;
                   //Open RTP session
                   for(int i=0;i<sessions.length;i++){
                        try{
                             session=new SessionLabel(sessions[i]);
                             //session=new SessionLabel(sessions);
                        }catch(IllegalArgumentException iae){
                             System.out.println(" --X Unable to parse the sesion address given");     
                        System.out.println(" - Open RTP session for "+session.port);
                        rtpmgrs[i]=(RTPManager) RTPManager.newInstance();               
                        rtpmgrs[i].addSessionListener(this);
                        rtpmgrs[i].addReceiveStreamListener(this);
                        ipAddr=InetAddress.getByName(session.addr);
                        if(ipAddr.isMulticastAddress()){
                             localAddr=new SessionAddress(ipAddr,session.port,session.ttl);
                             destAddr=new SessionAddress(ipAddr,session.port,session.ttl);
                        }else{
                             localAddr=new SessionAddress(InetAddress.getLocalHost(),session.port);     
                             destAddr=new SessionAddress(ipAddr,session.port);
                        rtpmgrs[i].initialize(localAddr);
                        BufferControl bc=(BufferControl)rtpmgrs[i].getControl("javax.media.control.BufferControl");
                        if(bc!=null)
                             bc.setBufferLength(600);
                        rtpmgrs[i].addTarget(destAddr);
              }catch(Exception ex){
                   System.out.println(" --X Cannot create RTP Session "+ex.getMessage());
              long currentTime=System.currentTimeMillis();
              long waitingDuration=10000;
              try{
                   synchronized(myDataSync){
                        while(!dataReceived && (System.currentTimeMillis() - currentTime < waitingDuration)){
                             if(!dataReceived){
                                  myDataSync.wait(1000);
              }catch(Exception ex){
                   System.out.println(" --X myDataSync interrupted...");
              if(!dataReceived){
                   System.out.println(" No RTP Stream Data is received.." );               
         public void destroy()
              for(int i=0;i<currentParticipant.size();i++){
                   //if(player!=null)
                        ((MyPlayList)currentParticipant.elementAt(i)).close();
              // Loop through the RTP Managers
              // -> Remove the stream listener
              // -> Remove the target address
              // -> Dispose the RTP Manager for garbage collection
              currentParticipant.removeAllElements();
              for(int i=0;i<rtpmgrs.length;i++){
                   if(rtpmgrs[i]!=null){
                        rtpmgrs[i].removeReceiveStreamListener(this);
                        rtpmgrs[i].removeTargets(" Closing session..");
                        rtpmgrs[i].dispose();
                        rtpmgrs[i]=null;
         MyPlayList find(Player pl){
              for(int i=0;i<currentParticipant.size();i++){
                   MyPlayList mpl=(MyPlayList)currentParticipant.elementAt(i);
                   if(mpl.clientPlay==pl)
                        return mpl;
              return null;
         MyPlayList find(ReceiveStream rs){
              for(int i=0;i<currentParticipant.size();i++){
                   MyPlayList mpl=(MyPlayList)currentParticipant.elementAt(i);
                   if(mpl.stream==rs)
                        return mpl;
              return null;
         *     ReceiveStream Listener function                    *
         public synchronized void update(ReceiveStreamEvent rse)
              RTPManager mgr=(RTPManager)rse.getSource();
              ReceiveStream stream=rse.getReceiveStream();
              Participant participant=rse.getParticipant();
              if(rse instanceof RemotePayloadChangeEvent){
                   System.out.println(" -- Received Payload Change Event..");
                   System.out.println(" Sorry, no payload change is allowed.");               
              }else if(rse instanceof NewReceiveStreamEvent){
                   try{
                        // Once the new stream is detected, create the datasource
                        stream=((NewReceiveStreamEvent)rse).getReceiveStream();
                        DataSource outputDS=stream.getDataSource();
                        // Get RTP Controller to find the format
                        RTPControl rtpctl=(RTPControl)outputDS.getControl("javax.media.rtp.RTPControl");
                        if(rtpctl!=null){
                             System.out.println(" -> Received new rtP stream: "+rtpctl.getFormat());
                        }else
                             System.out.println(" -> Received new RTP stream");
                        if(participant!=null){
                             System.out.println(" -> New stream received from: "+participant.getCNAME());
                        }else{
                             System.out.println(" -> New stream detected... ");
                        player=Manager.createPlayer(outputDS);
                        if(player==null)
                             return;
                        System.out.println(" - Player is created...");
                        player.addControllerListener(this);
                        player.realize();
                        // Helper class to identify the player and stream
                        MyPlayList mpl=new MyPlayList(player,stream);
                        // Add the helper class object to Vector
                        currentParticipant.addElement(mpl);
                        // Notify initializePlayer() that a new stream has arrived
                        synchronized(myDataSync){
                             dataReceived=true;
                             myDataSync.notifyAll();
                   }catch(Exception ex){
                        System.out.println(" --X NewReceiveStream Exception: "+ex.getMessage());
                        return;
              }else if(rse instanceof ByeEvent){
                   System.out.println(" - BYE packet received from "+participant.getCNAME());
                   MyPlayList mpls=find(stream);
                   if(player!=mpls){
                        mpls.close();
                        currentParticipant.removeElement(mpls);
                   if(mgr!=null){
                        mgr.removeReceiveStreamListener(this);
                        mgr.removeTargets(" Closing session..");
                        mgr.dispose();
                        mgr=null;
              }else if(rse instanceof StreamMappedEvent){
                   if(stream!=null && stream.getDataSource()!=null){
                        DataSource myds=stream.getDataSource();
                        RTPControl rtpctrl=(RTPControl)myds.getControl("javax.media.rtp.RTPControl");
                        System.out.println(" -> The previously unidentified stream ");
                        if(rtpctrl!=null)
                             System.out.println(" "+rtpctrl.getFormat());
                        System.out.println(" has been identified as sent by :"+participant.getCNAME());
         *           Session Listener
         public void update(SessionEvent sesevt)
              if(sesevt instanceof NewParticipantEvent){
                   Participant part=((NewParticipantEvent)sesevt).getParticipant();
                   System.out.println(" -> A new partcipant has joined :"+part.getCNAME());
         *     ControllerListener for Players          
         public synchronized void controllerUpdate(ControllerEvent ce)
              Player p=(Player)ce.getSource();
              if(p==null)
                   return;
              if(ce instanceof RealizeCompleteEvent){
                   MyPlayList mpls=find(p);
                   if(mpls!=null){
                        p.start();
                        if(p.getVisualComponent()!=null){
                             panel.add(player.getVisualComponent());
                             panel.validate();
              if(ce instanceof ControllerErrorEvent){
                   p.removeControllerListener(this);
                   MyPlayList mpls=find(p);
                   if(mpls!=null){
                        // Close the player
                        // Remove the player helper class object from the list
                        p.close();
                        currentParticipant.removeElement(mpls);
                   System.out.println("Receiver internal error: "+ce);
         class SessionLabel{
              public String addr=null;
              public int port;
              public int ttl;
              SessionLabel(String session) throws IllegalArgumentException
                   int off;
                   String portStr=null;
                   String ttlStr=null;
                   if(session!=null && session.length() >0){
                        while(session.length()>1 && session.charAt(0)=='/')
                             session=session.substring(1);
                        off=session.indexOf('/');
                        if(off==-1){
                             if(!session.equals(""))
                                  addr=session;
                        }else{
                             addr=session.substring(0,off);
                             session=session.substring(off+1);
                             off=session.indexOf('/');
                             if(off==-1){
                                  if(!session.equals(""))
                                       portStr=session;
                             }else{
                                  portStr=session.substring(0,off);
                                  session=session.substring(off+1);
                                  off=session.indexOf('/');
                                  if(off==-1){
                                       if(!session.equals(""))
                                            ttlStr=session;
                                  }else{
                                       ttlStr=session.substring(0,off);
                   if(addr==null)
                        throw new IllegalArgumentException();
                   if(portStr!=null)
                        try{
                             Integer ints=Integer.valueOf(portStr);
                             if(ints!=null)
                                  port=ints.intValue();
                        }catch(Throwable t){
                             System.out.println(" --X PortStr Error..");
                             throw new IllegalArgumentException();
                   }else
                        throw new IllegalArgumentException();
                   if(ttlStr!=null){
                   try{
                        Integer intsttl=Integer.valueOf(ttlStr);
                        if(intsttl!=null)
                             ttl=intsttl.intValue();
                   }catch(Throwable t){
                             System.out.println(" --X PortStr Error..");
                             throw new IllegalArgumentException();
         class MyPlayList{
              Player clientPlay;
              ReceiveStream stream;
              MyPlayList(Player p,ReceiveStream rs){
                   clientPlay=p;
                   stream=rs;
              public void close()
                   clientPlay.close();

  • Flash Player linux, grey box issue (youtube vids and some applets do not display)

    I posted this question on my distro-specific forum as well as linuxquestions.org, however it appears to  be a unique problem, so here it is:
    When viewing videos on youtube.com, most other websites, and when trying  to run certain flash games, the flash applet will not display (though  the audio will play). Instead of displaying the flash applet, there  will be a grey box where the flash video or applet would normally be.
    This problem occurs on Firefox and Chromium, but not on Opera.
    My Specs are as follows:
    Distro: PCLinuxOS 2010 (32-bit)
    flash-player-plugin: 10.1-2pclos2010
    firefox: 3.6.6-1pclos2010
    swfdec has never been installed (to my knowledge)
    I did a lot of investigating about the problem but have turned up no  solutions thus far. Here are my results.
    Flash videos and applets which allow  access to the settings menu (like youtube played from their website) do  not display, however flash videos and applets which do NOT allow access  to the settings menu (including youtube videos embedded in other  websites) WILL display.
    Reinstalling flash-player-plugin and firefox through synaptic does  not solve the problem (though note that PCLOS works with rpm files, not  deb files. apt4rpm does not support the remove --purge operation,  however reinstalls are said to overwrite custom configs with stock  ones.)
    Creating a new firefox profile and/or starting FFox in safe-mode  does not solve the problem
    Creating another user and running FFox from that user will  properly display flash videos
    Comparing default plugins between my main user and new user shows  that there is no difference. So this likely rules out a defective  extension or plugin binary.
    Deleting ~/tmp/plugtmp* folders when FFox is closed does not solve  the problem.
    Removing the ~/.macromedia and ~/.adobe folders does not solve the  problem. (have checked permissions between the new test user and main  user, and they are equivalent)
    Downloading libflashplayer.so from the Adobe website and copying it  to /usr/lib/mozilla/plugins has no effect on the problem.
    I'm thinking that there might be somewhere else that flash stores  configurations for my user, and that maybe the settings there are  corrupted and would need to be purged. However frantic googling has  turned up nothing useful so far.
    Does anyone have any suggestions for me?

    The problem, at least in my case, was QtCurve's opacity. If I have opacity set to less than 100%, flash would not display for sites like Youtube and Vimeo, but worked elsewhere.
    The solution for me was to go into qtcurve's settings, and put npviewer.bin in the application exceptions section for window and menu opacity. Doing that, I was able to keep my transparent menus, and also use flash everywhere.
    You can find out what the application name is by launching your browser of choice in a terminal with qtcurve debug turned on, like so:
    QTCURVE_DEBUG=1 firefox
    If you watch through the lines that start with "QtCurve" you'll see "Application name". Look for the one that shows up when you try to load a video. In my case it was npviewer.bin. In yours, it might be nspluginviewer or something else. If you add an exception for that specific application, you'll fix your problem without having to compromise on your theme.

  • How To Insert Video

    Hi
    I have created a video to put on my websites home page.
    However, when I try to insert it using Dreamweaver it doesn't play.
    In dreamweaver which is the best option to insert a video?:-
    Insert flash,
    flash video - progressive download video or streaming video
    shockwave,
    applet,
    active x or
    plugin.
    And is there any particular format I need the video to be in?
    Thanks for your help,
    Louisa

    Streaming Media Tutorials:
    www.mediacollege.com/video/streaming/
    FLV/SWF is well supported by most browsers & systems.
    It's the file type
    used on YouTube, Google Video and MySpace.
    --Nancy O.
    Alt-Web Design & Publishing
    www.alt-web.com
    "LoobieLouLou" <[email protected]> wrote in
    message
    news:fctlml$91l$[email protected]..
    > Hi
    >
    > I have created a video to put on my websites home page.
    However, when I
    try to
    > insert it using Dreamweaver it doesn't play.
    > In dreamweaver which is the best option to insert a
    video?:-
    > Insert flash,
    > flash video - progressive download video or streaming
    video
    > shockwave,
    > applet,
    > active x or
    > plugin.
    > And is there any particular format I need the video to
    be in?
    >
    > Thanks for your help,
    > Louisa
    >

  • Question - applet using JMF for playing .mov

    I develop an applet using JMF for playing .mov. It works fine, and the applet starts normally. Even my applet works fine from other computers in our LAN (The applet runs ok without JMF). But only on one PC it doesn't work and I get the following message
    Failed to configure: com.sun.media.PlaybackEngine@a7c45e
    Bad header in the media: moov atom not present
    Error: Unable to realize com.sun.media.PlaybackEngine@a7c45e
    FATAL ERROR: Failed to realize: failed to parse the input media.
    Exception in thread "JMF thread: SendEventQueue: com.sun.media.content.unknown.Handler" java.lang.Error: Failed to realize: failed to parse the input media.
    at PlayerApplet.Fatal(PlayerApplet.java:201)
    at PlayerApplet.controllerUpdate(PlayerApplet.java:191)
    at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254)
    at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
    at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQueue.java:65)
    at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)
    My html:
    <html>
    <head><title>PlayerApplet</title></head>
    <body>
    <applet code="PlayerApplet.class" archive="fobs4jmf.jar, customizer.jar, jmf.jar, mp3plugin.jar, sound.jar, multiplayer.jar, mediaplayer.jar" width=640 height=510>
    <param name=file value="safexmas.mov">
    </applet>
    </body>
    </html>
    Anyone can help me?
    Thanks for your time

    It started to work but I had to install fobs4jmf on the client computer.
    And put .dll to windows/system33 directory. But how can I play video using applet in browser without installing any software on the client machine?

Maybe you are looking for

  • FCP and new MacBook Pro

    I've heard that Final Cut Pro will not work on the new Mac Book Pro laptops. Has anyone else heard this? It may take some time before they get an upgrade fror this. I'm keen to upgrade from my 17" Powerbook G4 to the new MacBook Pro for video editing

  • SRM 5.0 - Non-replication of Blocked Vendors from R/3 to EBP

    Hi Team, We are using SAP SRM 5.0 for e-procurement. Issue: The R/3 vendor is transferred to SRM for creation of bidder ID for e-procurement. Presently there is no check/warning message in the system while transferring blocked vendor from R/3 to SRM

  • Re-image computer with no user interaction at all - SCCM 2012

    I have searched many posts and havent found a clear solution for my question. Basically, I have OSD task sequence ready to go on my SCCM 2012 R2. It is fine to run it as "Available". If I deploy the OSD through Software Center as "Required" and "ASAP

  • No sound unless plugged into speakers.  Side controls also don't work.

    Volume side controls do not work and I do not have any sound unless plugged into external speakers.  I have also tried to see if the speakers were muted in the control panel and they are not.

  • How to open app in iTunes on mac

    Can anyone tell me how to open new app that I downloaded from iTunes Store on my mac computer