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

Native Development

Reply
Highlighted
Contributor
Posts: 24
Registered: ‎11-05-2012
My Device: BB10
My Carrier: Airtel

How to record audio files and play that file?

Hi,

 

 I want to record  audio files and play that files. Here i showed my sample code. please tell is it correct or not . i used the cascades cppfunctions.  do want any other code include in this sample set of code.

is there any way to see the audio files in blackberry 10 alpah device or application file. 

 

i include these two header files

 

#include <bb/multimedia/MediaPlayer>

#include <bb/multimedia/AudioRecorder>

 

and also set permission  on the bar-descriptor.xml file

 

<permission>access_shared</permission>
<permission>record_audio</permission>
<permission>play_audio</permission>

 

void Voicerecorder::startAudioRecording()

{
QUrl url=QString("/temp/recording.mp3");

recorder.prepare();
recorder.setOutputUrl(url);
recorder.record();

}
void Voicerecorder::stopAudioRecording()
{

recorder.reset();

MediaPlayer mp(this);
QUrl urlpath=QString("/temp/recording.mp3");
mp.setSourceUrl(urlpath);
mp.play();

 

}

 

 

using "recorder.setOutputUrl(url) " this function . is it automattically create "temp"  folder and save mp3 file as "recording.mp3".  please help me.

 

 

thanks,

renjini.