packages icon indicating copy to clipboard operation
packages copied to clipboard

[camera_avfoundation] Adds support for discovering external camera devices on iOS 17 onwards.

Open bibaswan-bhawal opened this issue 1 year ago • 14 comments

This PR adds support for discovering external cameras in iOS devices with USB-C i.e. iPad.

This should address https://github.com/flutter/flutter/issues/130073

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.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

bibaswan-bhawal avatar Jan 14 '24 10:01 bibaswan-bhawal

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

flutter-dashboard[bot] avatar Jan 14 '24 10:01 flutter-dashboard[bot]

I was having trouble getting the changelog command working throwing

ProcessException: fatal: Not a valid object name upstream\main
  Command: git merge-base upstream\main HEAD

any insight would be helpful, then I can resolve some of the failing checks

bibaswan-bhawal avatar Jan 14 '24 10:01 bibaswan-bhawal

The error thrown by XCode says that Use of undeclared identifier 'AVCaptureDeviceTypeExternal' but this is known to be a correct identifer tested on XCode 15 and the package builds and runs correctly when run using XCode 15.2

bibaswan-bhawal avatar Jan 14 '24 11:01 bibaswan-bhawal

I was having trouble getting the changelog command working throwing

ProcessException: fatal: Not a valid object name upstream\main
  Command: git merge-base upstream\main HEAD

any insight would be helpful, then I can resolve some of the failing checks

See https://github.com/flutter/packages/blob/main/script/tool/README.md#update-changelog-and-version, in particular the last paragraph. If you use a different repo setup than our docs recommend, then you need to modify commands that reference repositories and branches accordingly.

stuartmorgan-g avatar Jan 14 '24 11:01 stuartmorgan-g

but this is known to be a correct identifer tested on XCode 15

Our CI currently uses Xcode 14; updating is still an ongoing project.

stuartmorgan-g avatar Jan 14 '24 11:01 stuartmorgan-g

I guess the PR is blocked until the CI is updated to xcode 15?

bibaswan-bhawal avatar Jan 14 '24 12:01 bibaswan-bhawal

Landing it is blocked on https://github.com/flutter/flutter/issues/132237, but it can be reviewed in the meantime.

stuartmorgan-g avatar Jan 16 '24 17:01 stuartmorgan-g

@bibaswan-bhawal The change makes sense. Does external camera work after this change? (e.g. preview, taking picture/video, etc)

hellohuanlin avatar Jan 16 '24 19:01 hellohuanlin

Yes they do

bibaswan-bhawal avatar Jan 16 '24 19:01 bibaswan-bhawal

@stuartmorgan does your comment from the other PR (https://github.com/flutter/packages/pull/5957#issuecomment-1906818335) also apply to this PR?

hellohuanlin avatar Jan 24 '24 21:01 hellohuanlin

@stuartmorgan does your comment from the other PR (#5957 (comment)) also apply to this PR?

In theory yes; I realized after writing that though that this specific case is probably not something we need to block on. camera_windows already has this problem, and in some cases Android as well (we don't discover external cameras, but on some Android devices apparently external cameras that are plugged in when the device boots are reported as non-external, and thus are discovered). So on some platforms we already have the problem that if someone removes a camera while using a Flutter app, the app probably doesn't have a good way to gracefully handle that. And it's a pretty niche case; I think most people are probably not going to remove cameras they are actively using most of the time.

So I'll file an issue about the need to add API to get notifications about camera availability changes, but I'm okay not blocking this specific change on that.

stuartmorgan-g avatar Jan 25 '24 16:01 stuartmorgan-g

So I'll file an issue about the need to add API to get notifications about camera availability changes

https://github.com/flutter/flutter/issues/142239

stuartmorgan-g avatar Jan 25 '24 17:01 stuartmorgan-g

Fixed all broken tests

bibaswan-bhawal avatar Jan 28 '24 11:01 bibaswan-bhawal

@bibaswan-bhawal Is this ready for re-review?

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

@bibaswan-bhawal Please mark as ready for review when you'd like it to be re-reviewed.

vashworth avatar Apr 03 '24 21:04 vashworth

Since this is marked as a draft and hasn't been updated in several months I'm going to close it to clean out our review queue. Please don't hesitate to submit a new PR if you decide to revisit this. Thanks!

stuartmorgan-g avatar May 14 '24 19:05 stuartmorgan-g