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
Highlighted
New Developer
Posts: 13
Registered: ‎03-24-2009
My Device: Not Specified
Accepted Solution

Audio Stream Not Filename

I know you can stream a file from a webserver like 

 

InputStream is = getClass().getResourceAsStream("http://www.myserver.com/mysong.mp3");

 

but how do I go about adding it if the stream isnt actually using a file such as:

 

InputStream is = getClass().getResourceAsStream("http://www.myserver.com:8000");

 

When I build using that string instead I get no build errors but at runtime I get an "Uncaught exception: stream: null"

 

Any hints?

Developer
Posts: 57
Registered: ‎03-24-2009
My Device: Not Specified

Re: Audio Stream Not Filename

Are you trying to stream from a Shoutcast server or something like that?
New Developer
Posts: 13
Registered: ‎03-24-2009
My Device: Not Specified

Re: Audio Stream Not Filename

Yes it is a shoutcast server. Smiley Happy
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Audio Stream Not Filename

The getResourceAsStream method is designed to read a resource packaged within the application itself (a file bundled within a COD file).  You should use the Connector.open method to create a network connection (HttpConnection in this case) and create an InputStream from it.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker