@capgo/camera-preview 8.1.2 → 8.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -976,6 +976,15 @@ extension CameraController {
|
|
|
976
976
|
captureSession.sessionPreset = desiredPreset
|
|
977
977
|
}
|
|
978
978
|
|
|
979
|
+
// Re-attach movie file output so its connection is bound to the new input.
|
|
980
|
+
if let fileVideoOutput = self.fileVideoOutput,
|
|
981
|
+
captureSession.outputs.contains(where: { $0 === fileVideoOutput }) {
|
|
982
|
+
captureSession.removeOutput(fileVideoOutput)
|
|
983
|
+
if captureSession.canAddOutput(fileVideoOutput) {
|
|
984
|
+
captureSession.addOutput(fileVideoOutput)
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
|
|
979
988
|
// Keep orientation correct
|
|
980
989
|
self.updateVideoOrientation()
|
|
981
990
|
}
|
|
@@ -2200,6 +2209,20 @@ extension CameraController {
|
|
|
2200
2209
|
throw CameraControllerError.fileVideoOutputNotFound
|
|
2201
2210
|
}
|
|
2202
2211
|
|
|
2212
|
+
// Ensure audio session is configured for recording before starting a movie,
|
|
2213
|
+
// only when we are actually recording audio (disableAudio was false).
|
|
2214
|
+
// This reclaims the microphone even if other parts of the app changed the
|
|
2215
|
+
// AVAudioSession category (e.g. for UI sound effects) between recordings.
|
|
2216
|
+
if self.audioInput != nil {
|
|
2217
|
+
do {
|
|
2218
|
+
let audioSession = AVAudioSession.sharedInstance()
|
|
2219
|
+
try audioSession.setCategory(.playAndRecord, mode: .videoRecording, options: [.defaultToSpeaker])
|
|
2220
|
+
try audioSession.setActive(true)
|
|
2221
|
+
} catch {
|
|
2222
|
+
print("[CameraPreview] Failed to configure AVAudioSession for video recording: \(error)")
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
|
|
2203
2226
|
// Ensure the movie file output is attached to the active session.
|
|
2204
2227
|
// If the camera was started without cameraMode=true, the output may not have been added yet.
|
|
2205
2228
|
if !captureSession.outputs.contains(where: { $0 === fileVideoOutput }) {
|
|
@@ -2213,12 +2236,17 @@ extension CameraController {
|
|
|
2213
2236
|
captureSession.commitConfiguration()
|
|
2214
2237
|
}
|
|
2215
2238
|
|
|
2216
|
-
// cpcp_video_A6C01203 - portrait
|
|
2217
|
-
//
|
|
2218
2239
|
if let connection = fileVideoOutput.connection(with: .video) {
|
|
2219
2240
|
if connection.isEnabled == false { connection.isEnabled = true }
|
|
2220
2241
|
// Goes off accelerometer now
|
|
2221
2242
|
connection.videoOrientation = self.getPhysicalOrientation()
|
|
2243
|
+
|
|
2244
|
+
// Front camera: mirror the recorded video so it looks natural (selfie style).
|
|
2245
|
+
if self.currentCameraPosition == .front, connection.isVideoMirroringSupported {
|
|
2246
|
+
connection.isVideoMirrored = true
|
|
2247
|
+
} else {
|
|
2248
|
+
connection.isVideoMirrored = false
|
|
2249
|
+
}
|
|
2222
2250
|
}
|
|
2223
2251
|
|
|
2224
2252
|
let identifier = UUID()
|
|
@@ -34,7 +34,7 @@ extension UIWindow {
|
|
|
34
34
|
*/
|
|
35
35
|
@objc(CameraPreview)
|
|
36
36
|
public class CameraPreview: CAPPlugin, CAPBridgedPlugin, CLLocationManagerDelegate {
|
|
37
|
-
private let pluginVersion: String = "8.1.
|
|
37
|
+
private let pluginVersion: String = "8.1.3"
|
|
38
38
|
public let identifier = "CameraPreviewPlugin"
|
|
39
39
|
public let jsName = "CameraPreview"
|
|
40
40
|
public let pluginMethods: [CAPPluginMethod] = [
|