Skip to content

Commit

Permalink
Merge pull request #271 from lfdversluis/master
Browse files Browse the repository at this point in the history
Add setPreviewDisplay() call on surfaceChanged() event
  • Loading branch information
saudet committed Nov 10, 2015
2 parents 5b3ba29 + 18cb395 commit d890544
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion samples/RecordActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,8 @@ public void surfaceCreated(SurfaceHolder holder) {
}

public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
stopPreview();

Camera.Parameters camParams = mCamera.getParameters();
List<Camera.Size> sizes = camParams.getSupportedPreviewSizes();
// Sort the list in ascending order
Expand Down Expand Up @@ -470,7 +472,15 @@ public int compare(final Camera.Size a, final Camera.Size b) {
Log.v(LOG_TAG,"Preview Framerate: " + camParams.getPreviewFrameRate());

mCamera.setParameters(camParams);
startPreview();

// Set the holder (which might have changed) again
try {
mCamera.setPreviewDisplay(holder);
mCamera.setPreviewCallback(CameraView.this);
startPreview();
} catch (Exception e) {
Log.e(LOG_TAG, "Could not set preview display in surfaceChanged");
}
}

@Override
Expand Down

0 comments on commit d890544

Please sign in to comment.