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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Web and WebWorks Development

Reply
New Contributor
aaronjylee
Posts: 7
Registered: ‎10-03-2012
My Carrier: Bell

Sound doesn't play

Here is my follwing code:


playAudio: function(src) {

var fn = "audio/" + src;
try {
var playerInstance = new blackberry.audio.Player(fn, "audio/m4a", true);
playerInstance.play();
} catch(err) {
txt="Error playing audio\n\n" + fn + "\n\n";
txt+="Error: " + err.message + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
},

I have an "audio" file with the file "Confidence.m4a" in it, which is in the root file.

In another function, I have

 

this.playAudio("Confidence.m4a");

 

But I get an error: undefined when I try to call the method.

 

I've added 

 

<feature id="blackberry.audio" version="1.0.0.0"/>
<feature id="blackberry.audio.Player" version="1.0.0.0"/>

 

to my config.xml file.

 

What is the problem here?

Please use plain text.