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
Contributor
Posts: 34
Registered: ‎11-01-2010
My Device: Torch 9800
My Carrier: ATT

Audio Extension ; what is the path to .mp3 file?

Hello!

 

I'm using Audio Extension to play sample.mp3 file. This file is stored inside folder [audio] within my app. Here is the code I used and it didn't work

 

var playerInstance = new  blackberry.audio.Player("file///audio/sample.mp3");

playerInstance.play();

 

I'm not sure if "file:///audio/sample.mp3" is the right path to use because it didn't work on simulator/device. Please help

 

Thanks

Developer
Posts: 482
Registered: ‎10-24-2008
My Device: 9300
My Carrier: AT&T

Re: Audio Extension ; what is the path to .mp3 file?

give this a try and post up the results.

 

 

var playerInstance = new  blackberry.audio.Player("audio/sample.mp3");

playerInstance.play();

 

If it's packaged with your WebWorks application, I think that may work.

 

_________________________________________
www.jasonmace.com/blackberry
Contributor
Posts: 34
Registered: ‎11-01-2010
My Device: Torch 9800
My Carrier: ATT

Re: Audio Extension ; what is the path to .mp3 file?

Thanks! I've tried that but it didn't work. Can Simulator plays audio or do I have to test my app on device to get sounds?

Contributor
Posts: 12
Registered: ‎10-06-2010
My Device: Not Specified

Re: Audio Extension ; what is the path to .mp3 file?

Shouldn't it be "local:///audio/sample.mp3"?


www.lionbridge.com
New Developer
Posts: 3
Registered: ‎07-29-2010
My Device: BlackBerry Bold 9000
My Carrier: NTT DoCoMo

Re: Audio Extension ; what is the path to .mp3 file?

[ Edited ]

If you're using files in your widget you'll need to use the local URI and content type. 

 

Example:

 

 

var playerInstance = new  blackberry.audio.Player("local:///mp3/sound2.mp3","audio/mpeg", true);
playerInstance.play();

 

 

 

First parameter is the URI string (local is relative to your application).

Second is the content-type (see content type example http://www.blackberry.com/developers/docs/widgetapi/).

Third parameter is to use async or not for playback.

 

That should work! I didn't test audio on simulator, but works on my Bold.

 

---------------------------------------------------------------------------------
Windows 7 64 bit
Eclipse IDE Build id: 20090920-1017
BlackBerry Web Plug-in: 2.0.0.201003191451-33
BlackBerry Widget SDK: 1.0.0.201003191451-126
BlackBerry Smartphone Simulator: 2.13.0.95