Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On Android 6.0 camera does not start #25

Closed
easytome opened this issue May 27, 2016 · 4 comments
Closed

On Android 6.0 camera does not start #25

easytome opened this issue May 27, 2016 · 4 comments

Comments

@easytome
Copy link

Android4.4.2,It runs normally.
on Android6.0 ,Exception:Camera disabled or in use by other process

Here is the log:
W/System.err: java.lang.RuntimeException: Fail to connect to camera service
W/System.err: at android.hardware.Camera.(Camera.java:542)
W/System.err: at android.hardware.Camera.open(Camera.java:397)
W/System.err: at com.jmolsmobile.landscapevideocapture.camera.NativeCamera.openNativeCamera(NativeCamera.java:27)
W/System.err: at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:54)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:63)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.(VideoRecorder.java:58)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:83)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:71)
W/System.err: at android.app.Activity.performCreate(Activity.java:6303)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2374)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
W/System.err: at android.app.ActivityThread.access$900(ActivityThread.java:153)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5432)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
E/VideoCapture_Exception: Unable to open camera - Camera disabled or in use by other process
W/System.err: com.jmolsmobile.landscapevideocapture.camera.OpenCameraException: Camera disabled or in use by other process
W/System.err: at com.jmolsmobile.landscapevideocapture.camera.CameraWrapper.openCamera(CameraWrapper.java:57)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.initializeCameraAndPreview(VideoRecorder.java:63)
W/System.err: at com.jmolsmobile.landscapevideocapture.recorder.VideoRecorder.(VideoRecorder.java:58)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.initializeRecordingUI(VideoCaptureActivity.java:83)
W/System.err: at com.jmolsmobile.landscapevideocapture.VideoCaptureActivity.onCreate(VideoCaptureActivity.java:71)
W/System.err: at android.app.Activity.performCreate(Activity.java:6303)
W/System.err: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
W/System.err: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2374)
W/System.err: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
W/System.err: at android.app.ActivityThread.access$900(ActivityThread.java:153)
W/System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1349)
W/System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
W/System.err: at android.os.Looper.loop(Looper.java:148)
W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5432)
W/System.err: at java.lang.reflect.Method.invoke(Native Method)
W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:735)
W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)

@easytome
Copy link
Author

easytome commented Jun 2, 2016

I have found the cause of the problem,
android6.0 need request Permission.

@easytome easytome closed this as completed Jun 2, 2016
@JeroenMols
Copy link
Owner

Great to hear!

@flyou
Copy link

flyou commented Jun 22, 2016

if user did't give the permission of

the camera can prew but can not record video
when i open the camera will appear can not connect the camear service

@rennovale
Copy link

rennovale commented Mar 27, 2020

Can somebody tell me how request permission for the activity? Because i'm asking and nothing changes. The "request" popup appears, i'm accepting and same "Camera in use" message appears.

Basically i'm using this in my MainActivity

ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, STORAGE_PERMISSION_CODE);
The MainActivity call the recordvideo() method after checking if the permission was conceded

final Intent intent = new Intent(this, VideoCaptureActivity.class);
            intent.putExtra(VideoCaptureActivity.EXTRA_CAPTURE_CONFIGURATION, configuration);
            intent.putExtra(VideoCaptureActivity.EXTRA_OUTPUT_FILENAME, videoUri);
            startActivityForResult(intent, REQUEST_VIDEO_CAPTURE);

I was having this trouble with the android default service to record videos, but my permission fixed the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants