4 Replies Latest reply: Aug 24, 2012 10:56 AM by 957842 RSS

    jmf video capture in an Applet

    830333
      Hello
      I use netBeans 6.9.1 and would like to use JMF and the webcam capture JMF function in my applet
      but Iget a no permission error see below
      How can I get out of that?
      Thank you
      Fred

      Public class SourceCam extends java.applet.Applet implements Runnable {

      public int wmax,hmax,ix, x1, y1, x2, y2,y3,y4=0;
      public double yc1=0.0,yc2=0.0, yc3=0.0,yc4=0.0,yc5=0.0,yc6=0.0;
      Color colors[] = new Color[50];
      int[] couleur=new int[50];
      Thread runner;
      Frame f=new Frame("Stimulated Polarized Light @FF ");
      public static Player player = null;
      public static MediaPlayer MediaPlayer1=null;
      public CaptureDeviceInfo di = null;
      public MediaLocator ml = null;



      run:
      java.lang.RuntimeException: No permission to capture from applets
      java.lang.RuntimeException: No permission to capture from applets
      javax.media.NoPlayerException: Error instantiating class: com.sun.media.protocol.vfw.DataSource : java.lang.RuntimeException: No permission to capture from applets
      at javax.media.Manager.createPlayerForContent(Manager.java:1362)
      at javax.media.Manager.createPlayer(Manager.java:417)
      at javax.media.Manager.createRealizedPlayer(Manager.java:553)
      at org.me.light.SourceCam.init(SourceCam.java:58)
      at sun.applet.AppletPanel.run(AppletPanel.java:424)
      at java.lang.Thread.run(Thread.java:662)
        • 1. Re: jmf video capture in an Applet
          793415
          The applet will need to be digitally signed by the developer, and trusted by the end user (when prompted to trust the applet, they click 'OK').
          • 2. Re: jmf video capture in an Applet
            captfoss
            In addition to those things mentioned by Andrew above, which are true for generic applets, JMF has its own set of security settings.

            http://www.oracle.com/technetwork/java/javase/index-135148.html#jmf2-applet-run

            Specifically, you'll need to set a couple permissions as described in the above link to tell JMF that it should allow you to capture from an applet.

            Additionally, you'll have to have JMF installed on the system that's running the applet, or you won't end up with any capture devices you can capture from...
            • 3. Re: jmf video capture in an Applet
              830333
              I did that already
              i.e. what is written in


              Q: Can I capture audio or video from within an Applet with JMF 2.1.1?

              By default (for security reasons), JMF 2.1.1 does not allow capture from an applet. The user can turn this on by using JMFRegistry.

              Run "java JMFRegistry", select the UserSettings tab and check "Allow Capture From Applets". If the browser's security permits loading native libraries, then you will now be able to capture audio/video from an applet.


              but the program lines

              try
              {
              player = Manager.createRealizedPlayer(ml);
              FormatControl formatControl = (FormatControl)player.getControl("javax.media.control.FormatControl");
              Component co = formatControl.getControlComponent();
              Thread.sleep(2000);
              player.start();
              }

              give always the same error
              java.lang.RuntimeException: No permission to capture from applets
              java.lang.RuntimeException: No permission to capture from applets

              why?
              I am working inside the netbeans 6.9.1 editor
              • 4. Re: jmf video capture in an Applet
                957842
                Hello.
                I use Netbeans, windows 7 and jmf.
                I have the same problem. I have made the following experience:
                When i run an applet which trys to create a Player in firefox i get the same exception as you. But when i run the firefox in amdinistrator-modus the applet is able to create the Player and no exception is thrown.
                But anyway, only firefox shows this behavoiur. Opera throws an exception in both cases (administator-modus and non-administrator-modus).
                Has anyone else figured it out?