Closed sido420 closed 3 years ago
Is it possible the permission to record hasn't been granted?
Nope, that does not seem to be the issue.
function recordVideo() {
console.log("Recording Video");
console.log(`Has camera permission? ${camera.hasCameraPermission()}`);
console.log(`Has storage permission? ${camera.hasStoragePermissions()}`);
camera.record({});
}
which ends up printing:
JS: Recording Video
JS: Has camera permission? true
JS: Has storage permission? true
JS: NativeScript-CameraPlus --- [true]
System.err: java.io.IOException: prepare failed.
System.err: at android.media.MediaRecorder._prepare(Native Method)
System.err: at android.media.MediaRecorder.prepare(MediaRecorder.java:1028)
System.err: at co.fitcom.fancycamera.Camera2.setUpMediaRecorder(Camera2.java:701)
System.err: at co.fitcom.fancycamera.Camera2.startRecording(Camera2.java:931)
System.err: at co.fitcom.fancycamera.FancyCamera.startRecording(FancyCamera.java:323)
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err: at com.tns.gen.java.lang.Object_vendor_30628_32_ClickListenerImpl.onClick(Object_vendor_30628_32_ClickListenerImpl.java:18)
System.err: at android.view.View.performClick(View.java:6312)
System.err: at android.view.View$PerformClick.run(View.java:24802)
System.err: at android.os.Handler.handleCallback(Handler.java:790)
System.err: at android.os.Handler.dispatchMessage(Handler.java:99)
System.err: at android.os.Looper.loop(Looper.java:169)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6521)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
Looks like it might be one of the settings on the MediaRecorder that needs to be adjusted or set prior to calling prepare
. https://stackoverflow.com/questions/14640734/mediarecorder-ioexception-prepare-failed
I did add the two permissions in manifest file, cleaned android project, and reran but still hitting the same issue.
Did I do it wrong?
Fixed: https://github.com/nstudio/nativescript-camera-plus/commit/b24997c918df8ceafb73443708a58708be46d5ed feel free to reopen :- update to 3.1.x
.record()
is throwing exception below on AndroidI have tried using different options but still the same issue.
.takePicture()
seems to work fine.Dependencies and Versions: