搜尋分類、套件與程式碼儲存庫

套件詳情v1.0.0

flutter_camera

一個適用於 iOS 和 Android 的 Flutter 插件,允許存取裝置相機並錄製影片。

AndroidiOSWeb
近 30 天下載
83
喜歡數
25
Pub 分數
120

安裝套件

flutter pub add flutter_camera

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Flutter Camera 是一個跨平台插件,適用於 Flutter,讓開發者能夠在 Android、iOS 和 Web 上存取裝置相機並錄製影片。它提供簡單的 API,用於拍攝照片、串流傳輸即時相機預覽以及錄製高品質影片。設計簡潔且效能優異,支援常見的相機操作,如對焦、閃光燈控制與解析度選擇。非常適合需要即時相機整合的應用程式,例如照片分享、視訊通話或增強實境功能。

適用情境

  • 影片錄製
  • 影像捕獲
  • 即時攝像頭預覽
  • 增強現實應用
  • 視訊會議
  • 文件掃描

主要特色

  • 跨平台支援
  • 即時攝像頭串流
  • 影片錄製
  • 影像捕獲
  • 聚焦和閃光燈控制
  • 解析度自定義

適合對象

  • 行動應用開發者
  • 即時攝像頭應用
  • 媒體豐富的應用
  • Web 和移動混合專案
  • AR/VR 結合

使用建議

  • 需要 Android 和 iOS 的相機權限
  • 某些瀏覽器中的網路攝影機支援有限
  • 效能可能在低階裝置上有所差異
  • Web 部署需要額外設定
  • 可能需要處理平台特定的邊緣情況

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Flutter Camera

pub package

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 ).
  • Only 3 lines of code

Installation

First, add flutter_camera as a dependency in your pubspec.yaml file.

iOS

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.

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();
  }
}

所屬分類

依賴

依賴清單 1 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。