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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

BlackBerry WebWorks Contributions

Reply
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Carrier: AT&T

Repeat option on Audio API?

I'm trying to play a short sound using the Audio API with WebWorks as a repeating background sound in my app. I don't see a way to make it repeat though, so i've handled the END_OF_MEDIA event to restart the player. Sadly, there is a noticable pause in the sound as it does this.

 

Is there some way to make the player repeat that I might be missing? Is there a better event to handle? can the media player 'queue up' play requests? There doesn't seem to be much to the player API or the docs, but I thought I would ask.

 

Bill

 

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Please use plain text.
BlackBerry Development Advisor
tneil
Posts: 3,696
Registered: ‎10-16-2008
My Carrier: Rogers

Re: Repeat option on Audio API?

Hi Bill,

 

Right now there isn't a repeat to the Player.. I'm going to move this thread to our contributions forum so that it can be followed up on there.

 

I'll also pass the feature request to the product managers of the team

Tim Neil
Director, Application Platform & Tools Product Management
Follow me on Twitter
Please use plain text.
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Carrier: AT&T

Re: Repeat option on Audio API?

 

I tried to set a timer to fire before the audio was complete and tried setting the mediaTime to 0, but sadly this produced the same effect, a noticable pause.  
function play() {
   
    ... do stuff

    // fire the event 1 second before it ends.
    setTimeout(Restart, playerInstance.duration-1000);
}

function Restart() {
    if (playerInstance != undefined) {
        playerInstance.mediaTime = 0;
        // fire the event 1 second before it ends.
        setTimeout(Restart, playerInstance.duration - 1000);
    }
}

 

I really thoughts I was onto a decent work-around, but it seems that it doesnt work. I also even thought about creating multiple players and overlapping the audio in order to hide that pause. Any suggestions?
Bill

 

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Please use plain text.
BlackBerry Development Advisor
abramski
Posts: 10
Registered: ‎01-29-2009

Re: Repeat option on Audio API?

 

Thanks for the feedback billfoust.  Are there other audio capabilities that aren't available that you'd like to have in addition to the repeat functionality?

 

Adam

Adam Abramski
Product Manager for WebWorks Platform
Handheld Division
Please use plain text.
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Carrier: AT&T

Re: Repeat option on Audio API?

I can't find any that _I_ am wanting to use.  setLoopCount is the only Java API that I could see that I would like to be exposed.  I  had thought about generating tones manually instead of playing an MP3. I didn't really explore this avenue either in the java SDK or in any webworks extensions. I don't recall seeing anything available however.

 

This is the only other thing I can think of that other developers might be wanting. As far as my situation right now, I would say that setLoopCount() is all I need.

 

I've thought about making my own widget extension to add support for this method. I think it would solve my problem. However, I'd prefer to use a real released solution. Any idea on a timeframe when that might be implemented?

 

Bill

 

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Please use plain text.
Developer
billfoust
Posts: 382
Registered: ‎05-19-2008
My Carrier: AT&T

Re: Repeat option on Audio API?

[ Edited ]

I added the setLoopCount command and thought I'd share it here. Once I saw that the JAR file of the extension didnt need to be signed, it seemed like a no-brainer to open up the release audio_api jar and add code to add support for this method. It was remarkably easy!

 

Sadly, my problem still isn't solved. 

 

Even though the Audio player is looping just fine, there is STILL a small pause between loop iterations. I'm not sure whether this is a bug in the Java SDK or not. There are several posts on the Java forum of others who are having problems as well, and no answers to be found.

 

Bill
-------------------------------------------
Check out my book on BlackBerry Development for Java.
And my other really really old book
My Apps: FlashKids
Please use plain text.