camera_android

An Android implementation of camera built with the Camera2 library.

Usage

As of camera: ^0.11.0, to use this plugin instead of camera_android_camerax, run

$ flutter pub add camera_android

Limitation of testing video recording on emulators

MediaRecorder does not work properly on emulators, as stated in the documentation. Specifically, when recording a video with sound enabled and trying to play it back, the duration won't be correct and you will only see the first frame.

Custom Video Recording Path

Although it is possible to use an absolute path like /storage/emulated/0/Download/video.mp4, this is a fragile practice and may fail on many devices or Android versions due to Scoped Storage restrictions.

  • Best Practice: Always use the path_provider package to fetch a safe, writable directory.
  • Recommended Directory: Use getTemporaryDirectory() or getApplicationDocumentsDirectory().

Libraries

camera_android