Skip to content

Commit

Permalink
Fixup iOS version error
Browse files Browse the repository at this point in the history
  • Loading branch information
ldalzottomp committed Mar 12, 2024
1 parent c3636fe commit ed494fd
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions package/ios/Core/CameraSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,18 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC
}

// We get the input connections by filtering on the output
let inputConnections = self.captureSession.connections.filter { sessionConnection in
return outputConnections.contains(where: { outputConnection in
return outputConnection != sessionConnection
})
}
let inputConnections: [AVCaptureConnection] = {
if #available(iOS 13.0, *) {
return self.captureSession.connections.filter { sessionConnection in
return outputConnections.contains(where: { outputConnection in
return outputConnection != sessionConnection
})
}
} else {
// TODO: Fallback of iOS < 13. How to get the input connection ?
return []
}
}()

for connection in inputConnections {
if connection.isVideoOrientationSupported {
Expand All @@ -339,6 +346,8 @@ class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegate, AVC
connection.videoOrientation = .portraitUpsideDown
case .unknown:
connection.videoOrientation = .portrait
@unknown default:
connection.videoOrientation = .portrait
}
}
}
Expand Down

0 comments on commit ed494fd

Please sign in to comment.