KarthiPnsmy / AudioRecorder

Titanium audio recorder module for Android
http://www.titaniumtutorial.com/2013/09/audio-recorder-module.html
Other
67 stars 28 forks source link

setAudioSource failed #3

Open AppWerft opened 8 years ago

AppWerft commented 8 years ago

Hi,

in my simple app (android 5-.* Nexus5) comes after 'audioRecorder.startRecording' the error message:

02-03 12:01:59.316 203 822 W ServiceManager: Permission failure: android.permission.RECORD_AUDIO from uid=10231 pid=26728 02-03 12:01:59.316 203 822 E MediaRecorderService: Request requires android.permission.RECORD_AUDIO 02-03 12:01:59.316 26728 26749 W System.err: java.lang.RuntimeException: setAudioSource failed.

Here my code snippet:

var audioRecorder = require('titutorial.audiorecorder');
audioRecorder.startRecording({
    outputFormat : audioRecorder.OutputFormat_MPEG_4,
    audioEncoder : audioRecorder.AudioEncoder_AAC,
    directoryName : "recordings",
    maxDuration : MAXDURATION,
    success : function(e) {
    },
    error : function(d) {
    }
});

Remark: in my manifest is outside of application the entry: uses-permission android:name="android.permission.RECORD_AUDIO"/

I found in /system configuration/apps/myApp/permissions an unset checkbox for microphone. After setting I can start the recorder without problems. I think we need a method audioRecorder.hasMicrophonPermission() and an intent to this configuration of app.

Like this:

Intent intent = new Intent();
intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
intent.setData(uri);
context.startActivity(intent);
eliashajj commented 8 years ago

Were you able to solve this issue? I'm facing the same problem on some devices.

AppWerft commented 8 years ago

Yes, in new sdk 5.4.0. you can easy request the permissions.

eliashajj commented 8 years ago

I am using SDK 5.5.0 and tried on SDK 5.4.0 I get "Uncaught Error: setAudioSource failed." audioRecorder.startRecording

In tiapp.xml I added `

`