Martin Zikmund
Martin Zikmund

Reputation: 39082

Implementing AVCapturePhotoCaptureDelegate in Xamarin.iOS

I have tried to implement the AVCapturePhotoCaptureDelegate in Xamarin.iOS targeting iOS 11 but I have failed to find a working example yet.

Most examples implement the deprecated methods with buffers, but currently the only supported method is:

void DidFinishProcessingPhoto(AVCapturePhotoOutput output,
                    AVCapturePhoto photo, Foundation.NSError error);

I have found a few updated tutorials for iOS 11, but they usually suggest to use a AVCapturePhoto.fileDataRepresentation method, but that does not seem to be available in Xamarin for some reason.

Could you please point me in a direction of how to retrieve JPEG and RAW data from AVCapturePhoto in Xamarin?

Update

I have checked the Apple documentation for AVCapturePhoto and it seems the Xamarin.iOS class is missing many other members like bracketSettings, but only the imageRepresentation related methods are actually not available in code.

I would be very grateful for an explanation of the reason for this, because without the data representation methods there doesn't seem to be any convenient way to retrieve a UIImage from AVCapturePhoto apart from using the deprecated delegate methods.

Upvotes: 2

Views: 574

Answers (1)

SushiHangover
SushiHangover

Reputation: 74144

It is an open bug/issue scheduled for the Xcode 9.3 support/milestone:

re: https://github.com/xamarin/xamarin-macios/blob/4da8016db4330bde0a09b4a5453a26427ca6685d/tests/xtro-sharpie/iOS-AVFoundation.ignore

!missing-selector! +AVCapturePhotoBracketSettings::photoBracketSettingsWithRawPixelFormatType:rawFileType:processedFormat:processedFileType:bracketedSettings: not bound
!missing-selector! AVCapturePhoto::fileDataRepresentationWithReplacementMetadata:replacementEmbeddedThumbnailPhotoFormat:replacementEmbeddedThumbnailPixelBuffer:replacementDepthData: not bound
!missing-selector! AVCapturePhotoOutput::availableLivePhotoVideoCodecTypes not bound
!missing-selector! AVCapturePhotoOutput::isCameraCalibrationDataDeliverySupported not bound
!missing-selector! AVCapturePhotoOutput::isDualCameraDualPhotoDeliveryEnabled not bound
!missing-selector! AVCapturePhotoOutput::isDualCameraDualPhotoDeliverySupported not bound
!missing-selector! AVCapturePhotoOutput::setDualCameraDualPhotoDeliveryEnabled: not bound
!missing-selector! AVCaptureResolvedPhotoSettings::embeddedThumbnailDimensions not bound
!missing-selector! AVCaptureResolvedPhotoSettings::expectedPhotoCount not bound

Upvotes: 1

Related Questions