JMF+COMMAPI, JMF+JTAPI+XTAPI OR JMF+JTAPI+ibm'sJ323

Hi all,
we are trying to develope a program for an operation center were the policemen will call the control centre from a private telephone line in the street. The operator must received the entrance calling and dispatch it to the right department, well more or less that's what the end user want us to make.
Now we are at the dessign stage, so we need to test the best solution. First we though about using COMMAPI, so we tried to make a little application as a test. We can hung up the modem, or dial a number through the modem from the application. We are able to get the data the modem send us in an InputStream. Here begin the problems... Do you think this InputStream we receive from the modem is the human voice that apeaks from the telephone that made the call to the modem? Then, another problem that we couldn't solve... If this InpuStream is in fact the data (the voice) received by the modem how can we convert this into a DataSource class to be able to reproduce this in the computer. We've read and tried thousand of times to use the examples in the JMF solution's place, but we couln'd work it out. We think the example more similar to our is the 'Generate LiveStream', which uses LiveStream and a custom DataSource classes. But we don't know how to use LiveStream or DataSource to make them read from our InputStream each time the modem send us data.
Then we though that maybe it would be faster to develope the test program using XTAPI, an implementation of JTAPI ... but It was impossible to get the next code working...
JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(
"net.xtapi.XJtapiPeer");
myprovider = peer.getProvider("Serial");
or(
myprovider =peer.getProvider"net.xtapi.serviceProvider.OpenH323");
Terminal[] t = myprovider.getTerminals();
becouse there was no way the a Provider, t was null...
Then I saw that some people were talking about using ibm's J323 and I tried with, becouse they said that JTAPI was an incomplete(?) implementation of the H323 specification. OK we download the trial version but... nothing, now we got the provider, but no Terminals are abailable. We 've tried everithing and we think everithing is installed propertly. We used:
JtapiPeer peer = JtapiPeerFactory.getJtapiPeer("com.ibm.telephony.mm.MM_JtapiPeer");
myprovider = peer.getProvider("H.323 Endpoint;login=223.254.254.94");
Terminal[] t = myprovider.getTerminals();
Although you have to pay for get a license of J323, the documentation and the support is so low.
We think the better way to solve our problem is using COMMAPI, becouse it would give us a higher control over the application and the modem, but although we have though hard on convertin InputStream into DataSource, we cannot make it work.
I'm DESPERADO, i will GIVE YOU 10 DUKES if you help us.
We are loosing a lot of time on this and the boss thinks cannot understand why we are going so slow, and why there are so many problems. We see there's a lot of people posting similar problems, but there are no answers. Maybe this would help a lot of peolple on this matter.
Thanks in advance.

How can I integrate the jmf and the openh323 project? I want to do calls using the openh323 library and transmit/receive using the JMF. However the openh323, which uses the h.245 protocol for port and channel negociation, doesn't allow to use the ports that already were negociated. So, how can i transmit using JMF to these ports?
Please, help me.

Similar Messages

  • RTSP Interleave

    I'm trying to get an Axis 213 camera to work over the Internet with JMF and IBM's MPEG4 JMF codec (using RTSP interleave method).
    Has anyone used JMF and RTSP with RTP/RTCP packets interleaved over TCP/IP (i.e., in the same session and over the same ports as RTSP)? Any ideas of what to do to implement?
    Thanks ahead of time.

    I'm trying to get an Axis 213 camera to work over the Internet with JMF and IBM's MPEG4 JMF codec (using RTSP interleave method).
    Has anyone used JMF and RTSP with RTP/RTCP packets interleaved over TCP/IP (i.e., in the same session and over the same ports as RTSP)? Any ideas of what to do to implement?
    Thanks ahead of time.

  • JMF+JTAPI, JMF+COMMAPI or JMF+ibm's J323

    Hi all,
    I've tried and tried and tried... to use JMF and COMMAPI to read data from a modem. It's human voice data. I can read from an InputStream the bytes that modem receives so, I THINK that I'm getting the voice in the InputStream as bytes (please corret me if I'm wrong). Know the proble is to transform this InputStream in a DataSource. If tried with the example of jmf's page (LiveStream and DataSource), but I have no idea about converting the InputStream to DataSource, and 'play' the InputStream by the phones. Then I tried to use XTAPI implementation of JTAPI... but It was impossible to get the next code working...
    JtapiPeer peer = JtapiPeerFactory.getJtapiPeer(
    "net.xtapi.XJtapiPeer");
    myprovider = peer.getProvider("Serial");
    or(
    myprovider =peer.getProvider"net.xtapi.serviceProvider.OpenH323");
    Terminal[] t = myprovider.getTerminals();
    becouse there was no way the a Provider...
    Then I saw that some people were talking about using ibm's J323 and I tried with, becouse they said that JTAPI was not :
    JtapiPeer peer = JtapiPeerFactory.getJtapiPeer("com.ibm.telephony.mm.MM_JtapiPeer");
    myprovider = peer.getProvider("H.323 Endpoint;login=223.254.254.94");
    Terminal[] t = myprovider.getTerminals();
    Using this I got the Provider, but, the getTerminals method return an empty array...
    I'm DESPERADO, i GIVE YOU 10 DUKES if you help me.
    I'm loosing a lot of time in this and my boss thinks I'm touching my nose in stead of working on this, becouse at this moment I have NOTHING.

    Two other places to find out about J323:
    http://www.zurich.ibm.com/csc/distribsys/j323/j323-2.html
    ---start quote---
    Can I use the IBM J323 Engine to control my modem?
    Can I use the IBM J323 Engine send a fax?
    No. The IBM J323 Engine is an implementation of the H.323 version 2 protocol as defined by the ITU-T (International Telecommunication Union). The H.323 protocol is a Voice over IP protocol. It is used to establish phone calls over an IP network (ex: internet). Therefore the J323 Engine will only communicate with H.323 endpoints. A H.323 endpoint can be a terminal (ex: Microsoft NetMeeting) or a gateway (to connect to the PSTN - Public Switched Telephony Netwok - which is the "normal" telephony network).
    ---end quote---
    Also, I when I run J323 demo-media.bat, the "-localaddr" argument seems to map to the "login=" part of the provider string, but this devolves to simply the string used to identify you when you contact other H.323 peers. The trace I get is:
    C:\Program Files\j323\bin>C:\Java\jdk\j2sdk1.4.2\bin\java -Djmf.package=com.ibm
    .media.teljmf.TjTmProvider -Dh323.endpoint.timer.factor=3 com.ibm.ct.cphone.Main
    -trace 1 -mtrace 2 -sdfile demo.sd -locaddr "<[email protected]>"
    CPhone: Obtaining JtapiPeer "null"...
    CPhone: Obtaining Provider "H.323 Endpoint;login=<[email protected]>"...
    Setting h323.endpoint.timer.factor to '3'
    IBM J323 Engine v5.0.0
    blah blah blah

  • JTAPI, JMF, and the 7921G

      We have a JTAPI application that uses the JMF library to send audio. The streaming audio stream can be heard on the desktop phones (e. g. 7941, 7961), wireless 7920 phones, and the Cisco IP Communicator but cannot be heard on the wireless 7921G or 7925G phones. There are no errors encountered in the programming logs when the audio is streamed with JMF to these phones. 
      To try to pinpoint the problem, we have gathered a number of traces and logs using the Cisco Real-Time Monitoring Tool and Wireshark.  The only suspicious thing that we saw was in the Call Statics on the 7921G itself.  The received packets showed 38 and the discarded packets also showed 38.  But, we have no idea what the discarded packets are or why the 7921G would discard packets to begin with.  We don't see discarded packets during a normal phone call.
       People that we have talked to about this problem have indicated that they think it's a codec problem, but when we look at the codec in the traces, the phone status log and the events that we get back at the programmatic level, everything indicates that we are sending and receiving with the G.711 u-law with a 30msec packets size, and this matches the codec of the streaming application.   We have even turned off the CUCM Service parameter "G722 Codec Enabled" to make sure that this setting was not overriding the G.711 negotiation.  Changing the parameter had no effect on the problem.
      We have checked the more obvious problems such as the volume on the 7921G phone and the volume of the original recording.  In addition, we tried to rule out a WAP problem by using the CIPC on a wireless laptop connected to the same WAP as the 7921G phone.  The announcement played just fine on the CIPC on the wireless laptop.  
      At the programming level, the audio is being streamed over a CTI port by the application when the call is connected to the destination phone. So, essentially, once the JTAPI application receives the CiscoRTPOutputStartedEv event, we set up the remote connection and start the stream. 
    The CTI port is set with:
   CiscoMediaCapability[] caps = new CiscoMediaCapability[1];
   caps[ 0] = CiscoMediaCapability.G711_64K_30_MILLISECONDS;
    
 The audio stream is set for format ULAW_RAW (codec G.711 u-law): 
  Format audioFormat = new AudioFormat( AudioFormat.ULAW_RTP, 8000, 8, 1 );
    
 I've adjusted the packet size to 20ms for the CUCM defaults as well as for the CiscoMediaCapabilties thinking that something might not be in sync. While making those adjustments effected the quality of the audio for the phones that were working, it did not effect being able to hear the audio on the 7921G.  This problem occurs on the CCM 4.X, CUCM 6.0 and CUCM 7.0.1 platforms
      Hopefully, there is a setting that we've overlooked, and there is a simple solution to the problem.
    Thanks,
    -Judy

    Yes, your statement is an accurate way to state it. We wait until the receiving phone has been answered and use the remote port obtained from the RTPOutputProperties to stream a unicast announcement to the phone. Then, we wait for a DTMF response from the user in IVR fashion.
    We'd assumed that other people were streaming announcements to the 7921G and not having a problem but wondered if anyone was doing it the way that we are. The previous post is helpful in trying to understand more about the phone. But, the question remains, what is different about how the 7921G reacts to the stream and how CIPC reacts to the stream going through the same WAP such that the announcement is not heard on the 7921G?

  • Help needed- Caller tone application using JTAPI and JMF

    Hi to All,
    I want to make a Caller Tone Application for Cisco IP phone.
    For that application I am using JTAPI and JMF.
    I am new to this two technologies.
    Can somebody help me for how to accomplish this?
    ---Ashish

    Hi Jerry,
    You can run analog input and counter tasks concurrently.  You can start them using software timing basically at the same time which may be fine for your needs and is the easiest to implement.  You also can use a hardware start trigger to start the tasks if you prefer.  It all depends on the level of synchronization you need. 
    You have not mentioned at what rate you will be acquiring data on your analog inputs.  The M Series PCI-6225 has 80 analog inputs and may suit your needs.  You will need to know what sampling rate you are trying to achieve.  Any M Series device will definitely give you the best value. 
    Hope this helps!
    Laura

  • JMF - AVReceive/AVTrasmit

    Hi,
    i'm developing an application that uses jmf.
    I don't understand how to open an RTP session(receinve or trasmit) from a remote host/phone.
    In the example code there is:
    localAddr = new SessionAddress (InetAddress.getLocalHost().....????)
    I don't want trasmit or receive from the local host but i'd like to launch the application on my computer and so to start a rtp trasmission between 2 remote phones.
    Help!!!

    Well.. you have to take it from avtransmit2.java that I posted here several times. It only does G.711 though (see why: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6278751), it takes a while to initiate a streaming session, and above all, your description is all wrong. You can't run a JMF app on PC1, and to have it trigger an RTP stream between PC2 and a phone.. for that you'd need the RTP streaming app on PC2, and it would have to offer some remote means to start a stream.
    If you know JTAPI and understand AVTransmit2 then all that is left to be done is put the two together.

  • Install JMF on Windows 7 64bit

    Dear all,
    After a lot of struggling (and a really mean a lot), I finally got jmf to work on Windows 7 64bit. I figured that I can better not let this information go to waste, so that's why I'm posting it here. I didn't really test the full capabilities of jmf on my platform yet, in fact I only tested those features that I needed for my application. As such I am able to successfully capture and record video clips from my build in webcam of my laptop.
    First let me describe my platform:
    Laptop: Samsung R590 (JS01)
    Processor: I5 450M (64bit)
    OS: Windows 7 64bit
    Webcam: build in
    Secondly I want to apologize in advance if the method below doesn't work for you. The reason for that can be that I had to try so many different things before I finally got it to work, so I'm not really sure which steps are necessary and which ones are not. So I tried to make a guide that only includes the necessary steps, but in reality I tried so much more, so if this tutorial doesn't work for you, please give me feedback, and we'll try to figure it out. :)
    Step one: installation of java JRE/JDK
    JMF will never work on a 64bit JRE/JDK, plain and simple because JMF is too old and doesn't support a 64bit JRE/JDK. Thus your first step has to be to install a 32 bit JRE/JDK on your system. (I uninstalled my 64 bit JRE/JDK first, but I don't now whether or not this is necessary)
    Step two: download JMF with windows performance pack
    Go to the jmf site and download the most recent jmf version, with windows performance pack. (This is - and will probably be forever - version 2.1.1e)
    The link to the website is currently: [https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=7372-jmf-2.1.1e-oth-JPR@CDS-CDS_Developer]
    Step three: install JMF
    Install the file you just downloaded in the normal way you would install any other program. But chose as installation path: "C:\JMF2.1.1e"
    I think this is necessary because of the strict security policy in Windows 7, if you don't do this, I guess jmf won't be able to store capture device settings to your local hard drive. (But again, I'm not completely sure here, please verify this if possible)
    After the installation, you don't have to do anything special to get jmf to work, so you don't manually have to set the JMFDIR, PATH and CLASSPATH (as is explained at the sun website), just skip those steps.
    After the installation, reboot your pc.
    Remark: I recommend you to install jmf as an administrator (but I don't now whether or not this is necessary). To do this, right click the installation file and select: "run as administrator'.
    *Step four: register your capture devices*
    First make sure that all your devices are working properly, I recommend you to use a program like Skype or something just to check whether your microphone is working or not.
    Secondly, open jmfstudio, select 'file > preferences > capture devices', and press the button 'detect capture devices'. Normally you will have to wait for a couple of minutes now (because the determination of all the available video formats takes quite a while). Afterwards jmf should have found all of your devices, that usually looks something like this:
    DirectSoundCapture
    JavaSound audio capture
    vfw:Microsoft WDM Image Capture (Win32):0
    But this can vary according to your configuration off course. :)
    *Step four: test your capture devices*
    In jmfstudio, select 'file > capture' and select the video and audio combo and see if your webcam settings work. You should now be able to view and hear yourself.
    *Step five: that's it, enjoy your jmf*
    *Remarks:*
    My development platform is currently netbeans 6.9.1 and I am able to write code, build it and run it with netbeans. I can also just run normal *.jar files
    *Troubleshoot:*
    If you get a dialog screen when starting your video capture device that looks like this: [http://www.alexandria.nu/ai/machine_vision/dual_cameras/SelectDevice.gif]
    (With off course another name for the capture device), then that means that your capturing device is currently occupied by another program and you can't currently use it.
    To solve this, make sure that no other application is using the webcam. For me even this was insufficient, but I managed to solve this by installing the latest drivers for my webcam from the manufacturing site of my laptop.
    I sincerely hope this tutorial can be of any use for someone, feel free to give me comments/suggestions. And please post here if this works for you or not.
    Greetings, Molly

    Hi
    sure I follow each of your steps, I uninstall all java verisones and installed a new java version 32-bit, I installed JMF in "C: \ JMF2.1.1e".
    when all installing finished, works fine JMF only once, I do the tests, recognizes the device; shows the video, but when I close and open again JStudio don't works throws error, and therefore my apliación not working, always returns null the device

  • Unable to capture video from webcam in JMF in xlet

    hi
    I am unable to capture video from webcam in an Xlet. I am using Xletview to run Xlet. The method CaptureDeviceManager.getDeviceList(vidformat) returns empty array. Which videoformat should I use and why do I get empty array?
    Thanks
    Rajesh

    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.

  • Unable to capture video from webcam in JMF

    hi
    I am unable to capture video from webcam in an Xlet. I am using Xletview to run Xlet. The method CaptureDeviceManager.getDeviceList(vidformat) returns empty array. Which videoformat should I use and why do I get empty array?

    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.

  • Detecting Video Capture Devices without Installing JMF

    Hi All,
    I want to detect the video capture devices, without installing the JMF.
    I had included the jmf (windows version) in lib path in netbeans ide. I am able to detect the audio capture device. But unable to detect the video capture devices. But if I install the JMF, I am able to detect the Video Capture devices in My system. Can anyone help me?
    Thanks,
    Vinoth Kumar.

    YES! Please take a look at SIP Communicator project. They have all what u want.
    The main idea is copy all .dll files to System or System32 (Please check files which JMF will copy to ur computer and where).
    U need to have jmf.jar and sound.jar too ( maybe more) in your computer.
    Your program should have DirectSoundAuto.java, JavaSoundAuto.java, JavaSoundDetector.java, JMFInit.java. Those files are in JMStudio source code. They are used to detect all capture devices and register it to JMF, but wait !!! where they will be saved? In order to save information about capture devices which are detected, you should create "jmf.properties" file in the same location with jmf.jar.Therefore, u should modify the JMFInit.java so it can check if the "jmf.properties" exists. If it's not, you have to create it.
    Check SIP Communicator at Folder "media" then "device". They have modified those files I mentioned above and created some new files to SC can detect more devices.
    Edited by: tamngminh on Sep 16, 2008 9:50 AM

  • Problems in sound capture and JMF deployment

    Hello:
    I am new to JMF.
    I made an applet using JDK 1.3 on JBuilder 5. This applet captures and plays audio. When I run it through JBuilder's IDE, it runs fine. But when I run it independently, the applet's GUI appears but sound recording doesnn't work. Remember that I have JRE1.4.2 and JMF2.1.1e installed on my machine.
    When I installed JMF, I enabled the recording, and file writing options for an applet.
    To further check the problem, I ran it through JMF debugger. There I found that it says that ,
    <permission javax.sound.sampled.AudioPermission "record";> is not enabled.
    To enable it I added this entry in java.policy. This allowed the audio capture to work.
    But my question is,
    1. Why isn't this entry present by default in java.policy?
    2. Even one of my user entered this entry in java.policy, but was unable to capture audio.
    3. I want my applet to be running with different users having different versions of JRE,JMF and browser settings. How can I do this, without asking my user to do anything? I simply want that when my user downloads this applet, I should provide him with some installation file that installs JMF as well as configures everything on the system in a way that he can use this applet easily.
    Haven't you guys faced such problems in deploying JMF stuff?
    I'll be grateful for any help.
    Thanks
    Jami

    Hi.
    I am facing very similar problems: it looks like deploying JMF with Java Applets is really a challange!
    On my own test installation, if I enable audio capture and file writing for applets through the JMFRegistry, then I am able to record audio from my test applet, even when executed in the target web browser.
    Nevertheless, how to deploy the applet in such a way clients won't be required to manually install JMF and enable audio capture and file writing through the JMFRegistry?
    It looks like the JMF Customizer is able to produce a custom JAR also embedding user preferences for audio capture from applets and file writing , is this correct?
    Any help would be greatly appreciated.
    Regards,
    Marco.

  • JMF code working under linux but not windows XP

    Hello everyone,
    I'm currently working on a nice cross-platform project involving sound producing. I decided to take a look at JMF and test it a bit to know if its features can suit me. I tried to make it works under windows, using a very simple sample of code. The system seems to play the sound as some console output detects the start and the end, but all i hear is a very short noise ( 1/2second ) like a "CLIK" and nothing else. I tested the code under linux, using the same computer and it works just fine, playing the same wave nicely and entirely.
    some info:
    -i used the cross platform JMF, no performance pack ( i tried it , but still no result )
    -the code just opens a file dialog and plays the selected file
    -the selected file was always a very simple .wav
    -i did not use system classpath variables because i don't like it, i rather use local classpath ( which works fine too, no doubt about it )
    -i tested this little soft on 2 other computer using windows XP, and still got the same result.
    Please, have you got an idea about what's going on ?
    Thanks a lot for any answer!
    Maxime - Paris . France
    Code Sample:
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import javax.media.*;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class JMFSound extends Object implements ControllerListener {
         File soundFile;
         JDialog playingDialog;
         public static void main (String[] args) {
              JFileChooser chooser = new JFileChooser();
              chooser.showOpenDialog(null);
              File f = chooser.getSelectedFile();
              try {
                   JMFSound s = new JMFSound (f);
              } catch (Exception e) {
                   e.printStackTrace();
         public JMFSound (File f) throws NoPlayerException, CannotRealizeException,     MalformedURLException, IOException {
              soundFile = f;
              // prepare a dialog to display while playing
              JOptionPane pane = new JOptionPane ("Playing " + f.getName(), JOptionPane.PLAIN_MESSAGE);
              playingDialog = pane.createDialog (null, "JMF Sound");
    playingDialog.pack();
              // get a player
              MediaLocator mediaLocator = new MediaLocator(soundFile.toURL());
              Player player =     Manager.createRealizedPlayer (mediaLocator);
    player.addControllerListener (this);
    player.prefetch();
    player.start();
    playingDialog.setVisible(true);
         // ControllerListener implementation
         public void controllerUpdate (ControllerEvent e) {
    System.out.println (e.getClass().getName());
         if (e instanceof EndOfMediaEvent) {
                   playingDialog.setVisible(false);
                   System.exit (0);
    Message was edited by:
    Monsieur_Max

    Hello everyone,
    I'm currently working on a nice cross-platform project involving sound producing. I decided to take a look at JMF and test it a bit to know if its features can suit me. I tried to make it works under windows, using a very simple sample of code. The system seems to play the sound as some console output detects the start and the end, but all i hear is a very short noise ( 1/2second ) like a "CLIK" and nothing else. I tested the code under linux, using the same computer and it works just fine, playing the same wave nicely and entirely.
    some info:
    -i used the cross platform JMF, no performance pack ( i tried it , but still no result )
    -the code just opens a file dialog and plays the selected file
    -the selected file was always a very simple .wav
    -i did not use system classpath variables because i don't like it, i rather use local classpath ( which works fine too, no doubt about it )
    -i tested this little soft on 2 other computer using windows XP, and still got the same result.
    Please, have you got an idea about what's going on ?
    Thanks a lot for any answer!
    Maxime - Paris . France
    Code Sample:
    import java.io.File;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import javax.media.*;
    import javax.swing.JDialog;
    import javax.swing.JFileChooser;
    import javax.swing.JOptionPane;
    public class JMFSound extends Object implements ControllerListener {
         File soundFile;
         JDialog playingDialog;
         public static void main (String[] args) {
              JFileChooser chooser = new JFileChooser();
              chooser.showOpenDialog(null);
              File f = chooser.getSelectedFile();
              try {
                   JMFSound s = new JMFSound (f);
              } catch (Exception e) {
                   e.printStackTrace();
         public JMFSound (File f) throws NoPlayerException, CannotRealizeException,     MalformedURLException, IOException {
              soundFile = f;
              // prepare a dialog to display while playing
              JOptionPane pane = new JOptionPane ("Playing " + f.getName(), JOptionPane.PLAIN_MESSAGE);
              playingDialog = pane.createDialog (null, "JMF Sound");
    playingDialog.pack();
              // get a player
              MediaLocator mediaLocator = new MediaLocator(soundFile.toURL());
              Player player =     Manager.createRealizedPlayer (mediaLocator);
    player.addControllerListener (this);
    player.prefetch();
    player.start();
    playingDialog.setVisible(true);
         // ControllerListener implementation
         public void controllerUpdate (ControllerEvent e) {
    System.out.println (e.getClass().getName());
         if (e instanceof EndOfMediaEvent) {
                   playingDialog.setVisible(false);
                   System.exit (0);
    Message was edited by:
    Monsieur_Max

  • Swing and jmf

    can u please have a look to the attached file
    i know that this involves the jmf API but I have the feeling that has to do more with swing, thats whay I post my question here
    this simple application is based on the MDI.java example of the jmf web
    pages
    I also added a slider and want to set the playback rate for the player from
    there if possible
    that is I want everytime that I move the slider and the value is biggerthan
    50 the rate to be reduced according to a simple calculation that converts
    the slider value to a value between 0 an1 for the rate...
    so all i want to do is pass the slider value to the player everytime that
    the slider changes value and this is bigger than 50
    the attached file can do that only when the player starts playing the
    file,,,,
    after the player has started and the rate is set I cant change it even if
    the slider moves
    when I tried to do that from within the stateChanged method of the slider I
    was getting a Nullpointer exception because of the EventDispatching thread,
    so I thought to take this piece of code out of there (create the setnewrate
    method in the jmframe instead),,,,but then of course doesnt work like I
    would want,,,,,
    do I have to register the class that implements the frame for the player as
    a ChangeListener on the slider to achieve that, is something like that
    possible....
    I know that swing is not supposed to be thread safe, so maybe this is what
    the problem is after all...any suggestions to that direction?
    Can u please have a look??
    I am a beginner so any help would really be very much appreciated
    thanx :)
    maria
    .....and the attached file
    I think the problem is with the stateChanged method for the Jslider...
    I am getting a null pointerexception because of the eventdispatching thread
    pls ignore any silly mistakes I am a completely newbie in java
    myAppfr2.java
    import javax.media.*;
    import com.sun.media.ui.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    import java.util.Vector;
    import javax.swing.border.Border.*;
    import java.util.Hashtable;
    public class myAppfr2 extends Frame {
    * VARIABLES
    JMFrame jmframe = null;
    JDesktopPane desktop;
    FileDialog fd = null;
    CheckboxMenuItem cbAutoLoop = null;
    Player player ;
    //Player newPlayer = null;
    String filename;
    boolean stopped;
    public my_slider test_slider;//put it here so I can use it by name by all code
    float rate;
    * MAIN PROGRAM / STATIC METHODS
    public static void main(String args[]) {
    //if (args.length > 0)
         //rate=Float.parseFloat(args[0]);
    myAppfr2 mdi = new myAppfr2();
    static void Fatal(String s) {
    MessageBox mb = new MessageBox("JMF Error", s);
    * METHODS
    public myAppfr2() {
    super("VHE Demo");
    // Add the desktop pane
    setLayout( new BorderLayout() );
    desktop = new JDesktopPane();
    desktop.setDoubleBuffered(true);
         desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);//makes dragging faster
    add("Center", desktop);
    setMenuBar(createMenuBar());
    setSize(640, 480);
    setVisible(true);
         test_slider = new my_slider("networkutil");
         createnetworkutil();
         try {
         UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel") ;
    } catch (Exception e) {
    System.err.println("Could not initialize personal look and feel");
    addWindowListener( new WindowAdapter() {
    public void windowClosing(WindowEvent we) {
    System.exit(0);
    Manager.setHint(Manager.LIGHTWEIGHT_RENDERER, new Boolean(true));
    private MenuBar createMenuBar() {
    ActionListener al = new ActionListener() {
    public void actionPerformed(ActionEvent ae) {
    String command = ae.getActionCommand();
    if (command.equals("Open")) {
    if (fd == null) {
    fd = new FileDialog(myAppfr2.this, "Open File",
    FileDialog.LOAD);
    fd.setDirectory("~/movies");
    fd.show();
    if (fd.getFile() != null) {
    String filename = fd.getDirectory() + fd.getFile();
    openFile("file:" + filename);
    } else if (command.equals("Exit")) {
    dispose();
    System.exit(0);
    MenuItem item;
    MenuBar mb = new MenuBar();
    // File Menu
    Menu mnFile = new Menu("File");
    mnFile.add(item = new MenuItem("Open"));
    item.addActionListener(al);
    mnFile.add(item = new MenuItem("Exit"));
    item.addActionListener(al);
    // Options Menu
    Menu mnOptions = new Menu("Options");
    cbAutoLoop = new CheckboxMenuItem("Auto replay");
    cbAutoLoop.setState(true);
    mnOptions.add(cbAutoLoop);
    mb.add(mnFile);
    mb.add(mnOptions);
    return mb;
    //create slider and add it to desktop
    public void createnetworkutil(){
    test_slider.pack();
    desktop.add(test_slider);
    test_slider.setVisible(true);
    * Open a media file.
    private void openFile(String filename) {
    String mediaFile = filename;
    Player player = null;
    // URL for our media file
    URL url = null;
    try {
    // Create an url from the file name and the url to the
    // document containing this applet.
    if ((url = new URL(mediaFile)) == null) {
    Fatal("Can't build URL for " + mediaFile);
    return;
    // Create an instance of a player for this media
    try {
    player = Manager.createPlayer(url);
    } catch (NoPlayerException e) {
    Fatal("Error: " + e);
    } catch (MalformedURLException e) {
    Fatal("Error:" + e);
    } catch (IOException e) {
    Fatal("Error:" + e);
    if (player != null) {
    this.filename = filename;
    JMFrame jmframe = new JMFrame(player, filename);
    desktop.add(jmframe);
    class JMFrame extends JInternalFrame implements ControllerListener {
    public Player mplayer;
    Component visual = null;
    Component control = null;
    int videoWidth = 0;
    int videoHeight = 0;
    int controlHeight = 30;
    int insetWidth = 10;
    int insetHeight = 30;
    // boolean firstTime = true;
    public JMFrame(Player player, String title) {
    super(title, true, true, true, true);
    getContentPane().setLayout( new BorderLayout() );
    //setSize(320, 10);
    setLocation(200, 25);
    setVisible(true);
    mplayer = player;
    mplayer.addControllerListener((ControllerListener) this);
    mplayer.realize();
    addInternalFrameListener( new InternalFrameAdapter() {
    public void internalFrameClosing(InternalFrameEvent ife) {
    mplayer.close();
    public void controllerUpdate(ControllerEvent ce) {
    // System.out.println("controllerUpdate");
    //SwingUtilities.isEventDispatchThread();
    if (ce instanceof RealizeCompleteEvent) {
    mplayer.prefetch();
    } else if (ce instanceof PrefetchCompleteEvent) {
    if (visual != null)
    return;
         //setnewrate();
         //rate=mplayer.getRate();
         System.out.println( mplayer.getRate());
    if ((visual = mplayer.getVisualComponent()) != null) {
    Dimension size = visual.getPreferredSize();
    videoWidth = size.width;
    videoHeight = size.height;
    getContentPane().add("Center", visual);
    } else
    videoWidth = 320;
    /*if ((control = mplayer.getControlPanelComponent()) != null) {
    controlHeight = control.getPreferredSize().height;
    getContentPane().add("South", control);
    setSize(videoWidth + insetWidth,
    videoHeight + controlHeight + insetHeight);
    validate();
    mplayer.start();
    } else if (ce instanceof StartEvent){
         if (test_slider.netutil==0) {
         mplayer.stop();
         } else if (ce instanceof EndOfMediaEvent && cbAutoLoop.getState()) {
    mplayer.setMediaTime(new Time(0));
              boolean stopped=true;
              mplayer.prefetch();
              mplayer.start();
              stopped=false;
    class my_slider extends JInternalFrame implements ChangeListener{
    //Set up parameters.
    int netini=50;
    public int netutil=netini;
    public my_slider(String windowTitle) {
    super(windowTitle, false, false, false, false);
    getContentPane().setLayout(new BorderLayout());
    setLocation(25,25);// for the internal frame that contains the slider
    setVisible(true); //..same
    //Create the slider(the component included in "my_slider" internal frame
         JSlider mslider = new JSlider(JSlider.VERTICAL,
    0, 100, netini);
    mslider.addChangeListener((ChangeListener) this);
    mslider.setMajorTickSpacing(10);
    mslider.setPaintTicks(true);
    //Create the label table.
    Hashtable labelTable = new Hashtable();
    labelTable.put(new Integer( 0 ),
    new JLabel("0%") );
    labelTable.put(new Integer( 25 ),
    new JLabel("25%") );
    labelTable.put(new Integer( 50 ),
    new JLabel("50%") );
    labelTable.put(new Integer(75),
    new JLabel("75%") );
         labelTable.put(new Integer( 100),
    new JLabel("100%") );     
    mslider.setLabelTable(labelTable);
    mslider.setPaintLabels(true);
    mslider.setBorder(
    BorderFactory.createEmptyBorder(0,0,0,10));
         //Put everything in the content pane.
    getContentPane().add(mslider, BorderLayout.CENTER);
    public void stateChanged(ChangeEvent e) { //System.out.println("stateChanged");
    // SwingUtilities.isEventDispatchThread();
    if (e instanceof ChangeEvent){
    JSlider source = (JSlider)e.getSource();
    if (!source.getValueIsAdjusting()) {
    netutil= (int)source.getValue();
         System.out.println(netutil);
              if (jmframe.mplayer!=null) {
         jmframe.mplayer.setRate((float)(netutil/(netutil+(0.3*netutil))));
              if (jmframe.mplayer.getTargetState() <Player.Started)
         jmframe.mplayer.prefetch();
    i am stuck so any help would be really very much appreciated

    did you ever resolve this.
    I may be having similar problems
    I have an JMF application running under webstart. It runs ok in Java 1.3
    Now I am trying to get ti to run under Java 1.4. The attached error is rather useless,
    but by guess at what is happening is that the JMF control has some .awt. stuff included
    but that Java 1.4 emulates .awt. in swing. But something was not set and the default does not
    work.
    This error messages does not appear in the 1.3 run
    Any suggestions would be greatly appriatated.
    1.4 result:
    mg version 2.1.1a
    player created com.sun.media.content.unknown.Handler@3a1834
    ctr com.sun.media.PlaybackEngine$BitRateA@4a9a7d
    ctr com.sun.media.BasicJMD[panel0,0,0,512x200,invalid,layout=java.awt.BorderLayout]
    duration? javax.media.Time@6b5666 sec = 9.223372036854776E9
    time unknown javax.media.Time@754699
    will realize the player
    realize
    javax.media.TransitionEvent[source=com.sun.media.content.unknown.
    Handler@3a1834,previous=Unrealized,current=Realizing,
    target=Realized]
    start smxBADS
    bass start
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.metal.MetalLookAndFeel.getControlInfo(Unknown Source)
    at javax.swing.plaf.metal.MetalScrollButton.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintWithBuffer(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.metal.MetalLookAndFeel.getControlInfo(Unknown Source)
    at javax.swing.plaf.metal.MetalScrollButton.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintWithBuffer(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    realize done
    panel found java.awt.Panel[panel1,0,0,0x0,invalid] java.awt.Panel[panel2,4,216,292x30,layout=java.awt.FlowLayout]
    press a button
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at javax.swing.plaf.metal.MetalLookAndFeel.getControlInfo(Unknown Source)
    at javax.swing.plaf.metal.MetalScrollButton.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JComponent.paintWithBuffer(Unknown Source)
    at javax.swing.JComponent._paintImmediately(Unknown Source)
    at javax.swing.JComponent.paintImmediately(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    1.3 result
    mg version 2.1.1a
    player created com.sun.media.content.unknown.Handler@354749
    ctr com.sun.media.PlaybackEngine$BitRateA@5b484d
    ctr com.sun.media.BasicJMD[panel3,0,0,512x200,invalid,layout=java.awt.BorderLayout]
    duration? javax.media.Time@46d228 sec = 9.223372036854776E9
    time unknown javax.media.Time@f7386
    will realize the player
    realize
    javax.media.TransitionEvent[source=com.sun.media.content.unknown.
    Handler@354749,previous=Unrealized,current=Realizing,
    target=Realized]
    start smxBADS
    bass start
    javax.media.DurationUpdateEvent[source=com.sun.media.content.unknown.Handler@354749,duration=javax.media.Time@55c0f9
    javax.media.Time@55c0f9
    javax.media.RealizeCompleteEvent[source=com.sun.media.content.unknown.Handler@354749,previous=Realizing,current=Realized,target=Realized]
    realized complete
    prefetch
    realize done
    controlComp com.sun.media.ui.DefaultControlPanel[,0,0,74x21,invalid,layout=java.awt.BorderLayout]
    add controlComp 21 java.awt.Panel[panel4,10,-12,258x47,invalid]
    javax.media.TransitionEvent[source=com.sun.media.content.unknown.Handler@354749,previous=Realized,current=Prefetching,target=Prefetched]
    start smxBADS
    bass start
    running ok from here on

  • For the 10^6 time -- JMF on Fedora does not work!

    I've tried everything under the Sun (no pun intended), and I've seen many other people with this same problem, but no solution...
    (1) I installed the performance pack version of JMF 2.1.1 for Linux.
    (2) I modified my .bash_profile to read as follows...
    PATH=/usr/java/j2re1.4.2_06/bin:$PATH
    export PATH
    JAVA_HOME=/usr/java/j2re1.4.2_06
    export JAVA_HOME
    JMFHOME=/usr/java/JMF-2.1.1e
    CLASSPATH=$JMFHOME/lib/jmf.jar:.:${CLASSPATH}
    export JMFHOME CLASSPATH
    LD_LIBRARY_PATH=$JMFHOME/lib:${LD_LIBRARY_PATH}
    (3) Just to beat a dead horse, I even copied-pasted the following:
    /JMF-2.1.1e/lib/*.jar --> /usr/java/j2re1.4.2_06/lib/ext/
    /JMF-2.1.1e/lib/*.so --> /usr/java/j2re1.4.2_06/lib/i386/
    both *.jar and *.so --> /usr/mozilla/plugins/
    (4) But when I try running the online diagnostic applet
    http://java.sun.com/products/java-media/jmf/2.1.1/jmfdiagnostics.html
    I get the following:
    Java 1.1 compliant browser.....Maybe
    JMF classes.....Not Found
    and none of the sample JMF apps on the Sun website work.
    Any clues at all??? Does JMF not work on Fedora???
    I guess I'll just keep asking this question every few days until someone from Sun answers?
    Thanks anyways...

    Yes, I didn't make that clear (first thing in the morning). Even though the JMF Diagnostic applet doesn't work for me on RedHat 9.0 using the Java Plugin with JDK 1.4.2, JMF DOES work for me from the command line. It seems that the Java 1.4.2 Plugin isn't finding JMF on the path. For me, the Java 1.5 Plugin resolves this issue.
    Scott

  • Problem with using JMF audio over a network

    Hiya, I'm using IBM JMF code but I'm having problems trying to get it transmit data from the MediaTransmitter to the MediaPlayerFrame.
    I'm kinda new to JMF so I assume I'm missing something basis for why this doesn't work.
    Any help would be greatly appreciated.
    MediaPlayerFrame
    import javax.media.*;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    * An instance of the MediaPlayerFrame may be used to display any media
    * recognized * by JMF.  This is intended to be a very simple GUI example,
    * displaying all possible controls for the given media type.
    public class MediaPlayerFrame extends JFrame {
         * The frame title.
        private static final String FRAME_TITLE = "developerWorks JMF Tutorial " +
            "Media Player";
         * The panel title of the main control panel.
        private static final String CONTROL_PANEL_TITLE = "Control Panel";
        // location and size variables for the frame.
        private static final int LOC_X = 100;
        private static final int LOC_Y = 100;
        private static final int HEIGHT = 500;
        private static final int WIDTH = 500;
         private final static long serialVersionUID = 1;
         * The current player.
        private Player player = null;
         * The tabbed pane for displaying controls.
        private JTabbedPane tabPane = null;
         * Create an instance of the media frame.  No data will be displayed in the
         * frame until a player is set.
        public MediaPlayerFrame() {         
            super(FRAME_TITLE);
            System.out.println("MediaPlayerFrame");
            setLocation(LOC_X, LOC_Y);
            setSize(WIDTH, HEIGHT);
            tabPane = new JTabbedPane();
            getContentPane().add(tabPane);
            /* adds a window listener so that the player may be cleaned up before
               the frame actually closes.
            addWindowListener(new WindowAdapter() {
                                   * Invoked when the frame is being closed.
                                  public void windowClosing(WindowEvent e) {
                                      closeCurrentPlayer(); 
                                      /* Closing this frame will cause the entire
                                         application to exit.  When running this
                                         example as its own application, this is
                                         fine - but in general, a closing frame
                                         would not close the entire application. 
                                         If this behavior is not desired, comment
                                         out the following line:
                                      System.exit(0);
         * Creates the main panel.  This panel will contain the following if they
         * exist:
         * - The visual component: where any visual data is displayed, i.e. a
         * movie uses this control to display the video.
         * - The gain component:   where the gain/volume may be changed.  This
         * is often * contained in the control panel component (below.)
         * - The control panel component: time and some extra info regarding
         * the media.
        private JPanel createMainPanel() {
            System.out.println("createMainPanel");
            JPanel mainPanel = new JPanel();
            GridBagLayout gbl = new GridBagLayout();
            GridBagConstraints gbc = new GridBagConstraints();
            mainPanel.setLayout(gbl);
            boolean visualComponentExists = false;
            // if the visual component exists, add it to the newly created panel.
            if (player.getVisualComponent() != null) {
                visualComponentExists = true;
                gbc.gridx = 0;
                gbc.gridy = 0;
                gbc.weightx = 1;
                gbc.weighty = 1;
                gbc.fill = GridBagConstraints.BOTH;
                mainPanel.add(player.getVisualComponent(), gbc);
            // if the gain control component exists, add it to the new panel.
            if ((player.getGainControl() != null) &&
                (player.getGainControl().getControlComponent() != null)) {
                gbc.gridx = 1;
                gbc.gridy = 0;
                gbc.weightx = 0;
                gbc.weighty = 1;
                gbc.gridheight = 2;
                gbc.fill = GridBagConstraints.VERTICAL;
                mainPanel.add(player.getGainControl().getControlComponent(), gbc);
            // Add the control panel component if it exists (it should exists in
            // all cases.)
            if (player.getControlPanelComponent() != null) {
                gbc.gridx = 0;
                gbc.gridy = 1;
                gbc.weightx = 1;
                gbc.gridheight = 1;
                if (visualComponentExists) {
                    gbc.fill = GridBagConstraints.HORIZONTAL;
                    gbc.weighty = 0;
                } else {
                    gbc.fill = GridBagConstraints.BOTH;
                    gbc.weighty = 1;
                mainPanel.add(player.getControlPanelComponent(), gbc);
            return mainPanel;
         * Sets the media locator.  Setting this to a new value effectively
         * discards any Player which may have already existed.
         * @param locator the new MediaLocator object.
         * @throws IOException indicates an IO error in opening the media.
         * @throws NoPlayerException indicates no player was found for the
         * media type.
         * @throws CannotRealizeException indicates an error in realizing the
         * media file or stream.
        public void setMediaLocator(MediaLocator locator) throws IOException,
            NoPlayerException, CannotRealizeException {
              System.out.println("setMediaLocator: " +locator);
            // create a new player with the new locator.  This will effectively
            // stop and discard any current player.
            setPlayer(Manager.createRealizedPlayer(locator));       
         * Sets the player reference.  Setting this to a new value will discard
         * any Player which already exists.  It will also refresh the contents
         * of the pane with the components for the new player.  A null value will
         * stop the discard the current player and clear the contents of the
         * frame.
        public void setPlayer(Player newPlayer) {      
            System.out.println("setPlayer");
            // close the current player
            closeCurrentPlayer();          
            player = newPlayer;
            // refresh the tabbed pane.
            tabPane.removeAll();
            if (player == null) return;
            // add the new main panel
            tabPane.add(CONTROL_PANEL_TITLE, createMainPanel());
            // add any other controls which may exist in the player.  These
            // controls should already contain a name which is used in the
            // tabbed pane.
            Control[] controls = player.getControls();
            for (int i = 0; i < controls.length; i++) {
                if (controls.getControlComponent() != null) {
    tabPane.add(controls[i].getControlComponent());
    * Stops and closes the current player if one exists.
    private void closeCurrentPlayer() {
    if (player != null) {
    player.stop();
    player.close();
    * Prints a usage message to System.out for how to use this class
    * through the command line.
    public static void printUsage() {
    System.out.println("Usage: java MediaPlayerFrame mediaLocator");
    * Allows the user to run the class through the command line.
    * Only one argument is allowed, which is the media locator.
    public static void main(String[] args) {
    try {
    if (args.length == 1) {
    MediaPlayerFrame mpf = new MediaPlayerFrame();
    /* The following line creates a media locator using the String
    passed in through the command line. This version should
    be used when receiving media streamed over a network.
    mpf.setMediaLocator(new MediaLocator(args[0]));
    /* the following line may be used to create and set the media
    locator from a simple file name. This works fine when
    playing local media. To play media streamed over a
    network, you should use the previous setMediaLocator()
    line and comment this one out.
    //mpf.setMediaLocator(new MediaLocator(
    // new File(args[0]).toURL()));
    mpf.setVisible(true);
    } else {
    printUsage();
    } catch (Throwable t) {
    t.printStackTrace();
    MediaTransmitter
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.format.*;
    import java.io.IOException;
    import java.io.File;
    * Creates a new media transmitter.  The media transmitter may be used to
    * transmit a data source over a network.
    public class MediaTransmitter {
         * Output locator - this is the broadcast address for the media.
        private MediaLocator mediaLocator = null;
         * The data sink object used to broadcast the results from the processor
         * to the network.
        private DataSink dataSink = null;
         * The processor used to read the media from a local file, and produce an
         * output stream which will be handed to the data sink object for
         * broadcast.
        private Processor mediaProcessor = null;
         * The track formats used for all data sources in this transmitter.  It is
         * assumed that this transmitter will always be associated with the same
         * RTP stream format, so this is made static.
        private static final Format[] FORMATS = new Format[] {
            new AudioFormat(AudioFormat.MPEG_RTP)};
         * The content descriptor for this transmitter.  It is assumed that this
         * transmitter always handles the same type of RTP content, so this is
         * made static.
        private static final ContentDescriptor CONTENT_DESCRIPTOR =
            new ContentDescriptor(ContentDescriptor.RAW_RTP);
         * Creates a new transmitter with the given outbound locator.
        public MediaTransmitter(MediaLocator locator) {
            mediaLocator = locator;
         * Starts transmitting the media.
        public void startTransmitting() throws IOException {
            // start the processor
            mediaProcessor.start();
            // open and start the data sink
            dataSink.open();
            dataSink.start();
         * Stops transmitting the media.
        public void stopTransmitting() throws IOException {
            // stop and close the data sink
            dataSink.stop();
            dataSink.close();
            // stop and close the processor
            mediaProcessor.stop();
            mediaProcessor.close();
         * Sets the data source.  This is where the transmitter will get the media
         * to transmit.
        public void setDataSource(DataSource ds) throws IOException,
            NoProcessorException, CannotRealizeException, NoDataSinkException {
            /* Create the realized processor.  By calling the
               createRealizedProcessor() method on the manager, we are guaranteed
               that the processor is both configured and realized already. 
               For this reason, this method will block until both of these
               conditions are true.  In general, the processor is responsible
               for reading the file from a file and converting it to
               an RTP stream.
            mediaProcessor = Manager.createRealizedProcessor(
                new ProcessorModel(ds, FORMATS, CONTENT_DESCRIPTOR));
            /* Create the data sink.  The data sink is used to do the actual work
               of broadcasting the RTP data over a network.
            dataSink = Manager.createDataSink(mediaProcessor.getDataOutput(),
                                              mediaLocator);
         * Prints a usage message to System.out for how to use this class
         * through the command line.
        public static void printUsage() {
            System.out.println("Usage: java MediaTransmitter mediaLocator " +
                               "mediaFile");
            System.out.println("  example: java MediaTransmitter " +
                "rtp://192.168.1.72:49150/audio mysong.mp3");
            System.out.println("  example: java MediaTransmitter " +
                "rtp://192.168.1.255:49150/audio mysong.mp3");
         * Allows the user to run the class through the command line.
         * Only two arguments are allowed; these are the output media
         * locator and the mp3 audio file which will be broadcast
         * in the order.
        public static void main(String[] args) {
            try {
                if (args.length == 2) {
                    MediaLocator locator = new MediaLocator(args[0]);
                    MediaTransmitter transmitter = new MediaTransmitter(locator);
                    System.out.println("-> Created media locator: '" +
                                       locator + "'");
                    /* Creates and uses a file reference for the audio file,
                       if a url or any other reference is desired, then this
                       line needs to change.
                    File mediaFile = new File(args[1]);
                    DataSource source = Manager.createDataSource(
                        new MediaLocator(mediaFile.toURL()));
                    System.out.println("-> Created data source: '" +
                                       mediaFile.getAbsolutePath() + "'");
                    // set the data source.
                    transmitter.setDataSource(source);
                    System.out.println("-> Set the data source on the transmitter");
                    // start transmitting the file over the network.
                    transmitter.startTransmitting();
                    System.out.println("-> Transmitting...");
                    System.out.println("   Press the Enter key to exit");
                    // wait for the user to press Enter to proceed and exit.
                    System.in.read();
                    System.out.println("-> Exiting");
                    transmitter.stopTransmitting();
                } else {
                    printUsage();
            } catch (Throwable t) {
                t.printStackTrace();
            System.exit(0);

    Okay, here's the it copied out.
    Media Transmitter
    C:\John\Masters Project\Java\jmf1\MediaPlayer>java MediaTransmitter rtp://127.0.
    0.1:2000/audio it-came-upon.mp3
    -> Created media locator: 'rtp://127.0.0.1:2000/audio'
    -> Created data source: 'C:\John\Masters Project\Java\jmf1\MediaPlayer\it-came-u
    pon.mp3'
    streams is [Lcom.sun.media.multiplexer.RawBufferMux$RawBufferSourceStream;@1decd
    ec : 1
    sink: setOutputLocator rtp://127.0.0.1:2000/audio
    -> Set the data source on the transmitter
    -> Transmitting...
       Press the Enter key to exit
    MediaPlayerFrame
    C:\John\Masters Project\Java\jmf1\MediaPlayer>java MediaPlayerFrame rtp://127.0.
    0.1:2000/audio
    MediaPlayerFrame
    setMediaLocator: rtp://127.0.0.1:2000/audioAs I said, it just kinda stops there, what it should be doing is opening the MediaPlayer.
    "MediaPlayerFrame" and "setMediaLocator: rtp://127.0.0.1:2000/audio" are just print outs I used to track here the code is getting to.

Maybe you are looking for

  • Bluetooth Mouse not working in Windows 7?

    Just installed Windows 7 Ultimate 64bit on an iMac i5 with 20Gb Everything installed correctly and W7 boots fine, even did the drivers for bootcamp before the full Windows install Thing is I have the Apple slim Bluetooth Keyboard and Magic Mouse (tha

  • Ipod shuffle with integrated cable?!?

    My son came home from school with what to all appearances is a 2nd gen ipod shuffle (bought from a friend that upgraded to the standard ipod). The only problem is that this shuffle has a 36"cable coming out of the side opposite the headphone jack. I

  • My app store is not working,how to fix it

    cannot access apps,i cannot log out,cannot do anything,os lion.

  • I need information on Appraisals

    Hi Experts, Can any one can provide information on followings APPCHANGE APPCREATE APPDELETE APPDISPLAY APPSEARCH APPTAKEBACK PPAD PPUP Please its very urgent.Correct answer will be rewarded Edited by: Zsolt Markus on Jan 4, 2008 11:02 AM

  • What is the difference between instance variable and class variable?

    i've looked it up on a few pages and i'm still struggling a bit maybe one of you guys could "dumb" it down for me or give and example of how their uses differ. thanks a lot