Camera 10000 error in android - what the hell is this?

I searched everything on the Internet and I can’t find out what error 1001 is. After a few seconds I get a camera error of 100, but I can’t find out what the first error is. Does anyone have any idea?

+8
android camera
source share
4 answers

I also ran into this error on my S3. I believe I tracked it before the camera preview was used by MediaRecorder. In my case, the preview display was getting reset when I tried to start recording. I solved this by clearing my code and simply using the calls to set, start and stop the preview display in the SurfaceView implementation below (from the Android Camera Developer's Guide ):

public class CameraPreview extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder mHolder; private Camera mCamera; public CameraPreview(Context context, Camera camera) { super(context); mCamera = camera; // Install a SurfaceHolder.Callback so we get notified when the // underlying surface is created and destroyed. mHolder = getHolder(); mHolder.addCallback(this); // deprecated setting, but required on Android versions prior to 3.0 mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); } public void surfaceCreated(SurfaceHolder holder) { // The Surface has been created, now tell the camera where to draw the preview. try { mCamera.setPreviewDisplay(holder); mCamera.startPreview(); } catch (IOException e) { Log.d(TAG, "Error setting camera preview: " + e.getMessage()); } } public void surfaceDestroyed(SurfaceHolder holder) { // empty. Take care of releasing the Camera preview in your activity. } public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { // If your preview can change or rotate, take care of those events here. // Make sure to stop the preview before resizing or reformatting it. if (mHolder.getSurface() == null){ // preview surface does not exist return; } // stop preview before making changes try { mCamera.stopPreview(); } catch (Exception e){ // ignore: tried to stop a non-existent preview } // set preview size and make any resize, rotate or // reformatting changes here // start preview with new settings try { mCamera.setPreviewDisplay(mHolder); mCamera.startPreview(); } catch (Exception e){ Log.d(TAG, "Error starting camera preview: " + e.getMessage()); } } } 
+5
source share

Just thought I'd add a message here for future reference. This question has bothered me for a long time. Turns out my problem was caused by the wrong preview size, although the permission set was obtained from the getSupportedPictureSize method.

So, for example, you can get the dimensions as follows:

 //first entry in list is 1392x1392 for front facing camera on an S3 List<Camera.Size> supportedPictureSizes = params.getSupportedPictureSizes(); 

Setting this resolution or neglecting to set the image size all together will cause a terrible error 1001.

If you came across this on any other device, I would recommend trying different image sizes.

+3
source share

So, there was another reason why I got it on my Galaxy S3. I used TextureView to show a camera preview and got this terrible error when I clicked the home button after a successful preview and then re-entered the application. In the onResume () function, I ran the preview again and found that I had not released the SurfaceTexture instance variable in the onSurfaceTextureDestroyed () function.

I added the release line to this function, and now it looks and works just fine:

 @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { mSurfaceTexture = null; //This was the offending culprit. releaseMediaPlayer(); releaseVideoRecorder(); releaseCamera(); return false; } 
0
source share

In my case, the Samsung S3 did not set the video size parameter, and this led to error 1001. Setting the video size on the media recorder using the preview size fixed the problem. However, this change may not work on other devices, as the parameter may or may not be available / installed on all devices. The following code is addressed to most devices:

 if(params.get("video-size") != null && params.get("video-size").isEmpty()) { int videoWidth = params.getPreviewSize().width; int videoHeight = params.getPreviewSize().height; mediaRecorder.setVideoSize(videoWidth, videoHeight); } else { mediaRecorder.setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight); } 
0
source share

All Articles