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

Camera is Freezing #2

Closed
enversalih opened this issue Nov 5, 2014 · 3 comments
Closed

Camera is Freezing #2

enversalih opened this issue Nov 5, 2014 · 3 comments

Comments

@enversalih
Copy link

After i open easycamera class, i get preview of the camera but camera is freezing.

public class MakePhotoActivity extends Activity {

SurfaceHolder previewHolder;
SurfaceView mSurfaceView;
private boolean previewIsRunning;
private EasyCamera camera;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mSurfaceView = (SurfaceView) findViewById(R.id.surface);
    previewHolder = mSurfaceView.getHolder();
    previewHolder.addCallback(new SurfaceHolder.Callback() {

        public void surfaceChanged(SurfaceHolder holder, int format,
                int width, int height) {
             if (!previewIsRunning && (camera != null)) {
                 try {
                    camera.startPreview(holder);
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                 previewIsRunning = true;
             }
        }

        public void surfaceCreated(SurfaceHolder holder) {

            camera = DefaultEasyCamera.open(CameraInfo.CAMERA_FACING_FRONT);

        }

        public void surfaceDestroyed(SurfaceHolder holder) { 
            camera.close();
            camera = null;

        }

    });
}

}

@Glamdring
Copy link
Owner

You mean, the preview is stuck? What is your phone model, and is that reproducible on another device?

@Glamdring
Copy link
Owner

Hi, can you elaborate please? Did you manage to resolve to problem?

@Glamdring
Copy link
Owner

I'm closing the issue due to lack of more details. Feel free to reopen it when you are available.

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

2 participants