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
Highlighted
Developer
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
My Carrier: AT&T
Accepted Solution

playbook 2.0 microphone api (2.2sdk)

i'm using this link

 

i keep getting an undefined error in the try/catch for the record.  i'm not too familiar with the workings of the playbook's file directory.

 

when i hit the record button it calls the following code:

 

blackberry.media.microphone.record(blackberry.io.dir.appDirs.shared.music.path + '/' + document.getElementById('filename').value (use the given <p> to input the filename), testSuccess, testError);

 

do i need to specify the extension for the filename? i.e. testSound.wav or just testSound

 

i also tried to hardcode the filename as follows:

 

blackberry.media.microphone.record(blackberry.io.dir.appDirs.shared.music.path + '/testSound.wav', testSuccess, testError);

 

i added these to my config file:

 

<rimSmiley Tongueermit>access_shared</rimSmiley Tongueermit>
<rimSmiley Tongueermit>record_audio</rimSmiley Tongueermit>

<feature id="blackberry.io.dir" />
<feature id="blackberry.io.file" />
<feature id="blackberry.media.microphone" />

 

again - i'm not too sure about the io.dir and io.file, but since i'm working with saving a file in a specified directory i figured they may be needed.

 

any help on what i'm doing wrong here would certainly be appreciated.

 

THANKS!!!

Developer
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
My Carrier: AT&T

Re: playbook 2.0 microphone api (2.2sdk)

solved.

 

@blackberrydev shared this link - got everything i needed and more!  thanks!!!

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: playbook 2.0 microphone api (2.2sdk)

Yes you need to specify an extension.

 


If it helps, here is a sample application that includes a demo showing how to use microphone:

https://github.com/blackberry/WebWorks-Samples/tree/master/kitchenSink

 

Here is the source code for the JS file, followed by a summarized snippet of code being used:

https://github.com/blackberry/WebWorks-Samples/blob/master/kitchenSink/js/apis/microphone.js

 

var filePath = blackberry.io.dir.appDirs.shared.music.path;
var result = blackberry.media.microphone.record(filePath + "/test.wav", onAudioCaptured, onError);

 

 

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.
Developer
Posts: 39
Registered: ‎03-01-2011
My Device: PlayBook
My Carrier: AT&T

Re: playbook 2.0 microphone api (2.2sdk)

i think this link for the kitchenSink should be stickied to the top...  a lot of new folks to webworks look there for the most important of tools/resources.

 

thanks for the help!

Retired
Posts: 1,382
Registered: ‎07-02-2009
My Device: BlackBerry Bold 9900
My Carrier: Bell

Re: playbook 2.0 microphone api (2.2sdk)

Yeah that's a good idea. We do have "Sample Apps" published at the top of the BlackBerry HTML5 site https://bdsc.webapps.blackberry.com/html5/ however it certainly wouldn't hurt to sticky similar information in this forum.

Follow me on Twitter: @n_adam_stanley
-------------------------------------------------------------------------------------------------------------------------
Your app doesn't work? Use BlackBerry remote web inspector to find out why.