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
Posts: 7
Registered: ‎09-08-2009
My Device: Not Specified

audio output

hi,

 

I want to be able to play audio in blackberry storm by changing the output buffer in real time, as it was a stream (radio stream for example).

So far i have a byte array and then play it with javax.microedition.media.Manager.createPlayer. But this way i can't change (update) that byte array once i have created the player.

 

Is there a way to play sound by passing out an array of bytes/floats every second for example ? simulate a radio stream for example?

 

Can it be done using native blackberry API or do i have to go J2ME ?

 

thanks in advance

Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: audio output

Yes, it's possible. Have you a look at my comment in a related earlier thread: http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=61804#M61804.
New Developer
Posts: 7
Registered: ‎09-08-2009
My Device: Not Specified

Re: audio output

[ Edited ]

tkz, but i doesn't help me out much, in other words what i want to do is this :

 

- Create a player with an output buffer

- Update that buffer(not over the internet) in real time, let's say every second 

 

But i don't want to create a new player every time and i can't have any type of empty sound between the updates (the sound has to be continous).

 

What i wanted to know is if it's possible to update a buffer so the player i created plays continous as i modify my buffer in real time.

 

I've read in other forum that ' Both the mmapi player and rim mediaplayer require the entire stream to be downloaded before allowing you to start playing it. ' is it true ?

 

 

Message Edited by smuorfy on 09-24-2009 07:08 AM
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: audio output

Create the player using Manager.createPlayer(DataSource), and then implement a SourceStream (in particular, SourceStream.read as I mentioned in my comment in the other thread) inside the DataSource. Then you can buffer or not as much as you want, and the Player won't care whether you use arrays or not, as long as SourceStream.read's contract is satisfied.
Highlighted
New Developer
Posts: 21
Registered: ‎09-18-2009
My Device: Not Specified

Re: audio output

Hello,

 

I have implemented player with custom data source. It works fine for few seconds , but then after readfunction is not called.


I have checked player state , but it's in "STARTED"  state.

 

So have you solved this problem ???

 

I can play only 10-12 seconds audio , then player stops without any notification.

 

Let me know if anyone have solution. Please reply.