Use AV capture methods available since iOS 7

This commit is contained in:
DominusExult
2026-02-15 17:20:49 +01:00
committed by Sam Lantinga
parent 016a1b87a6
commit 0270da4d1f

View File

@@ -440,13 +440,11 @@ static bool COREMEDIA_OpenDevice(SDL_Camera *device, const SDL_CameraSpec *spec)
}
[session addOutput:output];
// Try to set the frame rate on the connection
AVCaptureConnection *connection = [output connectionWithMediaType:AVMediaTypeVideo];
if (connection && connection.isVideoMinFrameDurationSupported) {
connection.videoMinFrameDuration = frameDuration;
if (connection.isVideoMaxFrameDurationSupported) {
connection.videoMaxFrameDuration = frameDuration;
}
// Try to set the frame rate on the device (preferred modern approach)
if ([avdevice lockForConfiguration:nil]) {
avdevice.activeVideoMinFrameDuration = frameDuration;
avdevice.activeVideoMaxFrameDuration = frameDuration;
[avdevice unlockForConfiguration];
}
[session commitConfiguration];