02-22-2011 09:45 AM
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
02-22-2011 04:34 PM
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
02-26-2011 06:01 PM
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);
}
}
02-27-2011 01:17 PM
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
02-28-2011 02:51 PM
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
03-07-2011 11:59 PM - edited 03-08-2011 12:01 AM
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.