Skip to content
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

Missing AVCaptureConnection.VideoRotationAngle #21850

Open
dartasen opened this issue Dec 23, 2024 · 3 comments · May be fixed by #21878
Open

Missing AVCaptureConnection.VideoRotationAngle #21850

dartasen opened this issue Dec 23, 2024 · 3 comments · May be fixed by #21878

Comments

@dartasen
Copy link

Apple platform

iOS

Framework version

net9.0-*

Affected platform version

.NET 9.0.101

Description

AVCaptureConnection.VideoOrientation seems to be obsolete on iOS 17+, telling us to use AVCaptureConnection.VideoRotationAngle instead.

image

However it seems that currently AVCaptureConnection.VideoRotationAngle is readonly
image

Steps to Reproduce

n/a

Did you find any workaround?

No response

Relevant log output

https://developer.apple.com/documentation/avfoundation/avcaptureconnection/videorotationangle

var videoRotationAngle: CGFloat { get set }

@rolfbjarne
Copy link
Member

I can confirm this, and a fix is in progress.

Do you need a workaround in the meantime?

@rolfbjarne rolfbjarne added this to the Future milestone Dec 30, 2024
@dartasen
Copy link
Author

@rolfbjarne Awesome, thank's

If there's one available i'll happily take it, otherwise i'll wait for a service release

@rolfbjarne
Copy link
Member

Something like this should work:

using System.Runtime.InteropServices;
using ObjCRuntime;

[DllImport (Constants.ObjectiveCLibrary)]
static extern void objc_msgSend (IntPtr handle, IntPtr selector, nfloat value);

public static void SetOrientationAngle (this AVCaptureConnection connection, nfloat orientationAngle)
{
	objc_msgSend (connection.Handle, Selector.GetHandle ("setVideoRotationAngle:"), orientationAngle);
}

// ...

previewLayer.Connection.SetOrientationAngle (orientationAngle);

rolfbjarne added a commit that referenced this issue Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants