Flutter Camera 是一個跨平台插件,適用於 Flutter,讓開發者能夠在 Android、iOS 和 Web 上存取裝置相機並錄製影片。它提供簡單的 API,用於拍攝照片、串流傳輸即時相機預覽以及錄製高品質影片。設計簡潔且效能優異,支援常見的相機操作,如對焦、閃光燈控制與解析度選擇。非常適合需要即時相機整合的應用程式,例如照片分享、視訊通話或增強實境功能。
適用情境
影片錄製
影像捕獲
即時攝像頭預覽
增強現實應用
視訊會議
文件掃描
主要特色
跨平台支援
即時攝像頭串流
影片錄製
影像捕獲
聚焦和閃光燈控制
解析度自定義
適合對象
行動應用開發者
即時攝像頭應用
媒體豐富的應用
Web 和移動混合專案
AR/VR 結合
使用建議
需要 Android 和 iOS 的相機權限
某些瀏覽器中的網路攝影機支援有限
效能可能在低階裝置上有所差異
Web 部署需要額外設定
可能需要處理平台特定的邊緣情況
原始 README
以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。
Flutter Camera
A Flutter plugin for iOS and Android allowing access to the device cameras and recording of videos.
Note: This plugin is still under development, and some APIs might not be available yet. We are working on a refactor which can be followed here: issue
This package fully depends on flutter camera plugin to provide access to camera.
It only supports Android and IOS for now
Features
Display live camera preview in a widget.
Snapshots can be captured and path is returned.
Device flash light support.
Record video from camera.
Add access to the image stream from Dart.
Live camera flip ( switch between rear & front camera with a click ).
The camera plugin functionality works on iOS 10.0 or higher. If compiling for any version lower than 10.0,
make sure to programmatically check the version of iOS running on the device before using any camera plugin features.
The device_info_plus plugin, for example, can be used to check the iOS version.
Add two rows to the ios/Runner/Info.plist:
one with the key Privacy - Camera Usage Description and a usage description.
and one with the key Privacy - Microphone Usage Description and a usage description.
Or in text format add the key:
<key>NSCameraUsageDescription</key><string>Can I use the camera please?</string><key>NSMicrophoneUsageDescription</key><string>Can I use the mic please?</string>
Android
Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.
minSdkVersion 21
Example
Here is a small example flutter app displaying a full screen camera preview with video recording.