JMF and MP3 streaming

Hi,
I tried to write an JMF Plugin for an MP3 audio stream. The plugin should buffer the compressed MP3 data, but
extending the AVReceive2.java with a plugin did not send any output to the player.
Would someone please help me with a code snapshot?
Any better ideas than using a plugin for MP3 stream buffering?
Thanks in advance,
     Florian

hope this help this is a code i found in a search on this forum hope it helps
//: SimplePlayer.java
// This is a simple JMF Program that will play any support audio
import java.io.*;
import java.net.*;
import javax.media.*;
public class SimplePlayer {
private static Player player;
private File file;
private URL url;
private String filename;
public SimplePlayer(String filename) {
this.filename = filename;
initalizePlayer(filename);
private void initalizePlayer(String filename) {
try {
file = new File(filename);
this.filename = file.getName();
url = file.toURL();
System.out.println("Initalizing Player ...");
player = Manager.createPlayer(url);
System.out.println("Player Initalized ...");
catch (Exception e) {
e.printStackTrace();
public static void main(String args[]) {
if(args.length == 0) {
System.out.println("Usage: java SimplePlayer [filename] \n\n" +
"Example: \n" +
"\tWindows - java SimplePlayer c:\\mp3\\GoodSong.mp3 \n" +
"\tUnix - java SimplePlayer \\usr\\mp3\\GoodSong.mp3");
else
/* This for loop concatenates the input
string received at the command line.
If the command line input has spaces
java will parse by the spaces.
For example: java SimplePlayer c:\My
Music Directory\Very Good Song.mp3
Before for loop:
args[0] = "c:\My"
args[1] = "Music"
args[2]
= "Directory\Very"
args[3] = "Good"
args[4] = "Song.mp3"
After for loop:
args[0] = "c:\My Music
Directory\Very Good Song.mp3"
for(int i = 1; args.length > i; i++) {
args[0] += " " + args[ i ];
SimplePlayer sp = new SimplePlayer(args
[0]);
String input;
try {
BufferedReader in = new
BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter Command: ");
while(!(input = in.readLine
()).equals("quit")) {
if(input.toLowerCase
().equals("play")) {
System.out.println("Playing " + sp.filename + "...");
player.start();
else if(input.toLowerCase
().equals("stop")) {
System.out.println("Stopping " + sp.filename + "...");
player.stop();
else {
System.out.println("Invalid Command...");
System.out.println("Enter Command: ");
catch (Exception e) {
e.printStackTrace();
finally {
System.out.println("Closing Player");
player.stop();
player.close();
System.exit(0);

Similar Messages

  • 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......

  • JMF an MP3 streaming

    Hi,
    I tried to write an JMF Plugin for an MP3 audio stream. The plugin should buffer the compressed MP3 data, but
    extending the AVReceive2.java with a plugin did not send any output to the player.
    Would someone please help me with a code snapshot?
    Any better ideas than using a plugin for MP3 stream buffering?
    Thanks in advance,
         Florian

    Hi all,
    the problem in detail:
    The plugin is not accepted as a pre-precessing plugin. JMF tries to konvert the source MP3 stream in an new MP3 stream!
    Could someone please help?
    Florian

  • JMF and audio streams

    Hi all,
    I am writing an application that reads an audio stream and performs some analysis on the audio samples (e.g. detection of dtmf tones). I'd like to be able to write some code that works both on streams from files and from RTP connections (in order to easily write test classes). I made a little test program that reads a wav file with javasound and does some audio analysis.
    public static void main(String[] args)
       AudioInputStream sound = AudioSystem.getAudioInputStream(new File(args[0]));
       int length = (int) sound.getFrameLength();
       for(int i=0; i<length; i++)
          byte[] sample = new byte[2];
          int res = in.read(sample, 0, sample.length);
          if(res != sample.length)
             throw new RuntimeException(
                "Couldn't read a 2 bytes sample from audio stream.");
          if(!in.getFormat().isBigEndian())
             byte tmp = sample[0];
             sample[0] = sample[1];
             sample[1] = tmp;
          DataInputStream ds = new DataInputStream(
             new ByteArrayInputStream(sample));
          goertzel(ds.readShort());
    }Now, I tried to do the same using JMF but I failed. More specific in JMF:
    1) How can I get informations about the stream I'm reading? (e.g. all infos I can get from AudioInputStream's getFormat() method)
    2) Is there a way to get a stream from a DataSource and determine at runtime if the stream is in a particular format I'm expecting, WITHOUT bothering if it is coming form RTP, audio file or something else?
    3) Eventually, Is it hard to use the stream I'm reading to create a new DataSource that some other component will use?

    Sorry but.. I don't know which is the appropriate subclass: I can't find it. I guess you missed "instanceof" in Java 101, eh?
    Moreover I'd like to find a class that is not something like "RTPStream" or "AudioFileInputStream" but something representing just the audio stream itself.There are ways you can get access to the raw data as it flows through the system, but as far as I know, there's no way of gaining random access to the audio stream itself...
    Note that a solution could be to use javasound AudioInputStream class and a simple java rtp library. I could implement my Audio analysis methods in order to work on "abstract streams" (given a particular audio format), then write a test class that work with audio files and a real application that gets input streams from RTP connections.
    I just want to know whether JMF allows me do do that or not?It'd be relatively simple to use JMF to receive an RTP stream and "export" it to JavaSound... you'd just need to write a custom DataSink.

  • Can jmf broadcast mp3 files?convert mp3 to wav format to enable streaming?

    Hello... can jmf broadcast mp3 file format audio files.. so that it can accessible.. since it is playable... or does it require conversion to another for in audio in order for it to be streamed on LAN... Thanks and more power to JAVA..

    Man, have you ever opened Logic before? If you had you would have noticed that these instructions are for Logic and yes you will obtain 44.1/16 files if you choose these options in the "copy/convert" menue.

  • Transconding - Mixing in live streaming Microphone and MP3

    Hello,
    We intend to develop a Flex client application the user to send audio from your microphone and mp3 at the same time to a server that Flash Media Server.
    It would be a mix of microphone and music in mp3 that is playing in the application at the same time transmitted to the listeners.
    What will be the version of Flash Media Server that enables this mixing of audio from microphone and music played on the client in flex? Which version of Flash Media Server that can best meet my needs?

    As of now you won't be able to publish any local content say like mp3 from Flash Client to FMS. You would have to have mp3 file stored on server and then write some kind of logic where your audio content from microphone and mp3 playback is synced. There is no direct way that you can mix two contents and playback it as one stream. And you will need Flash Media Interactive Editon if you plan to write any server-side logic for sync.

  • Mixing in live streaming Microphone and MP3

    Hello,
    We intend to develop a Flex client application the user to send audio from your microphone and mp3 at the same time to a server that Flash Media Server.
    It would be a mix of microphone and music in mp3 that is playing in the application at the same time transmitted to the listeners.
    What will be the version of Flash Media Server that enables this mixing of audio from microphone and music played on the client in flex? Which version of Flash Media Server that can best meet my needs?

    As of now you won't be able to publish any local content say like mp3 from Flash Client to FMS. You would have to have mp3 file stored on server and then write some kind of logic where your audio content from microphone and mp3 playback is synced. There is no direct way that you can mix two contents and playback it as one stream. And you will need Flash Media Interactive Editon if you plan to write any server-side logic for sync.

  • Programs to stream movie and mp3

    Hi
    I need a programs on linux arch so can stream movie and mp3 formats over my network  to my ps3.
    somone now how i can do that ? some script or  some hacks ?

    nono ...
    i have Arch on my computer now and i want to have audios file in :
    /home/user/Audio
    i mean that i can lissing on audio frome computer on my PS3.
    like share tha map but only stream thing over on my network.

  • Jmf connection to streaming server

    Hi can anybody please explain how i can use jmfs rtsp/rtp to connect to darwin streaming server . I have read this is posible but cant find anyinformation on how.
    Thanks any help will be very helpfull...

    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

  • Adobe air for Playbook & mp3 streaming

    I want to listen radio-canada streaming (Mp3).
    I coulndt find an apps to play streaming MP3 ( where I can paste the radio canada link)
    So I decide to install the widget, which need adobe air..
    I'm unable to acces adobe air download from the browser and the widget doesn't want to install
    Look like a pandora box....
    So, the question is...Is there any way to play mp3 streaming via the playbook or to install widget with adobe air?
    Thanks

    Have you tried the Nobex Radio app on the PlayBook?
    Maybe this has the station that you're trying to listen to.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!

  • WRT610N and PS3 - Slow audio and photo streaming, while video is fine

    Hi, I just hooked up my USB portable hard drive to this Linksys router and was able to access the picture/audio/video on my PS3, it's very cool 
    However I quickly noticed is has couple of problems:
    The access to JPG files is painfully slow, on average it would take about 20 to 30 seconds for the next photo to show up (the average size for a photo is about 2~3 MB).
    The similar story would happen on MP3.
    However the streaming of video is totally a different story, it's lighting fast! It would take about 2 to 5 seconds for the video to start to play, once it's started, there is no lag/interruption. The video I watched is a 600 x 400 .avi file at the size of 84MB, it plays very fluidly.
    I found it's hard to believe that HD video actually runs much better than photo and MP3, it just doesn't make sense to me.
    I also rebooted router/PS3 mutiple times, which didn't help at all.
    Can anyone offer some hints on what could be wrong?
    thanks ahead,
    Hong 
    Message Edited by zhanghong on 01-16-2010 05:53 PM
    Message Edited by zhanghong on 01-16-2010 05:54 PM

    What is the Model no of the USB HDD...?
    Have you checked with different computer..?
    Try to use the different computer and check if you are facing the same problem.

  • Some internet radio stations with http protocol and mp3 format not working in AIR 2.0

    First, i am sorry for my bad english. When I publish swf for Flash 10 player all stations in my list works. If I publish them for AIR 2.0 stations with adress end ":XXXX", where XXXX is port number, they cannot work. What is problem? Thanks in advance.

    Perhaps,  in the previous post I wasn't clear enough, so I'll try to make it better: I am using the Adobe Flash CS5 and AS3. I wrote the script for listening internet radio stations. In the station list I named only those that use HTTP protocol and mp3 format, cause I know the limits of Flash in audio streamings. If I publish FLA file in SWF for Flash 10 player all the stations can be listened.. If swf file is made for AIR 2.0 there's a problem: the stations with adress  http://xxx.xxx:xxx/<something> can be listened, and those without extension behind the port number (:xxx) can not. Main parts of the script are:
    startButton.addEventListener(MouseEvent.CLICK, listen);
    req.url= "<adress>";
    snd = new Sound();
    snd.load(req);
    private function listen(event:MouseEvent):void {
    req = snd.play();
    Example:
    adress=http://scfire-ntc-aa08.stream.aol.com:80/stream/1010 - working
    adress=http://www.radionovosti.rs:443/radionovosti56s.mp3 - working
    adress=http://sh1.beotel.net:8002 - not working
    adress=http://77.105.36.58:8881 - not working
    It would be great if someone of Adobe employers explain to me what is the problem. Thanks.

  • Playing mp3 stream works well in Emulator but doesn't play on Device

    I'm facing this problem. I'm using flex && actionscript to play an mp3 stream on the phone.
    Code works great and the sound is played when the app is run in the flash builder emulator.
    However, when i deploy my app on a mobile device (tried several Android phones) everything is good except the stream doesn't play!
    Can you please help me??
    Here's my code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
                        xmlns:s="library://ns.adobe.com/flex/spark" title="HomeView"
                        creationComplete="view1_creationCompleteHandler(event)"
                        >
              <fx:Script>
                        <![CDATA[
                                  import mx.events.FlexEvent;
                                  import flash.net.*;
                                  import flash.media.*;
                                  private  var req:URLRequest;
                                  private  var context:SoundLoaderContext = new SoundLoaderContext(8000, true);
                                  private   var s:Sound;
                                  private  var channel:SoundChannel = new SoundChannel();
                                  private  function AudioOn():void
                                            req = new URLRequest("http://stream2.srr.ro:8000/;stream.mp3");
                                            s = new Sound(req,context);
                                            channel=s.play();
                                  protected function view1_creationCompleteHandler(event:FlexEvent):void
                                            AudioOn();
                        ]]>
              </fx:Script>
              <fx:Declarations>
                        <!-- Place non-visual elements (e.g., services, value objects) here -->
              </fx:Declarations>
    </s:View>

    Okay.. First a big thanks!!
    I've resolved the path issues and am now experimenting with formats other than SCORM that will hopefully launch off our LMS (SyberWorks).
    I think I know what a cross domain issue is... it seems pretty self evident, (ie) .htm/.swf files live on a different server domain than video or audio files.
    I think all my files are on the same domain in the zip file. However, are the following paths also an example of a cross domain issue?:
    Z:\orgs\ogslp\courses\2012videotest\videotestinternalsrvr\videotestinternalsrvr.htm
    (this is where I upload, or publish Captivate files)
    http://gslcampus/ogslp/courses/2012videotest/videotestinternalsrvr/videotestinternalsrvr.h tm
    (this is where clients access the training modules via IE & the Syberworks LMS, intranet)
    One more..... when publishing with the Captivate > Internal Server option what path do I input to access the server?
    Z:\orgs\ogslp\courses\2012videotest\videotestinternalsrvr\videotestinternalsrvr.htm
    (backdoor for uploading files)
    or
    http://gslcampus/ogslp/courses/2012videotest/videotestinternalsrvr/videotestinternalsrvr.h tm
    (actual internal, intranet url for accessing courses)
    PS when I upload files the following appears before the Z:
    Computer > SyberWorks (\\sousa)(Z:)
    Any advice would be appreciated - thanks for your time.
    wjf

  • Why does BackgroundMediaPlayer NOT play mp3 streams?

    I tried to make a universal app, I have a successful Win8 app, now I have tried to make a WinPhone version and find that this class can't play mp3 streams, for example
    http://europaplus.hostingradio.ru:8014/europaplus256.mp3

    Hello,
    There is no standard mp3 streaming protocol. Some sites use pseudo streaming by throttling a standard progressive download of mp3 data. While pseudo streaming may work on some Microsoft platforms is not officially supported by the Media Engine out of
    the box. A major problem with pseudo streams is their interaction with the internet cache. It is possible to overload the cache with extended listening sessions and eventually use up all the storage on the device. This is the big reason
    pseudo streaming is not supported.
    I would recommend that you check with the stream provider and ask them what streaming protocol they are using. If they are simply using HTTP with no underlying streaming protocol such as HLS or DASH then they are using pseudo streaming and you may have
    problems with playback on the current and future Microsoft platforms.  
    If you know that the stream provider's content is consistent (or you are the content provider) one possible solution is to write a custom
    MediaStremSource that will handle the network interactions, local cacheing and packet parsing. You can then pass the parsed samples down stream to the Media Engine for decoding and playback.
    The best solution however is to convince the content provider to switch to a real streaming protocol or offer a separate URL that supports a true streaming protocol. To future proof any new streaming implementation I always recommend MPEG DASH.
    I hope this helps,
    James
    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

Maybe you are looking for