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 Contributor
enfix
Posts: 5
Registered: ‎01-08-2012
My Device: none
My Carrier: none

Player audio inside app

Hi,

i'm new in this community and in the BlackBerry world.

I need to realize a very simple stream audio player (web radio).

I tried to start with an example like BufferedPlaybackDemo downloaded from Eclipse (BlackBerry->Import BlackBerrySamples).

 

I tried to insert my URL but the app don't work, without exception.

 

I tried also to create a simple new project with this code:

 

Player p = javax.microedition.media.Manager.createPlayer("rtsp://....");
p.realize();
VolumeControl volume = (VolumeControl)p.getControl("VolumeControl");
volume.setLevel(30);
p.prefetch();
p.start();

 

but it does't work.

In these projects I use BlackBerry JRE 7.0.0.

 

Any idea or example to realize this simple app ?

I read in some guides that it sould be very simple.

 

Thank to all

 

Please use plain text.
Developer
alishaik786
Posts: 285
Registered: ‎08-26-2011
My Device: 9900
My Carrier: Not Specified

Re: Player audio inside app

If you want to play the audio from remote server then directly use the 'BrowserField" and play it in a browserField.
=================================================================================
Feel free to click LIKE button if the solution helps you;
--
Regards,

ALI SHAIK.
Please use plain text.
New Contributor
enfix
Posts: 5
Registered: ‎01-08-2012
My Device: none
My Carrier: none

Re: Player audio inside app

I need to play inside the app because I want show any image or any info about radio.

Is it possible ?

What's wrong in my code ?

Please use plain text.
New Contributor
enfix
Posts: 5
Registered: ‎01-08-2012
My Device: none
My Carrier: none

Re: Player audio inside app

Anyone ?

Please use plain text.
Developer
pbrebs
Posts: 40
Registered: ‎09-08-2011
My Device: 8900
My Carrier: AIS

Re: Player audio inside app

Don't need the "prefetch" line.

Please use plain text.
New Contributor
enfix
Posts: 5
Registered: ‎01-08-2012
My Device: none
My Carrier: none

Re: Player audio inside app

Don't work.....

That's my very simple sample:

 

public final class MyScreen extends MainScreen
{
private String url;

/**
* Creates a new MyScreen object
*/
public MyScreen()
{
// Set the displayed title of the screen
setTitle("MyTitle");
ButtonField button = new ButtonField("Start",ButtonField.CONSUME_CLICK);
add(button);
url = "rtsp://live.media.rai.it/broadcast/radiouno.rm";

button.setChangeListener(new FieldChangeListener() {


public void fieldChanged(Field field, int context) {
// TODO Auto-generated method stub
try{

Player p = javax.microedition.media.Manager.createPlayer(url);
p.realize();
VolumeControl volume = (VolumeControl)p.getControl("VolumeControl");
volume.setLevel(30);
// p.prefetch();
p.start();
}
catch(MediaException me)
{
Dialog.alert(me.toString());
}
catch(IOException ioe)
{
Dialog.alert(ioe.toString());
}
catch(Exception e)
{
Dialog.alert(e.toString());
}
}
});




}
}

 

 

Where is my error ?

Please use plain text.
New Contributor
enfix
Posts: 5
Registered: ‎01-08-2012
My Device: none
My Carrier: none

Re: Player audio inside app

I got this MediaException:

net.rim.device.internal.media.Unloaded MediaException

Please use plain text.