[MUSIC PLAYING]
DONOVAN MCMURRAY: Hi.
My name is Donovan, and I'm a developer relations engineer
at Google working on CameraX.
CameraX is a Jetpack library that's
the easiest way to add rich camera functionality
to your app that works consistently across Android
versions and devices.
With just a few lines of code, you
can add camera essentials like showing a preview
from the camera sensor, taking a photo, recording a video,
and providing tap-to-focus and pinch-to-zoom functionality.
CameraX also allows for more complex interactions,
ranging from camera extensions for portrait mode, night
capture, and more to the ability to analyze individual frames
and run them through a machine learning model.
CameraX is built around use cases
which handle common functionality required
by camera applications.
These four use cases are preview, image capture,
video capture, and image analysis.
The preview use case streams images from the camera sensor
to a surface in your UI.
A preview is vital to most camera applications.
For example, if your app lets users capture photos,
a preview shows your user what's in the frame
so that they can line up the perfect shot.
Or in a video call application, the preview
can show a user what the video on their end looks like.
When using the preview use case, you can define your own surface
for displaying the preview.
But CameraX also provides a preview view class
that manages the preview surface's lifecycle for you.
The image capture use case is designed
for capturing high-resolution, high-quality photos,
and provides auto white balance, auto exposure, and autofocus
functionality in addition to simple manual camera controls.
The result can either be returned
as an in-memory reference to the image data
or it can be saved to a file.
The video capture use case handles
all of the pieces of a video recording pipeline-- recording
video and audio streams, compressing them, mixing
the two streams, and writing the resultant stream to disk.
CameraX supports common video resolutions,
like standard definition, or 480p, high definition, or 720p,
full HD, or 1080p, and 4K Ultra HD, or 2160p.
Note that CameraX can also choose other resolutions
when authorized by the app.
Finally, the image analysis use case
provides your app with a CPU-accessible image
on which you can perform image processing, computer vision,
or machine learning inference.
The application implements an analyze method,
and that is run on each frame.
As of CameraX version 1.2, there's also
built-in ML Kit integration.
ML Kit is another Google library that
makes on-device machine learning easy.
With CameraX's ML Kit Analyzer, it's
never been easier to incorporate face detection, barcode
and QR code detection, text recognition,
and more into your app.
All four of these use cases can be used on their own
or in combination with each other.
However, due to hardware constraints
on some devices, not all use case combinations
are supported.
Please see the concurrent use cases section
in our documentation for more details.
The link is in the video description below.
Now you've got the basic concepts
you need to write code with CameraX.
Check out the video description for resources
that take an even deeper look into the concepts explored
in this video.
In the next video, we'll look at the code required
to set up CameraX in your application,
including how to request the necessary permissions.
See you in the next one.