Subscription preference

Notification emails are sent to your Samsung account email address.

* Email :



Capturing Audio on the Gear 2

Forums View
Started by Newbie davidjay , 760 Seed May 06, 2014 17:43 Replies : 9 View : 13155 Likes : 24
I am attempting to capture audio on the Gear 2 to send it to the phone for voice recognition (I'm aware that there are no voice recognition APIs, I'm just ainterested in capturing audio and transmitting it to the phone.)

I've found two ways to tackle this, neither of which have worked, and would love insight into how the existing voice recognition and voice recorder apps do audio capture.

In both cases I am starting by enabling the appropriate permissions in the config.xml file:


<tizen:privilege name=""/>
<tizen:privilege name=""/>


Attempt 1

Try to capture audio through standard webRTC:


navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;

navigator.getUserMedia({audio: true}, function(localMediaStream) {
  var context = new webkitAudioContext;
  var source = context.createMediaStreamSource(localMediaStream);
  var analyzer = context.createAnalyser();
  console.log('Audio Ready.');
}, function(err) {
  console.log('Error: ' + err)

function logoutput(analyser) {
  setInterval(function() {
    var freqByteData = new Uint8Array(1)


This code should print a numerical audio level to the console every 200 miliseconds. It works in Chrome and Firefox consoles, but not on the Gear (returning an audio level of "0".) It's possible that navigator.getUserMedia is returning a localMediaStream other than the watch's microphone, in which case I'm not sure how to find the microphone's audio.

Attempt 2

I followed these instructions for implementing an audio recorder on Tizen:

This framework requires a "service app" to be loaded, identified by gServiceAppId:


function onGetAppsContextSuccess(contexts) {
  for (var i = 0; i < contexts.length; i++) {
    var appInfo = tizen.application.getAppInfo(contexts[i].appId);
    if( == gServiceAppId){
      console.log("Running Service App found");
if (ServiceAppFound) {
    console.log("Service App found and ready to serve");
    // Now initialize the message ports
    console.log("Initializing message ports");
    console.log("Service app not ready, will launch the service now");

It's unclear what this Service App is on the Gear (also, "launchServiceApp()" includes a command that requires platform privileges to run.

Are either of these a good way to tackle the problem? What's the best way to do simple audio capture?


gear , voice , audio

Post Reply
Board View
Samsung Developer cjbijoy , 37520 Seed May 07, 2014 06:27 Post #1 4
Since this is related to Tizen app developement, I guess you will get a better answer from Tizen forum for your issue,
Post Reply
Board View
Newbie davidjay , 760 Seed May 07, 2014 14:59 Post #2 4
The Gear 2 runs a modified version of Tizen, and does not support the installation of Tizen apps. My understanding is that it supports Tizen web apps, and has a different set of services available for them than for native Tizen. The standard Tizen solution to this problem (shown above) doesn't work on the Gear 2, so I'm not certain that the Tizen forum would be of help.
Post Reply
Board View
Newbie nourdev , 780 Seed May 07, 2014 17:30 Post #3 4
Tizen wearable IDE/SDK has already sample app that record audio

Post Reply
Board View
Newbie davidjay , 760 Seed May 07, 2014 18:21 Post #4 2
Which one? I see one that controls media using Audio element in javascript, but that element doesn't have recording functionality.

Everything points back to the MediaStream API as the standard way to handle this:

That stream loads fine on the watch, but for some reason (unless I'm missing something) it hasn't been connected to input from the microphone.

Post Reply
Board View
Newbie davidjay , 760 Seed May 07, 2014 19:33 Post #5 3
Just saw that there's a new version of the Tizen Wearable IDE out that addresses this problem:

Post Reply
Board View
Newbie nourdev , 780 Seed May 07, 2014 21:17 Post #6 3
Yeah,AudioRecorder app uses Camera API

can you check if the API works on Gear 2 neo. Can you record audio on Neo without camera?


Post Reply
Board View
Developer patryk.zoltowski , 1190 Seed Jun 30, 2014 10:30 Post #7 1

Did anyone manage to get audio stream for processing (gear 2 neo)? I tried to use GetUserMedia as recommended on tizen for wearable documentation but didn't have any luck -my event handlers for audio processing are not called. I added appriopriate privilages.

I used the snippet code from here:
Post Reply
Board View
Newbie bit.varun , 960 Seed Jul 28, 2014 01:25 Post #8 2


 var audioControl;

video : false,
audio : true
}, onStream, onStreamError);

function onStream(stream) {
//register stream
navigator.tizCamera.createCameraControl(stream, onAudioControlCreated, onAudioControlError);

function onAudioControlCreated(control) {
audioControl = control;

var settings = {};
settings.fileName = fileName;
settings.recordingFormat = 'mp3';
audioControl.recorder.applySettings(settings, onAudioSettingsApplied, onAudioSettingsError);

Now you can use :
audioControl.recorder.start(onRecordingStart, onRecordingStartError);


Post Reply
Board View
Newbie quki09 , 350 Seed Aug 30, 2015 07:56 Post #9 1
Is it possiple to use mp3 file format like settings.recordingFormat = 'mp3'  ?

I was able to use only amr fileformat.

When I changed 'amr' to 'mp3' at that part, I got CameraSettingErrors.
Post Reply