-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
feat: Dynamically determine sensorOrientation
based on default output-connection-orientation
#3046
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Something interesting I found out is that the new iOS 17 API
The reason why this is a problem is because with So right now I removed those new APIs, since they won't work with our case. I keep using |
…ut-connection-orientation
9873e58
to
3a77305
Compare
…ut-connection-orientation (mrousavy#3046) * feat: Dynamically determine `sensorOrientation` based on default output-connection-orientation * Update AVCaptureDevice+sensorOrientation.swift * fix: Don't use mirroring * fix: Throw error if `isMirrored` or `orientation` is not connected * Update AVCaptureDevice+sensorOrientation.swift * fix: Only flip/mirror if `sensorOrientation` is portrait, not `outputOrientation` * Mirror sensor if front * fix: Only flip on landscape orientations * fix: Fix selfie mirroring * chore: Format * fix: Don't use `videoRotationAngle` APIs as I compute it wrong * fix: Normalize degrees and properly calculate Orientation * chore: Extract `CMAccelerometerData+deviceOrientation` * fix: Fix styling * Update Orientation.swift
What
Previously, we just assumed a default sensor orientation of
landscapeLeft
on iOS.While this worked on my iPhone 15 Pro and was also posted as a safe-to-assume default value in Apple Developer Forums, it is apparently not safe to assume that this is the default value. 🤦
On my iPhone 8, the preview was rotated by 90deg.
So instead, this PR now attempts to dynamically get the sensor orientation value by creating a dummy capture session, adding an output to it, and getting it's default orientation value.
This then needs to be rotated by 90deg (I don't know why), and then we have a default orientation value for all phones - I think.
I'd need to test this on iPads and other iPhones first though
Changes
Tested on
Related issues