Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[camera_avfoundation] Crash when taking a photo after switching cameras during recording #168134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RobertOdrowaz opened this issue May 1, 2025 · 1 comment
Labels
c: crash Stack traces logged to the console p: camera The camera plugin package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team

Comments

@RobertOdrowaz
Copy link

Steps to reproduce

  1. Run the camera example app
  2. Select a camera
  3. Start recording
  4. Switch to a different camera (this currently doesn't work because of this issue, but I will merge a fix for it shortly)
  5. Stop recording
  6. Take a picture

Expected results

Picture is taken and saved

Actual results

Crash with an exception

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] No active and enabled video connection'
*** First throw call stack:
(0x18a50d2ec 0x187991a7c 0x1a967fcf4 0x100e57514 0x100e4c9c4 0x100e465f0 0x101aa4584 0x101abe064 0x101aac91c 0x101aad5a4 0x101ab9894 0x101ab8eb0 0x214971660 0x21496e9f8)
libc++abi: terminating due to uncaught exception of type NSException

Code sample

The issue can be reproduced on the current (hash: 8d01cd9a48399d52821e35212644037bdbe8eab7) camera example app (not the camera_avfoundation example app because IIRC it blocks switching cameras during recording)

Screenshots or Video

No response

Logs

Logs
flutter: The Dart VM service is listening on http://127.0.0.1:51345/vxD_e8S6l28=/
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCapturePhotoOutput capturePhotoWithSettings:delegate:] No active and enabled video connection'
*** First throw call stack:
(0x18a50d2ec 0x187991a7c 0x1a967fcf4 0x100e57514 0x100e4c9c4 0x100e465f0 0x101aa4584 0x101abe064 0x101aac91c 0x101aad5a4 0x101ab9894 0x101ab8eb0 0x214971660 0x21496e9f8)
libc++abi: terminating due to uncaught exception of type NSException

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.27.4, on macOS 14.1.1 23B81 darwin-arm64, locale en-PL)
    • Flutter version 3.27.4 on channel stable at /Users/robert/fvm/versions/3.27.4
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision d8a9f9a52e (3 months ago), 2025-01-31 16:07:18 -0500
    • Engine revision 82bd5b7209
    • Dart version 3.6.2
    • DevTools version 2.40.3

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at /Users/robert/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/robert/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15A507
    • CocoaPods version 1.16.2

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

[✓] Android Studio (version 2024.2)
    • 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
    • Java version OpenJDK Runtime Environment (build 21.0.5+-13047016-b750.29)

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

[✓] Connected device (5 available)
    • Robert’s iPhone (mobile)        • 00008110-000275E03ABA401E            • ios            • iOS 18.4.1 22E252
    • iPhone 15 Pro (mobile)          • 249E15C2-6A2F-418A-9F17-E49B20537775 • ios            • com.apple.CoreSimulator.SimRuntime.iOS-17-0
      (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 14.1.1 23B81 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 14.1.1 23B81 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 135.0.7049.115
    ! Error: Browsing on the local area network for Anna’s iPad. Ensure the device is unlocked and attached with a cable or associated with
      the same local area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

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

• No issues found!
@RobertOdrowaz RobertOdrowaz added p: camera The camera plugin platform-ios iOS applications specifically labels May 1, 2025
@RobertOdrowaz
Copy link
Author

A bit more context:

  1. There are some fairly obvious issues with the setDescriptionWhileRecording that I've noticed before that may be related to this issue comment
  2. It seems this issue was already reported earlier but without a concrete steps to reproduce 131916, 144975
  3. I'm currently working on migrating camera_avfoundation to Swift and will be migrating the FLTCam class in a next PR which includes setDescriptionWhileRecording but I will translate it as close to verbatim as possible so this shouldn't affect this issue

@darshankawar darshankawar added package flutter/packages repository. See also p: labels. c: crash Stack traces logged to the console team-ios Owned by iOS platform team platform-ios iOS applications specifically and removed c: crash Stack traces logged to the console platform-ios iOS applications specifically package flutter/packages repository. See also p: labels. labels May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: crash Stack traces logged to the console p: camera The camera plugin package flutter/packages repository. See also p: labels. platform-ios iOS applications specifically team-ios Owned by iOS platform team
Projects
None yet
Development

No branches or pull requests

2 participants