Languages

Menu
Sites
Language
Capture audio in Tizen web

Hi,

I've read previous forum posts about this, I've used many tutorials, but I'm still unable to capture audio using html and js on Tizen.

http://www.html5rocks.com/en/tutorials/getusermedia/intro/
https://subvisual.co/blog/posts/39-tutorial-html-audio-capture-streaming-to-node-js-no-browser-extensions
https://github.com/gabrielpoca/browser-pcm-stream/blob/master/public/recorder.js
http://typedarray.org/from-microphone-to-wav-with-getusermedia-and-web-audio/
https://github.com/daaain/JSSoundRecorder


None of these seems to be working on Tizen.

I've also tried the voicerecorder from Wearable samples, but it's massive and I sincerely hope that it's not the minimal and best way.

 

So basically:

Is there a way to record sound on Tizen Web? 

 

Cheers.

Edited by: Adam P. on 28 Jul, 2015

Responses

6 Replies
Alex Dem

Hi,
I did not face with audio recording for Web. I recorded audio in Tizen Mobile devices from microphone in Native app only.
Tutorial about getUserMedia is here (there is mention to Self Camera example also): 
https://developer.tizen.org/development/tutorials/web-application/w3chtml5supplementary-features/media/getusermedia-0
Maybe you could try to add privilege & feature , see https://developer.tizen.org/dev-guide/2.3.0/org.tizen.web.apireference/html/w3c_api/w3c_api_m.html#getusermedia
Alexey.

Seoghyun Kang

Hello,

 

As your comment, the VoiceRecorder is the sample application about the recoding the audio.

Although the sample is big, there are the core codes in the js/models/audio.js and js/modles/streams.

It is just using the getUserMedia. Please refer the it.

 

If you have any questions about the voicerecorder, please register it.

 

 

 

Seoghyun Kang

We are updating the document of the VoiceRecorder. It will be releaed in the next SDK soon.

I will upload some parts. I hope it will be help for you.

 

1) When application starts or goes foreground, it obtains audio stream (with the models/steam) and initializes the models/audio module which uses Camera API to create CameraControl object.

2) The voice recording process starts when user touches the record button. views/main module calls the startRecording function of the models/audio module when click event is detected.

3) models/audio module starts processing the request. It applies the audio file settings (CameraControl.recorder.applySettings) and starts recording (CameraControl.recorder.start). If there is no error, it starts tracing recording time and notifies other modules about finished operation (by  models.audio.recording.start event).

4) When the user touches the stop button or when audio file time limit is exceeded, the stopRecording function of the models/audio module is called.
 It requests the CameraControl object to stop current recording and finally fires the models.audio.recording.done event with the audio filename as its details. The views/main module listens to this event and opens separate view to allow the user to preview the recorded file.

 

Please refer it.

Thanks.

 

Adam P.

Hi,

Thanks for the help.

@Alex - I've read these docs, used them, and still nothing.

Each time I run

if (!navigator.getUserMedia){
        navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
    }
    
    if (navigator.getUserMedia){
        navigator.getUserMedia({audio:true}, success, function(e){
            console.log(JSON.stringify(arguments));
            for(var i=0; i<arguments.length; i++){
                console.log(JSON.stringify(arguments[i]));
            }
        });
    }
}

I get this:

{"code":1}

From here I found that this means "permission denied".

 

However, when instead of
navigator.getUserMedia({audio:true}, success, function(e){

I do
navigator.getUserMedia({audio:true, video:true}, success, function(e){

The function loads. I'm gonna look into it and try to get this to work, but I really have no idea why when in audio only it doesn't work...

 

Seoghyun Kang

Hello,

 

The VoiceRecoder sample is using the following code. I know that there is no problem now.

Could you check whether the VoiceRecoder sample works well on your device?

function getUserMedia(onUserMediaSuccess, onUserMediaError) {
    navigator.webkitGetUserMedia(
    {
        video: false,
        audio: true
    },
    onUserMediaSuccess,
    onUserMediaError
    );
}

 

Maciej

Hello

Regarding audio capture - I know it is possible to record audio to file, using getUserMedia and then the Camera API (CameraControl etc.). It is nicely presented in the Voice Recorder sample, as stated by S. Kang above.

However, what I need to do is simply analyze the audio input. I don't need to store it. I need to analyze it in real time and look for specific patterns/information.

Is it possible? How can I do it? I can't seem to find any example. Camera API only has options to store to a specific file in a chosen format. How about accessing the raw data before it is stored?

Seoghyun Kang can you please comment?

Thank you