JMF and keylistener

I guys, i'm new in jmf (fobs)world. I have coding a simple video player. My question is:
is it possible to stop/play/pause the video whit keyboard? I'm thinking about keylistener but while the video is playing i can't I am not able to access the function to stop the video flow (is JMF blocking?).
thanks in advance and sorry for my bad English
regards.
emanuele

post your JMF question on that forum:
http://forum.java.sun.com/forum.jspa?forumID=28

Similar Messages

  • JMF and Windows 7

    I have a program using JMF which worked fine on XP and Vista but is behaving very oddly on Windows 7.
    The program displays two mpg files synchronised with each other and I also control the playback speed. This has worked fine for 18 months.
    On Windows 7 I still see two videos but the speed control doesn't work and one or other of the videos (appears random which one) splits vertically in the middle and I see it compressed both above and below the split. Is anyone else having problems with JMF and Windows 7?
    jdk 1.6.0_13
    jmf 2.1.1e
    Heaps of memory - 4Gb
    Edited by: Leo--- on Nov 1, 2009 9:32 PM
    Edited by: Leo--- on Nov 2, 2009 11:53 AM

    The last version of Windows that JMF lists as supported is Windows 2000.
    Most of the codec support in the Windows Performance Pack are native codecs, meaning they're precompiled DLL libraries. DLLs from one Windows version often times aren't compatible with any other Windows versions, so it's actually quite amazing JMF worked with XP or Vista, at all.
    It sounds like what you're experiencing is simply DLL incompatibility using Windows 5 libaries on a Windows 7 system...

  • Javafx use jmf and capture audio device

    Hello, I noticed a problem with the use JavaFX and Java Media Framework (JMF), in a project javafx call Java classes using JMF, but are not recognized PC audio devices, in fact when I executed 's the code CaptureDeviceManager.getDeviceList (null), displays the error: "could not commit protocolPRefixList", without recognizing any audio device. Instead I call if my application using JMF, outside of a JavaFX project, the devices are found and everything works properly, perhaps this problem depends on the security settings of JavaFX, or inability to use JavaFX is that jmf interfaces with audio and video devices?
    thanks for the help

    I'd use jmf and javafx but it was not for capture devices.
    If you use jmf there are native libraries.
    The thing i found was about the java.library.path wich is overriden when you start javafx that jmf can't load approriate libs.
    Try to compare the System.getProperties for java and javafx then you should find where is the problem.

  • JMF and Darwin Streaming Server.

    I have darwin streaming the sample files.
    I use JMF to connect to darwin.
    The connection is made, The server knows Jmf is connected , the server streams, verified with packet monitor.
    The problem is that JMFStudio just does not start playing the video.
    Any one know why, or have it working??

    One strange thing I noticed, is that while monitoring jmfstudio transmit to jmfstudio across network,
    I use ETHEREAL to monitor the packets, and ports being used. ETHEREAL usually just picks JMF RTP packets as UDP, which is right, but.....
    DSS5 even though JMF is connected across lan to DSS5 the picture does not show.
    WHile monitoring the packets, ETHEREAL picks the DSS5 packet s as RTP and every 20th RTCP.
    So, what i am thinking is the DSS5 RTP packetizer is of better quality than JMF, and the result is that JMF is not fully aware of the 'true' specifications of RTP.
    maybe......

  • Not able to recognize any video/audio devices using jmf and java soun

    Hi ,
    I need one help from your side.
    Here I am expecting some clarifications from you. Before that let you my environement.
    My working environment :
    Eclipse tool and added jmf jar to my project I did not do any thing more.
    If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
    Please bare with my questions.
    1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
    ( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
    Do we need any administrives rights for our working PC.
    What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
    If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
    2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
    I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
    I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
    ( like for TragetdataLine ...i,e, all ports are getting false)
    I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
    With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
    3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
    In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
    Can you explain the reasons ? I gone through API but i am not clear.
    HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
    Thanks
    RamaRao.G

    Hi ,
    I need one help from your side.
    Here I am expecting some clarifications from you. Before that let you my environement.
    My working environment :
    Eclipse tool and added jmf jar to my project I did not do any thing more.
    If any thing I need to do just let me know. My target platform is MAC & UBUNTU.
    Please bare with my questions.
    1) I am not able to recognize any video/audio devices using jmf and java sound APIs on My system.
    ( I checked with the app mentioned in the http://www.java-forums.org/new-java/11201-jmf-cannot-connect-device.html )
    Do we need any administrives rights for our working PC.
    What is the procedure/ setup I need to follow from a java application to enable particular audio/video device since I dont about end-user system setup right.
    If possible send some sample code to recognize /r detect audio device ( voice input ). It should run on both MAC and UBUNTU.
    2) I run the one sample audio recording application of this link (http://www.jsresources.org/examples/SimpleAudioRecorder.java.html) which is provided by YOU.
    I got output audio file and able to hear voice on UBUNTU system but not able to hear voice on MAC system.
    I heared that default line in ( audio setup of the sys) is wont take any voice data on MAC.Why I made this stmt means we are getting false when using isSupported methods of JAVA SOUND API.
    ( like for TragetdataLine ...i,e, all ports are getting false)
    I have one sample audio recording app implemented by QUICKTIME API. In this case also he taking audio ftom device only using quicetime API.
    With that we are able to record and hear audio ( voice input --> not line in , external device we added some thing like SSB...)
    3) In case of Video capturing DataSource, Streams are implemented by PullBufferDataSource , PullBufferStream intefaces used.
    In case of Audio capturing DataSource, Streams are implemented by PushBufferDataSource, PushBufferStream intefaces used.
    Can you explain the reasons ? I gone through API but i am not clear.
    HOPE I WILL BE CLARIFIED EVERY THING FROM YOU.
    Thanks
    RamaRao.G

  • Problem with  M-JPEG by using JMF and JPEGCodec .

    Hi, there,
    I want to implement a M-JPEG using JMF and JPEGCodec, is that possible?(I already been trapped)
    My problem is I have a video clip which is a AVI file, the video format is following:
    Video format: RGB, 160x120, FrameRate=14.9, Length=57600, 24-bit, Masks=3:2:1, P
    ixelStride=3, LineStride=480, Flipped.
    I already convered a frame to an Image object(video format with JPEG and CVID doesn't work) ,
    I can also convert this Image back as a Buffer, It works fine with me .But to use JPEGCodec( provided by com.sun.image.codec.jpeg ) I need to convert an Image to a BufferedImage, I use the following defination:
    BufferedImage   bImage = new BufferedImage(frameImage.getWidth(null), frameImage.getHeigh(null),BufferedImage.TYPE_INT_RGB); It seems work, But when I use JPEGImageEncoder to encoder this bImage and save as a jpg file,
    everything is black .
    I also need to cast BufferedImage to an Image: frameImage = (Image) bImage; then I convert frameImage back to Buffer.My video clip still running , but every frame now became black .
    can someone help me? thanks in advance.

    I solved this problem . But I met a new problem.
    I converted the above video clip into a JPEG and I want to create a DataSink for it. the messege is:
    Video format: JPEG, 160x120, FrameRate=12.0, Length=3574
    - set content descriptor to: AVI
    - set track format to: JPEG
    Cannot transcode any track to: JPEG
    Cannot create the DataSink: javax.media.NoDataSinkException: Cannot find a DataS
    ink for: com.sun.media.multiplexer.RawBufferMux$RawBufferDataSource@2b7eea
    Transcoding failedHope some Java Experts can help me.
    Regards.

  • JMF and SWT

    This has probably been discussed a million times but I'm really struggling with it. I'm creating an SWT application built on the eclipse rcp, and I'm trying to add a video player to a view.
    I have been trying to add a MediaPlayer bean to the view, that will for the time being, just play a short clip from my hard-drive. I've created a new AWT frame for it to live in, and have successfully managed to add this to the view.
    However, when I try and add my MediaPlayer bean, I am faced with the following exception:
    java.lang.NoClassDefFoundError: javax/media/bean/playerbean/MediaPlayerThe jmf.jar has been added to my project, and I have added the following to my product VM arguments:
    -Djava.library.path=C:\\WINDOWS\\system32Can anyone help me out with fixing this problem?

    Did you eventually get this to work?
    I am looking at developing a simple bespoke player using SWT and JMF and was wondering if you could give me any pointers to start,
    Thanks
    Jonathan

  • Educational Use of JMF and J2ME WTS

    Dear all,
    I have tried to find legal information about education use of JMF and J2ME WTS. I want to install these two packages in the computers of a tutorial room for student use.
    Would any kind soul please enlighten me where I can get such information?
    Thank you.
    Cheers,
    Andrew Lui
    The Open University of Hong Kong

    Maybe from Sun? If it's not mentioned in the terms and conditions of the libraries or their download sites, I wouldn't know where else to get more information.

  • JMF and video capture card?

    i wanna ask how can i usea video capture card with the jmf and record video
    i try to detect my capture card but the jmf didnt detecte it please pleas help me

    hi,
    i use a tv-card with my camera through linking them with a composite cable. Also, my tv card has capturing capability and i use JMF to do a capture program with these tools and the result is good for me. The monitor.zip file wihich contains a sample of capturing and monitoring simultaneously exists on sun.com. I use it and it was very helpfull for me.
    JMF detects cards through its 'CaptureDeviceManager' which is a controller type object. If you specify like Vector devices = CaptureDeviceManager.getDeviceList(null) -> You will be get the list of appropriate devices on your pc.
    Regards,
    Erohan

  • JTextField and keyListener

    I'm trying to create an easy way of inputting data in a JTextField. I have a column of textfields, each requiring fixed-length data-input, and the idea is that the user types series of two digits continuously, without having to press ENTER or TAB between them to go to the next textfield. For this I have created a keyListener, in which the length of the textfield is checked. Strangely enough, the length of the textfield always seems to be lagging one character. For instance, I have entered a "1" (which de keyListener registers without fail), but when I check the length of the textfield in the keyListener, it returns 0, and if you do a system-output of the textfield getText, you get an empty string. If I next enter a "2", the length of the textfield is 1 according to the listener, the system-output shows "1", and so on. I am doing anything wrong?

    Well, my point was to post the code that you tested. People make stupid mistakes like using:
    public void KeyReleased(KeyEvent e)
    Note: the capital "K". If you don't post the code you use then we can't help. Myself and others do not have a problem using the keyReleased() method.
    Here's is some working code. It enables/disables some buttons based on whether text is entered in the "Find" text field:
    http://www.discoverteenergy.com/files/FindReplace.java

  • JMF and the Darwin Streaming Server

    Has anyone been successful in getting the JMF JMStudio to work with
    the Darwin Streaming Server? I have set up Darwin on my computer and
    encoded a sample .mov file using a codec that is supposed to be
    compatible with JMF, the H.263. I was able to view this file inside
    JMStudio if I opened it directly as a file. I was also able to stream
    this file via the server using the Quicktime movie player by opening
    URL to rtsp://localhost/test.mov
    However, when I go into JMStudio's Open URL, and put in
    rtsp://localhost/test.mov, I get an error message saying:
    Controller Error:
    Failed to realize: Server is not responding.
    I am using JMF Version 2.1.1e and the Apple Darwin Streaming Server
    5.0
    If anyone has any suggestions, please let me know. Also, let me know
    if there is another streaming server, preferably open source, that
    works well with JMF.
    thanks.

    your doing local host, JMF needs to receive rtp on
    port XXXX, now if you are receivng on port XXXX the
    server maybe trying to send on the same port , or
    maybe it's trying to send the RTCP data.
    Does darwin use RTCP ?? and also I would try from
    second computer , as JMF sends, receives on same port.I am pretty sure all the ports are set up correctly. I have tried connecting from another computer and run into the same issues. Also, I was able to view the movie just fine from the same computer (connecting to itself) using the Quicktime Java package provided by Apple. I've been able to view movies in quicktime using the RTSP protocol

  • JSplitPane Active Side and KeyListener

    I have a JSplitPane as my root in a JFrame. The left side is a JTabbedPane and the right is a custom JPanel. The JPanel has its own KeyListener implemented; however key strokes are going to the left JTabbedPane. If i switch the two sides, putting the custom JPanel on the left, the keystrokes work as desired. This is not the most desirable fix though. Does anyone know how to change the "active" side of the JSplitPane?

    The JPanel has its own KeyListener implemented; however key strokes are going to the left JTabbedPane.I find this hard to believe. I'm guessing your have a programming bug and since you didn't post any code I don't know how we can help you.
    Post your [url http://www.physci.org/codes/sscce.jsp]Simple Executable Demo Code so we can see this unwanted behaviour.

  • JMF and X session

    Hi All,
    I am currently working on a XML-RPC related program which plays sound on the server using JMF. The funniest thing is that if I ssh to the server with X session enabled, for example, in linux, I go "ssh -Y root@server" and then run the program, everything works fine. However, If I just do a plain ssh without X session, the program returns me the error message as follows:
    javax.media.NoPlayerException: Cannot find a Player for :file:/usr/java/jdk1.5.0_05/sounds/testsound.wav
    at javax.media.Manager.createPlayerForContent(Manager.java:1412)
    at javax.media.Manager.createPlayer(Manager.java:417)
    at javax.media.Manager.createPlayer(Manager.java:332)
    at JMFSound.JMFPlay(JMFSound.java:13)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.apache.xmlrpc.Invoker.execute(Invoker.java:130)
    at org.apache.xmlrpc.XmlRpcWorker.invokeHandler(XmlRpcWorker.java:84)
    at org.apache.xmlrpc.XmlRpcWorker.execute(XmlRpcWorker.java:146)
    at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:139)
    at org.apache.xmlrpc.XmlRpcServer.execute(XmlRpcServer.java:125)
    at org.apache.xmlrpc.WebServer$Connection.run(WebServer.java:746)
    at org.apache.xmlrpc.WebServer$Runner.run(WebServer.java:626)
    at java.lang.Thread.run(Thread.java:595)
    I don't really have any idea about what's going on.
    Please help. Any advise will be appreciated.
    Dadi

    Thanks for the reply.
    The ssh part is just part of my troubleshooting because that piece of program worked fine in Windows. Therefore I was suspecting that there is something to do with X or, JMF needs some graphical stuff. I'll probably put it into rc.local at the end once I get it working so whether ssh is fixed is not the main concern.
    I don't really know what to check at the moment.

  • Help needed with JMF and FFMPEG

    Hi, im using Jave which is a wrapper libraray for FFMPEG to encoded videos and im also using JMF to take snapshots of the video to save as thumbnails. All the code I have works except that I cant get Jave(FFMPEG) to encoded the videos in to a format that JMF can handle. Does any body know a format or codec that Jave(FFMPEG) can use to get JMF to handle the videos.
    Cheers, any help will be much apprecitated.

    One solution to most of your questions : Read the advanced table section of Dev guide.
    Always go through the dev guide before putting up the issue. Let the forum be for those scenarios which dev guide doesn't covers in much detail.
    --Shiv                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Re: JMF and rendering formats with a processor

    Don't ask me how it works, I don't know :-). Got it from somewhere I don't remember.
    package gui;
    // Fig 21.6: MediaPanel.java
    // A JPanel the plays media from a URL
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.util.List;
    import java.io.IOException;
    import java.net.URL;
    import javax.media.CannotRealizeException;
    import javax.media.Codec;
    import javax.media.ConfigureCompleteEvent;
    import javax.media.ControllerEvent;
    import javax.media.ControllerListener;
    import javax.media.EndOfMediaEvent;
    import javax.media.Manager;
    import javax.media.NoPlayerException;
    import javax.media.PrefetchCompleteEvent;
    import javax.media.Processor;
    import javax.media.RealizeCompleteEvent;
    import javax.media.ResourceUnavailableEvent;
    import javax.media.UnsupportedPlugInException;
    import javax.media.control.TrackControl;
    import javax.media.format.VideoFormat;
    import javax.swing.JPanel;
    public class MediaPanel extends JPanel implements ControllerListener
       Processor processor = null;
       Component visualComponent = null;
       Component controlPanel = null;
       List<Codec> effects = null;
       Object waitSync = new Object();
       boolean stateTransitionOK = true;
       public MediaPanel() {
            Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, true);
            setLayout(new BorderLayout());
       public MediaPanel( URL mediaURL )  {
           this();
          open(mediaURL);  
       public void setEffects(List<Codec> aEffects) {
            effects = aEffects;
       public List<Codec> getEffects() {
            return effects;
       public void open(URL mediaURL) {
            try {
                   if(processor != null) {
                        processor.stop();
                        processor.close();
                        remove(visualComponent);
                        remove(controlPanel);
                  // create a player to play the media specified in the URL
                  processor = Manager.createProcessor( mediaURL );
                  processor.addControllerListener(this);
                  processor.configure();
                  if (!waitForState(Processor.Configured)) {
                       throw new Exception("Failed to configure the processor.");
                  processor.setContentDescriptor(null);
                   // Obtain the track controls.
                   TrackControl tc[] = processor.getTrackControls();
                   if (tc == null) {
                       throw new Exception("Failed to obtain track controls from the processor.");
                   // Search for the track control for the video track.
                   TrackControl videoTrack = null;
                   for (int i = 0; i < tc.length; i++) {
                       if (tc.getFormat() instanceof VideoFormat) {
                   videoTrack = tc[i];
                   break;
              if (videoTrack == null) {
              throw new Exception("The input media does not contain a video track.");
              System.err.println("Video format: " + videoTrack.getFormat());
              // Instantiate and set the frame access codec to the data flow path.
              try {
              if(effects != null && ! effects.isEmpty()) videoTrack.setCodecChain((Codec [])effects.toArray(new Codec[effects.size()]));
              } catch (UnsupportedPlugInException e) {
              throw new Exception("The processor does not support effects.");
              processor.prefetch();
              if(!waitForState(Processor.Prefetched)) {
                   throw new Exception("Failed to realize the processor");
         // get the components for the video and the playback controls
         visualComponent = processor.getVisualComponent();
         controlPanel = processor.getControlPanelComponent();
         setLayout(new BorderLayout());
         if ( visualComponent != null )
              add( visualComponent, BorderLayout.CENTER ); // add video component
         if ( controlPanel != null )
         add( controlPanel, BorderLayout.SOUTH ); // add controls
         validate();
         } catch ( NoPlayerException noPlayerException ) {
              System.err.println( "No media player found" );
         } catch ( CannotRealizeException cannotRealizeException ) {
              System.err.println( "Could not realize media player" );
         } catch ( IOException iOException ) {
              System.err.println( "Error reading from the source" );
         } catch (Exception e) {
              System.err.println(e.getMessage());
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt) {
         if (evt instanceof ConfigureCompleteEvent ||
                   evt instanceof RealizeCompleteEvent ||
                   evt instanceof PrefetchCompleteEvent) {
              synchronized (waitSync) {
                   stateTransitionOK = true;
                   waitSync.notifyAll();
         } else if (evt instanceof ResourceUnavailableEvent) {
              synchronized (waitSync) {
                   stateTransitionOK = false;
                   waitSync.notifyAll();
         } else if (evt instanceof EndOfMediaEvent) {
              processor.close();
              // System.exit(0);
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(int state) {
         synchronized (waitSync) {
              try {
                   while (processor.getState() != state && stateTransitionOK)
                        waitSync.wait();
              } catch (Exception e) {}
         return stateTransitionOK;

    OK, the fog is slowly clearing.
    I have a machine with a new installation of XP on it. I installed JMF2.1.1e, and tried to play an MPEG2 video - and got an error (a somewhat opaque "Failed to realize" message). So JMF does not come with a MPEG2 codec. So far so good.
    Comparing the new machine with my development machine I realised that a key difference was DVD playback software....I guess this installs DirectShow MPEG-2 capability (thanks for the suggestion, andyble).
    Installing a similar DirectShow MPEG-2 codec (FFDShow) on the new machine allowed the video to play without any changes to the installed JMF!
    So...conclusions so far are
    - JMF does not take advantage of hardware acceleration (not surprising, really).
    - JMF will pick up "native" codecs automagically.
    I was fooling myself into thinking that the various MPEG-2 codec libraries I was plugging into JMF (JFFMPEG, FOBS) were actually being used. Instead it was bypassing the lot and using a direct line into the hardware (note, I am using the Windows optimised installation of JMF, but I wasn't expecting it to completely ignore the setup information!).
    So the final question has to be how to select between internal codecs and the native DirectShow? Any ideas, anyone?

Maybe you are looking for

  • User gets error message when logging into a new pc "Outlook is using anold copy of your .ost"

    We have a user who needs to login to multiple pc's. When she logs into a new pc and opens Outlook she gets the error. "Outlook is using an old copy of your Outlook data fuile (.ost). Exit Outlook, delete the file, and restart Outlook. Anew file will

  • Adobe premiere elements 12 error

    I worked on a project yesterday for several hours.  Today the program will not open.  I just get the error message that the display drivers must be updated.  What do I do?

  • Blu-ray authoring w/Mac Pro

    I use both iMovie6 HD and, later, FCE, for editing the kids' sports video from my JVC GZ-HD7U 1080i camcorder, but envision a day soon where I need to put my videos onto a Blu-ray disk (to show in my PS3). BestBuy currently is clearancing their BWU10

  • XSLT Transformation Errors

    I receive the following errors whenever I try to use xslt. I checked the file for strange characters and there are none. This happens with the delivered samples as well. I would appreciate any help. Thanks, Errors: oracle.xml.parser.v2.XPathException

  • WLS 5.1 Cluster - Dynamic Server List

              Hi all,           I have multiple (more than 4) servers in a cluster on a WLS5.1, Netscape web server/Proxy-plugin           on a Solaris environment - each running on separate boxes.           Is there a way I can dynamically (run-time) ta