Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
Krishmib
Posts: 3
Registered: ‎07-31-2008

can't able to access http url with JDE 4.2

Hi,

    

    I am creating one media player application for Blackberry Devices with JDE 4.2 and i am trying to play a MP3 song file available on Server. But i am getting http connection time out exception. The same code is working for MIDI type of audio file with JDE 4.0

 

Following is code snap:

        try {
            String url = "http://~URL~/Data/AAAAA.mp3";

 

            //String url = "http://~URL~/Data/AAAAA.mid";

            // Above commented code works perfectly with JDE 4.0

 
            HttpConnection httpConnection = (HttpConnection) Connector
            .open(url);
            InputStream inputStream = httpConnection.openInputStream();

           
            String types[] = Manager.getSupportedContentTypes(null);
            for (int i = 0; i < types.length; i++) {
                System.out.println(types[i]);
            }

            Player p = Manager.createPlayer(inputStream, "audio/midi");

            p.addPlayerListener(this);
           
            p.realize();
            p.prefetch();
            p.start();
        } catch (IOException ioEx) {
            Status.show(ioEx.getMessage());
        } catch (MediaException meEx) {
            Status.show("Media Exception");
            meEx.printStackTrace();
        } catch (Exception e) {
            Status.show("Exception");
        }

    Please provide me suggetions to remove this exception.

 

 

Thanks,

Shiva

Please use plain text.
Developer
dchapiesky
Posts: 20
Registered: ‎07-30-2008

Re: can't able to access http url with JDE 4.2

Check your MIME type "audio/midi" is not correct for playing an mp3....

 

try "audio/mpeg"

 

Daniel

Please use plain text.
New Developer
Krishmib
Posts: 3
Registered: ‎07-31-2008

Re: can't able to access http url with JDE 4.2

[ Edited ]

Thanks for ur response

    I have configure audio/mpeg for running MP3 file and audio/mid for midi file. I tried to run the application with MDS and it works only for audio/mid. I am using JDE 4.2 currenlty, but i dont know how to configure MDS for it. Let me know how to configure MDS for playing MP3 file from server.

 

   Thanks in advnaces for your support. 

 

Thanks

Shiva

 

Message Edited by Krishmib on 08-01-2008 12:24 AM
Please use plain text.
Developer
dchapiesky
Posts: 20
Registered: ‎07-30-2008

Re: can't able to access http url with JDE 4.2

Mark Sohm had recommended the following link to some one else for figuring out this kind of connection issue...

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800738/800792/801079/...

 

I pass it on here...

 

Question:   If you don't use the MDS simulator are you able to play the mp3 directly from the URL? 

 

Do you have any new code snippets to look at?

 

Daniel

Please use plain text.
Developer
dchapiesky
Posts: 20
Registered: ‎07-30-2008

Re: can't able to access http url with JDE 4.2

Please use plain text.
Developer
richard_puckett
Posts: 191
Registered: ‎04-03-2008

Re: can't able to access http url with JDE 4.2

I've never supported anything that far back, but I'm wondering if RIM had introduced support for MP3 by 4.0 - I thought that was a relatively recent introduction.

 

Could you perhaps try http://www.falseflag.com/blackberry/pac/App.java?  Compile and run it on your target device to see if mp3 is supported at all and/or over http.

Please use plain text.
New Developer
Krishmib
Posts: 3
Registered: ‎07-31-2008

Re: can't able to access http url with JDE 4.2

I am able to play MP3 song by full url in all audio players available, but i am not able to access the same url for MP3 file through my blackberry application. I dont have actual device to test the application, for the testing purpose i am using MDS simulator with JDE 4.0 which does not support audio/mpeg.

 

    Currently I am using JDE 4.2(does not contain MDS) so i am using the MDS simulator of JDE 4.0 and eclipse 3.3.1.1 plugin. With this setup i cant able to run the application.

    It gives a connection timeout exception 

 

Please view the code below. 

 

 

try {
                       

            String url ="http://url~/A.mp3"
            HttpConnection httpConnection = (HttpConnection) Connector
            .open(url);
            InputStream inputStream = httpConnection.openInputStream();

           
            String types[] = Manager.getSupportedContentTypes(null);
            for (int i = 0; i < types.length; i++) {
                System.out.println(types[i]);
            }

            Player p = Manager.createPlayer(inputStream, "audio/mpeg");

            p.addPlayerListener(this);
           
            p.realize();
            p.prefetch();
            p.start();
        } catch (IOException ioEx) {
            Status.show(ioEx.getMessage());
        } catch (MediaException meEx) {
            Status.show("Media Exception");
            meEx.printStackTrace();
        } catch (Exception e) {
            Status.show("Exception");
        }
 

 

Thanks  

Please use plain text.
Developer
kzettel
Posts: 120
Registered: ‎07-16-2008

Re: can't able to access http url with JDE 4.2

You should start with a newer version of MDS.  4.1 has an MDS which is what I normally use for 4.2 and 4.2.1 (and also with 4.0).  We haven't had any problems with transferring audio/mpeg files over it but I have not tested your exact scenario. 

 

I'm not sure if you have already looked at this but here are some useful links on the subject of audio types:

 

Supported Media Types: 

http://www.blackberry.com/btsc/articles/216/KB05419_f.SAL_Public.html

 

Knowledge Base Article on Streaming Audio: 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/1089414/How_To...

 

Kurt Zettel | Chief Architect | Metova
www.metova.com
Please use plain text.