packages
packages copied to clipboard
[camera] Options to scan for physical and/or logical cameras on iOS
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.yamlwith an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes]. - [x] I updated
CHANGELOG.mdto 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.
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.
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!)
Marking as a draft pending a design document, per comment above.
(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.