05-22-2011 03:09 PM
I have scanned a few threads here about sound some claim to have fixes but nothing has worked for me so far.
From my config.xml
<feature id="blackberry.audio.Player" />
Script:
var playerInstance = new blackberry.audio.Player("local:///woosh.mp3","audi o/mpeg", true); playerInstance.play();
I've tried adding the playerInstance.play(); tag to where I need it within my app but it always fails even on actual devices. Is there something obvious that I am missing or is the API broken?
Solved! Go to Solution.
05-23-2011 05:09 AM
First, put these 2 lines of the feature element completely:
<feature id="blackberry.audio" version="1.0.0.0"/> <feature id="blackberry.audio.Player" version="1.0.0.0"/>
Second, put the mp3 file in the root folder of your application.
06-03-2011 03:06 PM
This works for me:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>File I/O Example</title> <meta name="HandheldFriendly" content="True" /> <script type="text/javascript"> var playerInstance; function initialLoad() { playerInstance = new blackberry.audio.Player("local:///sounds/beep.mp3" ,"audio/mpeg", true); // Hint: crashes here if file isn't found // despite posting below, it does NOT have to be at the root // this will NOT work if your surf to this page - you MUST be embedded and MUST be (i guess) on your original page. } </script> </head> <body onload="initialLoad()"> <a href="javascript:playerInstance.play();">pla y</a> <br/>Amazingly, this works. <p> see: http://supportforums.blackberry.com/t5/Web-and-Web Works-Development/Sound-will-NOT-play/td-p/1098623 </body> </html>