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

Reply
Developer
TheFlowFX
Posts: 166
Registered: ‎02-15-2012
My Device: Playbook 16GB
My Carrier: Bags are useful

Sound not Working - Urgent

I've tested my app in Chrome and Ripple and I have an image when pressed plays a sound. Works perfectly, but apparently not on the actual device.

 

<script type="text/javascript">
		function playSound(soundfile) {
 document.getElementById("audio").innerHTML="";
 document.getElementById("audio").innerHTML=
 "<embed src=\""+soundfile+"\" hidden=\"true\" autostart=\"false\" loop=\"false\" />";
 
 }

function stopsound() {
document.getElementById("audio").innerHTML="";
}
</script>

 That is the script Im using and I dont know where Im wrong. Also I have a <div id="audio"></div> in my body tag.

 

Someone know the solution?

If any post helps you please click the Like Button below the post(s) that helped you.
2. Please resolve your thread by marking the post "Solution?" which solved it for you!

Please use plain text.
Developer
DueNorth
Posts: 135
Registered: ‎09-25-2012
My Device: Dev Alpha
My Carrier: Rogers

Re: Sound not Working - Urgent

The device is case sensitive on file names... so that would be one thing I would check. Took me a bit to figure that one out before (worked on Ripple/Chrome, but not on device). 

 

Interesting way of managing sound. 

Please use plain text.
Contributor
icq782443
Posts: 22
Registered: ‎02-21-2012
My Device: Playbook torch 9800
My Carrier: Telus

Re: Sound not Working - Urgent

[ Edited ]

try:

 

var mySound = new Audio("sound.mp3");

 

and :

 

mySound.play();

 

If you want to get into rapidly repeating audio, I've fought with that too, and got it working :smileywink:

 

I am assuming this is for BB10 because the solution varries based on the device.

Please use plain text.