flutter_camera
iOS 및 Android용 플러터 플러그인으로 장치 카메라에 액세스하고 비디오를 녹화할 수 있습니다.
iOS 및 Android용 플러터 플러그인으로 디바이스 카메라에 접근하고 비디오를 녹화할 수 있습니다
{"sdk":"flutter"}^0.10.5+3{"sdk":"flutter"}^1.0.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
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
First, add flutter_camera as a dependency in your pubspec.yaml file.
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:
Privacy - Camera Usage Description and a usage description.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>
Change the minimum Android sdk version to 21 (or higher) in your android/app/build.gradle file.
minSdkVersion 21
Here is a small example flutter app displaying a full screen camera preview with video recording.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_camera/flutter_camera.dart';
class CameraPage extends StatefulWidget {
const CameraPage({Key? key}) : super(key: key);
@override
_CameraPageState createState() => _CameraPageState();
}
class _CameraPageState extends State<CameraPage> {
@override
Widget build(BuildContext context) {
return FlutterCamera(
color: Colors.amber,
onImageCaptured: (value) {
final path = value.path;
print("::::::::::::::::::::::::::::::::: $path");
if (path.contains('.jpg')) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Image.file(File(path)),
);
});
}
},
onVideoRecorded: (value) {
final path = value.path;
print('::::::::::::::::::::::::;; dkdkkd $path');
///Show video preview .mp4
},
);
// return Container();
}
}