Welcome!

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


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.


Reply
Regular Contributor
Posts: 64
Registered: ‎06-16-2011
My Device: bold 9000, playbook
My Carrier: vodafone
Accepted Solution

Playbook <audio> not playing.

Hello Experts,

 

I am trying to play a click sound  when the button is clicked in my application , I am unable to get the solution. 

Currently I am using the following code :

 

var audio = document.createElement('audio');
audio.src='button-29.wav';
audio.controls = true;
document.body.appendChild(audio);

 

Please help me to play the sound when the button is clicked.

 

Regards,

Sandesh.

Developer
Posts: 51
Registered: ‎10-22-2011
My Device: 9800
My Carrier: Telus

Re: Playbook <audio> not playing.

Something like
button.addEventListener("click", function() {audio.play();}, 0);
should do it? Of course, you'll have to have created the button before this code. If that doesn't work: - Make sure the "audio" object you created is in scope at the point you execute the above code (or give it an id and get it) - Make sure the wav file is not some format unsupported on the device - Make sure you have the full and correct path to the sound file
Regular Contributor
Posts: 64
Registered: ‎06-16-2011
My Device: bold 9000, playbook
My Carrier: vodafone

Re: Playbook <audio> not playing.

[ Edited ]

Thanks it worked Smiley Happy