×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    35

    Exclamation Streaming mp3 for online Radio

    Hi Guys,

    I want to develop a j2me application which will play mp3 stream.

    http://www.radiodhaka.net/ is an online radio station. its ip is http://202.4.100.2:8000

    if you see the page source of the radio station..
    Code:
          <object id=MMPlayer1 codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 type=application/x-oleobject height=50 width=400 align=absmiddle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95> 
    <param name="FileName" value="http://202.4.100.2:8000"> 
    <param name="ShowControls" value="1"> 
    <param name="ShowStatusBar" value="1"> 
    <param name="ShowDisplay" value="0"> 
    <param name="DefaultFrame" value="Slide"> 
     
    <param name="Autostart" value="true"> 
    <PARAM NAME="volume" VALUE="50"> 
    <embed 
    src="http://202.4.100.2:8000" width=400 height=50 volume=150 autostart=true loop=1 
    align="absmiddle" type="application/x-mplayer2" 
    pluginspage="http://www.microsoft.com/Windows/MediaPlayer/download/default.asp" 
    showcontrols=1 showdisplay=0 showstatusbar=1 > </embed></object>
    I want to play the radio station by my application.

    For that reason I have tried in different ways..

    First i tried to use the http://202.4.100.2:8000 to open the input stream.
    Here is the code..
    Code:
    // establish a http connection with remote server
     streamConnection = (StreamConnection) Connector.open( "http://202.4.100.2:8000" );
     // send the HTTP request
     inputStream = streamConnection.openInputStream();
    
     player = Manager.createPlayer( inputStream,"audio/mpeg");
    but it will show the error.." response does not start with HTTP it starts with : ICY"

    I have googled some.. then some advice me to use socket..
    Then I have use the following code..
    Code:
    // establish a socket connection with remote server
     streamConnection = (StreamConnection) Connector.open( "socket://202.4.100.2:8000" );
    then it will show the error " Couldnt' read from socket"

    Then I use the following url by locating the playlist file..
    Code:
    streamConnection = (StreamConnection) Connector.open( "http://202.4.100.2:8000/listen.pls" );
    then it will show no error but nothing was played.
    But when I open "http://202.4.100.2:8000/listen.pls" by real player or quick time player then it will play the songs as the radio.

    What should I do now?
    please show me a way.

    thx in advance.

    --Eros

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: Streaming mp3 for online Radio

    Try to serach rtsp radio stations on the net and try playing it in J2me. Which is your target device ?

    thanks,
    ~Amitabh
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Super Contributor
    Join Date
    Apr 2007
    Posts
    2,708

    Re: Streaming mp3 for online Radio

    the problem is that it's a stream from an Icecast server (the ICY part), I'm afraid the player has no idea what to do with this header and then just simply throws an exception...

Similar Threads

  1. Streaming MP3 via DataSource on j2me
    By sudhir_gupta24 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 8
    Last Post: 2010-08-14, 14:22
  2. streaming mp3
    By santosh shetty in forum Symbian Media (Closed)
    Replies: 76
    Last Post: 2010-05-28, 16:03
  3. Streaming mp3 from local file system.
    By qbodzio in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2008-05-19, 17:22
  4. Mp3 streaming
    By scarex80 in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2006-06-19, 08:26

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×