- 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:
Code:<body> <script type="text/javascript"> var openDoor = document.createElement('audio'); openDoor.src='sounds/Door_Open.wav'; var footsteps = document.createElement('audio'); footsteps.src='sounds/Footstep.wav'; </script><br> <input onclick="openDoor.play();" name="open_Door" value="Open Door" type="button"><br> <input onclick="footsteps.play();" name="footsteps" value="Footsteps" type="button"><br> </body>
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:
Code:<input onclick="openDoor.load();openDoor.play();" name="open_Door" value="Open Door" type="button">
Having said that, if anyone has a better solution to this problem, please go ahead and share itLast edited by SifJar; 03-23-13 at 07:43 AM.
09-07-12 04:11 PMLike 0
- Forum
- BlackBerry PlayBook Forums
- PlayBook Apps & Games
Development issue regarding HTML5 Audio
LINK TO POST COPIED TO CLIPBOARD