packages icon indicating copy to clipboard operation
packages copied to clipboard

[camera] Options to scan for physical and/or logical cameras on iOS

Open rickcasson opened this issue 1 year ago • 3 comments

Based on feedback from @stuartmorgan, I have refactored my original PRs (#5957 and #5958) to not disrupt the existing functionality of the availableDevices method, while still providing the option to access the extended list of iOS cameras (both physical and logical) based on Apple's documentation: https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype

This changes hopefully make room to eventually add the ability to access logical cameras on Android (or other?) devices at some point, but the changes on iOS were more pressing for my project so I wanted to at least start there.

I've included external cameras as "physical devices" so this PR should fix the same issue as #5892.

List which issues are fixed by this PR. You must list at least one issue. closes flutter/flutter#134151 closes flutter/flutter#130073 closes flutter/flutter#142025

Pre-launch Checklist

  • [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • [x] I read and followed the [relevant style guides] and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use dart format.)
  • [x] I signed the [CLA].
  • [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g. [shared_preferences]
  • [x] I listed at least one issue that this PR fixes in the description above.
  • [x] I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • [x] I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • [x] I updated/added relevant documentation (doc comments with ///).
  • [x] I added new tests to check the change I am making, or this PR is [test-exempt].
  • [x] All existing and new tests are passing.

rickcasson avatar Jan 31 '24 20:01 rickcasson

Based on feedback from @stuartmorgan, I have refactored my original PRs (#5957 and #5958) to not disrupt the existing functionality of the availableDevices method, while still providing the option to access the extended list of iOS cameras (both physical and logical)

My primary feedback, which continues to be true, is that this needs a full design proposal (https://github.com/flutter/flutter/wiki/Design-Documents). There are many possible ways to handle different device types, and this PR would lock us into a specific one without there having been a discussions of alternatives and the pros and cons of each.

This changes hopefully make room to eventually add the ability to access logical cameras on Android (or other?) devices at some point

If we can't confidently answer the question of whether this API will apply well to other platforms, that's a strong signal that this hasn't gone through sufficient evaluation yet. See https://github.com/flutter/flutter/wiki/Contributing-to-Plugins-and-Packages#platform-support

but the changes on iOS were more pressing for my project so I wanted to at least start there

Our priority is the long term health and usability of the plugin's API surface; our process is designed to support that rather than patchworks of APIs developed in small pieces based on individual contributor deadlines, as cases where the latter has happened the outcomes have often not been good.

stuartmorgan-g avatar Jan 31 '24 21:01 stuartmorgan-g

I took a quick look at MDN, and I don't think there's a concept of Logical/Physical Cameras in the Web. Cameras (and other types) are just providers of a MediaStream that can be connected to a Canvas or a WebRTC connection.

There's also no "constraint" to select physical from logical cameras. See: MediaTrackConstraints.

(It wouldn't be the first time that the web ignores values from some parameters, though!)

ditman avatar Feb 14 '24 03:02 ditman

Marking as a draft pending a design document, per comment above.

stuartmorgan-g avatar Mar 05 '24 20:03 stuartmorgan-g

(triage): I am going to close this one since there hasn't been any follow-up. If you find the time to address the feedback given above please reopen this. Thank you.

goderbauer avatar May 07 '24 22:05 goderbauer