naseemakhtar994 / cameraview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CameraView

This is a preview release. The API is subject to change.

This is not an official Google product.

CameraView aims to help Android developers easily integrate Camera features.

Requires API Level 14. The library uses Camera 1 API on API Level 14-20 and Camera2 on 21 and above.

Features

  • Camera preview by placing it in a layout XML (and calling the start method)
  • Configuration by attributes
    • Aspect ratio (app:aspectRatio)
    • Auto-focus (app:autoFocus)
    • Flash (app:flash)

Usage

<com.google.android.cameraview.CameraView
    android:id="@+id/camera"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:keepScreenOn="true"
    android:adjustViewBounds="true"
    app:autoFocus="true"
    app:aspectRatio="4:3"
    app:facing="back"
    app:flash="auto"/>
    @Override
    protected void onResume() {
        super.onResume();
        mCameraView.start();
    }

    @Override
    protected void onPause() {
        mCameraView.stop();
        super.onPause();
    }

You can see a complete usage in the demo app.

Contribution

See CONTRIBUTING.md.

About

License:Apache License 2.0


Languages

Language:Java 100.0%