Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
09-07-2012 05:06 PM - edited 09-07-2012 05:33 PM
I am playing about with HTML5 Audio a little at the moment, and I have a bit of an issue. I have the following code:
The problem is, whenever I try to play any sound for a second time (i.e. click the button, and once the sound finishes, click it again), the sound will "stutter" a bit; it's as if the first half a second or so plays, then it skips back to the start and plays the whole sound file.
The same code works perfectly in Chrome on my computer, so I guess it is some quirk of the PB browser, but I am wondering if there is some way around this?
EDIT: Found a workaround. I just call the load() function on each sound everytime before I play it. So the first <input> tag from above now looks like this:
<input onclick="openDoor.load();openDoor.play();" name="open_Door" value="Open Door" type="button">
This seems to work, although occassionally it causes a momentary delay before the sound plays. I can live with that though, better than the stuttering.
Having said that, if anyone has a better solution to this problem, please go ahead and share it
09-08-2012 02:33 AM
You need to know how HTML5 Audio works.
There are two way to get it working to play every time you click the button. First is a loop of your audio needs to be set up in the element definition like follows:
var footsteps = document.createElement('audio'); footsteps.src='sounds/Footstep.wav'; footsteps.loop = true;
On the other hand you might want start playback from beginning every time you click play button, then you could use something like this:
<input onclick="footsteps.currentTime = 0; footsteps.play();" name="footsteps" value="Footsteps" type="button">
Hope you will find the solution that works best for your use case!!
09-08-2012 04:54 AM - edited 09-08-2012 04:56 AM
I had already tried the "footsteps.currentTime = 0;" solution, it did not work. I got the exact same behaviour as I did without it. Your suggestion of loop is invalid as I don't want to make the sound loop, but thanks for that anyway. I have at least found a solution myself (see edit in original post), so it's not too important, although I am just wondering now if there is a "better" or "cleaner" solution (e.g. if I had done something wrong in my code).
I'd also like to note that my original code worked perfectly in Chrome; I don't think it is a problem with my understanding of HTML5 Audio, but instead with the PB's implementation thereof.
09-08-2012 07:33 AM - edited 09-08-2012 07:34 AM
Support for things like using "footsteps.currentTime = 0;" to go backwards to the beginning of a media file needs to supported by the API/implementation of the device/OS for the used media format. It might not be possible in every case for every codec/format.