Giter Club home page Giter Club logo

Comments (5)

camsim99 avatar camsim99 commented on September 27, 2024 1

Thanks for the clarification @Moncader!

Followed up on this issue with CameraX folks and I found out that the logic in the plugin does in fact follow the limitations listed in https://developer.android.com/media/camera/camerax/architecture#combine-use-cases as discussed, but this is apparently out of date. There has been an update to allow concurrent image analysis, preview, and video--something to do with shared streams. This feature was added in an earlier version of CameraX than the one we currently use. Therefore, we should try to remove the logic preventing previously unsupported concurrent use cases from being used.

Closing this issue as there's nothing actionable here and filed #150387 to follow up on these new findings.

from flutter.

huycozy avatar huycozy commented on September 27, 2024

I checked this on my Pixel 7 Android 14 and saw the same output result as 0 on the sample app. To reproduce this, I add a new file to the package example project at lib folder:

Complete sample code
import 'package:flutter/material.dart';

import 'camera_controller.dart';
import 'camera_image.dart';
import 'camera_preview.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  CameraController? _controller;

  int _counter = 0;

  @override
  void initState() {
    super.initState();
    _initializeCamera();
  }

  Future<void> _initializeCamera() async {
    final cameras = await availableCameras();
    final firstCamera = cameras.first;
    _controller = CameraController(firstCamera);
    await _controller!.initialize();
    if (mounted) {
      setState(() {});
    }

    _controller!.startVideoRecording(onAvailable: _onImage);
  }

  void _onImage(CameraImage image) {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),
      body: Stack(
        children: [
          Padding(
            padding: const EdgeInsets.all(32.0),
            child: Center(
              child: _controller != null
                  ? CameraPreview(_controller!)
                  : const CircularProgressIndicator(),
            ),
          ),
          Positioned(
            bottom: 16,
            right: 16,
            child: Text('images received: $_counter'),
          ),
        ],
      ),
    );
  }
}
flutter doctor -v
[✓] Flutter (Channel stable, 3.22.2, on macOS 14.1 23B74 darwin-x64, locale en-VN)
    • Flutter version 3.22.2 on channel stable at /Users/huynq/Documents/GitHub/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 761747bfc5 (31 hours ago), 2024-06-05 22:15:13 +0200
    • Engine revision edd8546116
    • Dart version 3.4.3
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/huynq/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/huynq/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode15.3.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • android-studio-dir = /Applications/Android Studio.app/
    • Java version OpenJDK Runtime Environment (build 17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.90.0

[✓] Connected device (3 available)
    • iPhone (mobile) • d9a94afe2b649fef56ba0bfeb052f0f2a7dae95e • ios            • iOS 15.8 19H370
    • macOS (desktop) • macos                                    • darwin-x64     • macOS 14.1 23B74 darwin-x64
    • Chrome (web)    • chrome                                   • web-javascript • Google Chrome 125.0.6422.142

[✓] Network resources
    • All expected network resources are available.

• No issues found!

from flutter.

yaakovschectman avatar yaakovschectman commented on September 27, 2024

From triage: Our understanding of the levels is that they include Limited, Full, Legacy, Level 3, and External. Can you clarify what you mean by "level 1"?

from flutter.

Moncader avatar Moncader commented on September 27, 2024

Thanks for looking in to this yaakovschectman.

I was talking about 'Full' as the value of the constant was 0x1. I assumed that 0x1 as well as the word 'full' would mean better than 'level 3' as is the case with other media systems like Widevine DRM.

Upon reading the documentation of camerax,
https://developer.android.com/reference/android/hardware/camera2/CameraMetadata#INFO_SUPPORTED_HARDWARE_LEVEL_3
I do see that Level 3 is actually better than full, and therefore logically the current implementation is correct as per this documentation:
https://developer.android.com/media/camera/camerax/architecture#combine-use-cases

So as a camerax issue, this issue could perhaps be closed... But it does beg the question of how is it possible for the recommended android camera library to not support even the most basic of AR features on even a Google phone like Pixel 6 Pro...

from flutter.

github-actions avatar github-actions commented on September 27, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.