Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

New Contributor
Posts: 6
Registered: ‎02-05-2013
My Device: Z10
My Carrier: O2

Sounds on an HTML5 app (via webworks)

So I finally got my app together, however I'm having a slight problem with sounds now.


I made my game in a program called Game Maker Studio (I'm an amateur at code, I need all the help I can get). The sounds work fine, even when I preview it as an HTML game in the browser, however, then I load up the app to my Z10, I can't get it to make any sounds at all. 


I don't suppose anyone has any suggestions on this? 

Posts: 49
Registered: ‎05-02-2013
My Device: Z 10
My Carrier: airtel

Re: Sounds on an HTML5 app (via webworks)

Please include the audio file in your local folder.


And try the below code.


var src="msg.mp3";
var fn = "local:///" + src;
try {
var playerInstance = new blackberry.audio.Player(fn, "audio/mp3", true);
} catch(err) {


Posts: 1,561
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Sounds on an HTML5 app (via webworks)

Standard HTML5 Audio should function and, as long as you're not mixing many sound streams simultaneously, should work just fine. Note that there may be some inherent latency between clicking play and the sound playing (100-200ms) but that is a condition of HTML5 Audio.

Note that Web Audio API is not currently supported on BlackBerry 10, so if the game is explicitly trying to leverage that API (as opposed to HTML Audio) then the playback will fail.

The quickest way to debug would likely be to build a debug version of the application and connect Web Inspector. This will allow you to step through the code and see where the audio file is attempting to be played / confirm whether any errors are being logged.

Can you please also confirm the audio file format/container that is being used? If it's something standard, it should be able to play, but can't hurt to double check.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.