Question

I am using S3 With Camera.Size comes to be 720*1280 Same as the screen size.

However, The camera surface appears only like the picture below not covering full screen (Length wise yes but not width wise)

enter image description here

I tried setting

  @Override
  public void onSurfaceTextureAvailable(SurfaceTexture surface,
                                        int width, int height) {
    this.surface=surface;

    cameraView.previewCreated();
    cameraView.initPreview(width, height);
  }

as

cameraView.initPreview(720, 1280);

But it had only negligible effect.

My question is, How can i make it expand to full screen like a Camera Application. What is going on in here.

Same results come up in Demo application. In my HTC results are better but still there are spaces.

Was it helpful?

Solution

This is working as designed, though what you want will be in the 0.6.0 version.

Quoting an upcoming version of the project README:


The default behavior of CameraFragment and CameraView is to show the entire preview, as supplied by the underlying Camera API. Since the aspect ratio of the preview frames may be different than the aspect ratio of the CameraView, this results in a "letterbox" effect, where the background will show through on one axis on the sides.

If you want the preview to completely fill the CameraView, at the cost of cropping off some of the actual preview frame, have your CameraHost return true from useFullBleedPreview().

Note that the pictures and videos taken by this library are unaffected by useFullBleedPreview(). Hence, if useFullBleedPreview() returns true, the picture or video may contain additional content on the edges that was not visible in the preview.


Support for useFullBleedPreview() will be in version 0.6.0 of the library, though the source code for it is already pushed to the repo and is available in the master branch. You are welcome to keep tabs on this issue for further developments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top