1. SifJar's Avatar
    I have posted this same post over at the Blackberry Dev forums, but I figured I'd post it here too in case anyone here can help me quicker than there.

    Anyway, 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:

    <script type="text/javascript">
    var openDoor = document.createElement('audio');
    var footsteps = document.createElement('audio');
    <input onclick="openDoor.play();" name="open_Door" value="Open Door" type="button"><br>
    <input onclick="footsteps.play();" name="footsteps" value="Footsteps" type="button"><br>
    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?

    BTW, I'm not completely sure if this is the right section, there doesn't seem to be a development forum in the PB section, wasn't sure whether to post it here or the regular development section. Moderators, please move if this is the wrong place.

    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
    Last edited by SifJar; 03-23-13 at 07:43 AM.
    09-07-12 04:11 PM