@capgo/camera-preview 7.4.0-beta.7 → 7.4.0-beta.9

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.
Files changed (41) hide show
  1. package/README.md +63 -29
  2. package/android/.gradle/8.14.2/checksums/checksums.lock +0 -0
  3. package/android/.gradle/8.14.2/checksums/md5-checksums.bin +0 -0
  4. package/android/.gradle/8.14.2/checksums/sha1-checksums.bin +0 -0
  5. package/android/.gradle/8.14.2/executionHistory/executionHistory.bin +0 -0
  6. package/android/.gradle/8.14.2/executionHistory/executionHistory.lock +0 -0
  7. package/android/.gradle/8.14.2/fileHashes/fileHashes.bin +0 -0
  8. package/android/.gradle/8.14.2/fileHashes/fileHashes.lock +0 -0
  9. package/android/.gradle/8.14.2/fileHashes/resourceHashesCache.bin +0 -0
  10. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  11. package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
  12. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  13. package/android/.gradle/file-system.probe +0 -0
  14. package/android/build.gradle +1 -0
  15. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraPreview.java +127 -14
  16. package/android/src/main/java/com/ahm/capacitor/camera/preview/CameraXView.java +529 -29
  17. package/android/src/main/java/com/ahm/capacitor/camera/preview/GridOverlayView.java +2 -0
  18. package/dist/docs.json +46 -7
  19. package/dist/esm/definitions.d.ts +42 -5
  20. package/dist/esm/definitions.js.map +1 -1
  21. package/dist/esm/web.d.ts +25 -1
  22. package/dist/esm/web.js +81 -9
  23. package/dist/esm/web.js.map +1 -1
  24. package/dist/plugin.cjs.js +81 -9
  25. package/dist/plugin.cjs.js.map +1 -1
  26. package/dist/plugin.js +81 -9
  27. package/dist/plugin.js.map +1 -1
  28. package/ios/Sources/CapgoCameraPreview/CameraController.swift +95 -18
  29. package/ios/Sources/CapgoCameraPreview/Plugin.swift +449 -111
  30. package/package.json +1 -1
  31. package/android/.gradle/config.properties +0 -2
  32. package/android/.idea/AndroidProjectSystem.xml +0 -6
  33. package/android/.idea/caches/deviceStreaming.xml +0 -811
  34. package/android/.idea/compiler.xml +0 -6
  35. package/android/.idea/gradle.xml +0 -18
  36. package/android/.idea/migrations.xml +0 -10
  37. package/android/.idea/misc.xml +0 -10
  38. package/android/.idea/runConfigurations.xml +0 -17
  39. package/android/.idea/vcs.xml +0 -6
  40. package/android/.idea/workspace.xml +0 -55
  41. package/android/local.properties +0 -8
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var DeviceType;\n(function (DeviceType) {\n DeviceType[\"ULTRA_WIDE\"] = \"ultraWide\";\n DeviceType[\"WIDE_ANGLE\"] = \"wideAngle\";\n DeviceType[\"TELEPHOTO\"] = \"telephoto\";\n DeviceType[\"TRUE_DEPTH\"] = \"trueDepth\";\n DeviceType[\"DUAL\"] = \"dual\";\n DeviceType[\"DUAL_WIDE\"] = \"dualWide\";\n DeviceType[\"TRIPLE\"] = \"triple\";\n})(DeviceType || (DeviceType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst CameraPreview = registerPlugin(\"CameraPreview\", {\n web: () => import(\"./web\").then((m) => new m.CameraPreviewWeb()),\n});\nexport * from \"./definitions\";\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nimport { DeviceType } from \"./definitions\";\nconst DEFAULT_VIDEO_ID = \"capgo_video\";\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super();\n /**\n * track which camera is used based on start options\n * used in capture\n */\n this.isBackCamera = false;\n this.currentDeviceId = null;\n this.videoElement = null;\n this.isStarted = false;\n }\n async getSupportedPictureSizes() {\n throw new Error(\"getSupportedPictureSizes not supported under the web platform\");\n }\n async start(options) {\n if (this.isStarted) {\n throw new Error(\"camera already started\");\n }\n this.isBackCamera = true;\n this.isStarted = false;\n const parent = document.getElementById((options === null || options === void 0 ? void 0 : options.parent) || \"\");\n const gridMode = (options === null || options === void 0 ? void 0 : options.gridMode) || \"none\";\n if (options.position) {\n this.isBackCamera = options.position === \"rear\";\n }\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (video) {\n video.remove();\n }\n const container = options.parent ? document.getElementById(options.parent) : document.body;\n if (!container) {\n throw new Error(\"container not found\");\n }\n this.videoElement = document.createElement(\"video\");\n this.videoElement.id = DEFAULT_VIDEO_ID;\n this.videoElement.className = options.className || \"\";\n this.videoElement.playsInline = true;\n this.videoElement.muted = true;\n this.videoElement.autoplay = true;\n container.appendChild(this.videoElement);\n if (options.toBack) {\n this.videoElement.style.zIndex = \"-1\";\n }\n if (options.width) {\n this.videoElement.width = options.width;\n }\n if (options.height) {\n this.videoElement.height = options.height;\n }\n if (options.x) {\n this.videoElement.style.left = `${options.x}px`;\n }\n // Create and add grid overlay if needed\n if (gridMode !== \"none\") {\n const gridOverlay = this.createGridOverlay(gridMode);\n gridOverlay.id = \"camera-grid-overlay\";\n parent === null || parent === void 0 ? void 0 : parent.appendChild(gridOverlay);\n }\n if (options.y) {\n this.videoElement.style.top = `${options.y}px`;\n }\n if (options.aspectRatio) {\n const [widthRatio, heightRatio] = options.aspectRatio.split(':').map(Number);\n const ratio = widthRatio / heightRatio;\n if (options.width) {\n this.videoElement.height = options.width / ratio;\n }\n else if (options.height) {\n this.videoElement.width = options.height * ratio;\n }\n }\n else {\n this.videoElement.style.objectFit = 'cover';\n }\n const constraints = {\n video: {\n width: { ideal: this.videoElement.width || 640 },\n height: { ideal: this.videoElement.height || window.innerHeight },\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n },\n };\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n if (!stream) {\n throw new Error(\"could not acquire stream\");\n }\n if (!this.videoElement) {\n throw new Error(\"video element not found\");\n }\n this.videoElement.srcObject = stream;\n if (!this.isBackCamera) {\n this.videoElement.style.transform = \"scaleX(-1)\";\n }\n this.isStarted = true;\n return {\n width: this.videoElement.width,\n height: this.videoElement.height,\n x: this.videoElement.getBoundingClientRect().x,\n y: this.videoElement.getBoundingClientRect().y,\n };\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks)\n track.stop();\n }\n }\n async stop() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n this.isStarted = false;\n }\n // Remove grid overlay if it exists\n const gridOverlay = document.getElementById(\"camera-grid-overlay\");\n gridOverlay === null || gridOverlay === void 0 ? void 0 : gridOverlay.remove();\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject(new Error(\"camera is not running\"));\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context === null || context === void 0 ? void 0 : context.translate(video.videoWidth, 0);\n context === null || context === void 0 ? void 0 : context.scale(-1, 1);\n }\n context === null || context === void 0 ? void 0 : context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if (options.saveToGallery) {\n // saveToGallery is not supported on web\n }\n if (options.withExifLocation) {\n // withExifLocation is not supported on web\n }\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n }\n else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n resolve({\n value: base64EncodedImage,\n exif: {},\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n async startRecordVideo(_options) {\n console.log(\"startRecordVideo\", _options);\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n async getSupportedFlashModes() {\n throw new Error(\"getSupportedFlashModes not supported under the web platform\");\n }\n async getHorizontalFov() {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n async setFlashMode(_options) {\n throw new Error(`setFlashMode not supported under the web platform${_options}`);\n }\n async flip() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n // Stop current stream\n this.stopStream(video.srcObject);\n // Toggle camera position\n this.isBackCamera = !this.isBackCamera;\n // Get new constraints\n const constraints = {\n video: {\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n try {\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n // Update current device ID from the new stream\n const videoTrack = stream.getVideoTracks()[0];\n if (videoTrack) {\n this.currentDeviceId = videoTrack.getSettings().deviceId || null;\n }\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n }\n else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n await video.play();\n }\n catch (error) {\n throw new Error(`Failed to flip camera: ${error}`);\n }\n }\n async setOpacity(_options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!!video && !!_options.opacity)\n video.style.setProperty(\"opacity\", _options.opacity.toString());\n }\n async isRunning() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n return { isRunning: !!video && !!video.srcObject };\n }\n async getAvailableDevices() {\n var _a;\n if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices)) {\n throw new Error(\"getAvailableDevices not supported under the web platform\");\n }\n const devices = await navigator.mediaDevices.enumerateDevices();\n const videoDevices = devices.filter(device => device.kind === 'videoinput');\n // Group devices by position (front/back)\n const frontDevices = [];\n const backDevices = [];\n videoDevices.forEach((device, index) => {\n const label = device.label || `Camera ${index + 1}`;\n const labelLower = label.toLowerCase();\n // Determine device type based on label\n let deviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n if (labelLower.includes('ultra') || labelLower.includes('0.5')) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n }\n else if (labelLower.includes('telephoto') || labelLower.includes('tele') || labelLower.includes('2x') || labelLower.includes('3x')) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n }\n else if (labelLower.includes('depth') || labelLower.includes('truedepth')) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n const lensInfo = {\n deviceId: device.deviceId,\n label,\n deviceType,\n focalLength: 4.25,\n baseZoomRatio,\n minZoom: 1.0,\n maxZoom: 1.0\n };\n // Determine position and add to appropriate array\n if (labelLower.includes('back') || labelLower.includes('rear')) {\n backDevices.push(lensInfo);\n }\n else {\n frontDevices.push(lensInfo);\n }\n });\n const result = [];\n if (frontDevices.length > 0) {\n result.push({\n deviceId: frontDevices[0].deviceId,\n label: \"Front Camera\",\n position: \"front\",\n lenses: frontDevices,\n isLogical: false,\n minZoom: Math.min(...frontDevices.map(d => d.minZoom)),\n maxZoom: Math.max(...frontDevices.map(d => d.maxZoom))\n });\n }\n if (backDevices.length > 0) {\n result.push({\n deviceId: backDevices[0].deviceId,\n label: \"Back Camera\",\n position: \"rear\",\n lenses: backDevices,\n isLogical: false,\n minZoom: Math.min(...backDevices.map(d => d.minZoom)),\n maxZoom: Math.max(...backDevices.map(d => d.maxZoom))\n });\n }\n return { devices: result };\n }\n async getZoom() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n const stream = video.srcObject;\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n const capabilities = videoTrack.getCapabilities();\n const settings = videoTrack.getSettings();\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n // Get current device info to determine lens type\n let deviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n if (this.currentDeviceId) {\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find(d => d.deviceId === this.currentDeviceId);\n if (device) {\n const labelLower = device.label.toLowerCase();\n if (labelLower.includes('ultra') || labelLower.includes('0.5')) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n }\n else if (labelLower.includes('telephoto') || labelLower.includes('tele') || labelLower.includes('2x') || labelLower.includes('3x')) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n }\n else if (labelLower.includes('depth') || labelLower.includes('truedepth')) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n }\n }\n const currentZoom = settings.zoom || 1;\n const lensInfo = {\n focalLength: 4.25,\n deviceType,\n baseZoomRatio,\n digitalZoom: currentZoom / baseZoomRatio\n };\n return {\n min: capabilities.zoom.min || 1,\n max: capabilities.zoom.max || 1,\n current: currentZoom,\n lens: lensInfo,\n };\n }\n async setZoom(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n const stream = video.srcObject;\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n const capabilities = videoTrack.getCapabilities();\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n const zoomLevel = Math.max(capabilities.zoom.min || 1, Math.min(capabilities.zoom.max || 1, options.level));\n try {\n await videoTrack.applyConstraints({\n advanced: [{ zoom: zoomLevel }]\n });\n }\n catch (error) {\n throw new Error(`Failed to set zoom: ${error}`);\n }\n }\n async getFlashMode() {\n throw new Error(\"getFlashMode not supported under the web platform\");\n }\n async getDeviceId() {\n return { deviceId: this.currentDeviceId || \"\" };\n }\n async setDeviceId(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n // Stop current stream\n this.stopStream(video.srcObject);\n // Update current device ID\n this.currentDeviceId = options.deviceId;\n // Get new constraints with specific device ID\n const constraints = {\n video: {\n deviceId: { exact: options.deviceId },\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n try {\n // Try to determine camera position from device\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find(d => d.deviceId === options.deviceId);\n this.isBackCamera = (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes('back')) || (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes('rear')) || false;\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n }\n else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n await video.play();\n }\n catch (error) {\n throw new Error(`Failed to swap to device ${options.deviceId}: ${error}`);\n }\n }\n async getAspectRatio() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n const width = video.offsetWidth;\n const height = video.offsetHeight;\n if (width && height) {\n const ratio = width / height;\n if (Math.abs(ratio - (4 / 3)) < 0.01) {\n return { aspectRatio: '4:3' };\n }\n if (Math.abs(ratio - (16 / 9)) < 0.01) {\n return { aspectRatio: '16:9' };\n }\n }\n // Default to 4:3 if no specific aspect ratio is matched\n return { aspectRatio: '4:3' };\n }\n async setAspectRatio(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n if (options.aspectRatio) {\n const [widthRatio, heightRatio] = options.aspectRatio.split(':').map(Number);\n const ratio = widthRatio / heightRatio;\n const width = video.offsetWidth;\n const height = video.offsetHeight;\n if (width) {\n video.height = width / ratio;\n }\n else if (height) {\n video.width = height * ratio;\n }\n }\n else {\n video.style.objectFit = 'cover';\n }\n }\n createGridOverlay(gridMode) {\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"absolute\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n overlay.style.pointerEvents = \"none\";\n overlay.style.zIndex = \"10\";\n const divisions = gridMode === \"3x3\" ? 3 : 4;\n // Create SVG for grid lines\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.style.width = \"100%\";\n svg.style.height = \"100%\";\n svg.style.position = \"absolute\";\n svg.style.top = \"0\";\n svg.style.left = \"0\";\n // Create grid lines\n for (let i = 1; i < divisions; i++) {\n // Vertical lines\n const verticalLine = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\n verticalLine.setAttribute(\"x1\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y1\", \"0%\");\n verticalLine.setAttribute(\"x2\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y2\", \"100%\");\n verticalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n verticalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(verticalLine);\n // Horizontal lines\n const horizontalLine = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\n horizontalLine.setAttribute(\"x1\", \"0%\");\n horizontalLine.setAttribute(\"y1\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"x2\", \"100%\");\n horizontalLine.setAttribute(\"y2\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n horizontalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(horizontalLine);\n }\n overlay.appendChild(svg);\n return overlay;\n }\n async setGridMode(options) {\n // Web implementation of grid mode would need to be implemented\n // For now, just resolve as a no-op\n console.warn(`Grid mode '${options.gridMode}' is not yet implemented for web platform`);\n }\n async getGridMode() {\n // Web implementation - default to none\n return { gridMode: 'none' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["DeviceType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,UAAU,EAAE;IACvB,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW;IAC1C,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW;IAC1C,IAAI,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;IACzC,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW;IAC1C,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG,MAAM;IAC/B,IAAI,UAAU,CAAC,WAAW,CAAC,GAAG,UAAU;IACxC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACnC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;;ACR9B,UAAC,aAAa,GAAGC,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICDD,MAAM,gBAAgB,GAAG,aAAa;IAC/B,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf;IACA;IACA;IACA;IACA,QAAQ,IAAI,CAAC,YAAY,GAAG,KAAK;IACjC,QAAQ,IAAI,CAAC,eAAe,GAAG,IAAI;IACnC,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI;IAChC,QAAQ,IAAI,CAAC,SAAS,GAAG,KAAK;IAC9B;IACA,IA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CAAC,OAAO,EAAE;IAC/B;IACA;IACA,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,yCAAyC,CAAC,CAAC;IAC/F;IACA,IAAI,MAAM,WAAW,GAAG;IACxB;IACA,QAAQ,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE;IACnC;IACA;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/definitions.js","esm/index.js","esm/web.js"],"sourcesContent":["export var DeviceType;\n(function (DeviceType) {\n DeviceType[\"ULTRA_WIDE\"] = \"ultraWide\";\n DeviceType[\"WIDE_ANGLE\"] = \"wideAngle\";\n DeviceType[\"TELEPHOTO\"] = \"telephoto\";\n DeviceType[\"TRUE_DEPTH\"] = \"trueDepth\";\n DeviceType[\"DUAL\"] = \"dual\";\n DeviceType[\"DUAL_WIDE\"] = \"dualWide\";\n DeviceType[\"TRIPLE\"] = \"triple\";\n})(DeviceType || (DeviceType = {}));\n//# sourceMappingURL=definitions.js.map","import { registerPlugin } from \"@capacitor/core\";\nconst CameraPreview = registerPlugin(\"CameraPreview\", {\n web: () => import(\"./web\").then((m) => new m.CameraPreviewWeb()),\n});\nexport * from \"./definitions\";\nexport { CameraPreview };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from \"@capacitor/core\";\nimport { DeviceType } from \"./definitions\";\nconst DEFAULT_VIDEO_ID = \"capgo_video\";\nexport class CameraPreviewWeb extends WebPlugin {\n constructor() {\n super();\n /**\n * track which camera is used based on start options\n * used in capture\n */\n this.isBackCamera = false;\n this.currentDeviceId = null;\n this.videoElement = null;\n this.isStarted = false;\n }\n async getSupportedPictureSizes() {\n throw new Error(\"getSupportedPictureSizes not supported under the web platform\");\n }\n async start(options) {\n if (options.aspectRatio && (options.width || options.height)) {\n throw new Error(\"Cannot set both aspectRatio and size (width/height). Use setPreviewSize after start.\");\n }\n if (this.isStarted) {\n throw new Error(\"camera already started\");\n }\n this.isBackCamera = true;\n this.isStarted = false;\n const parent = document.getElementById((options === null || options === void 0 ? void 0 : options.parent) || \"\");\n const gridMode = (options === null || options === void 0 ? void 0 : options.gridMode) || \"none\";\n if (options.position) {\n this.isBackCamera = options.position === \"rear\";\n }\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (video) {\n video.remove();\n }\n const container = options.parent ? document.getElementById(options.parent) : document.body;\n if (!container) {\n throw new Error(\"container not found\");\n }\n this.videoElement = document.createElement(\"video\");\n this.videoElement.id = DEFAULT_VIDEO_ID;\n this.videoElement.className = options.className || \"\";\n this.videoElement.playsInline = true;\n this.videoElement.muted = true;\n this.videoElement.autoplay = true;\n container.appendChild(this.videoElement);\n if (options.toBack) {\n this.videoElement.style.zIndex = \"-1\";\n }\n if (options.width) {\n this.videoElement.width = options.width;\n }\n if (options.height) {\n this.videoElement.height = options.height;\n }\n if (options.x) {\n this.videoElement.style.left = `${options.x}px`;\n }\n // Create and add grid overlay if needed\n if (gridMode !== \"none\") {\n const gridOverlay = this.createGridOverlay(gridMode);\n gridOverlay.id = \"camera-grid-overlay\";\n parent === null || parent === void 0 ? void 0 : parent.appendChild(gridOverlay);\n }\n if (options.y) {\n this.videoElement.style.top = `${options.y}px`;\n }\n if (options.aspectRatio) {\n const [widthRatio, heightRatio] = options.aspectRatio.split(':').map(Number);\n const ratio = widthRatio / heightRatio;\n if (options.width) {\n this.videoElement.height = options.width / ratio;\n }\n else if (options.height) {\n this.videoElement.width = options.height * ratio;\n }\n }\n else {\n this.videoElement.style.objectFit = 'cover';\n }\n const constraints = {\n video: {\n width: { ideal: this.videoElement.width || 640 },\n height: { ideal: this.videoElement.height || window.innerHeight },\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n },\n };\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n if (!stream) {\n throw new Error(\"could not acquire stream\");\n }\n if (!this.videoElement) {\n throw new Error(\"video element not found\");\n }\n this.videoElement.srcObject = stream;\n if (!this.isBackCamera) {\n this.videoElement.style.transform = \"scaleX(-1)\";\n }\n this.isStarted = true;\n return {\n width: this.videoElement.width,\n height: this.videoElement.height,\n x: this.videoElement.getBoundingClientRect().x,\n y: this.videoElement.getBoundingClientRect().y,\n };\n }\n stopStream(stream) {\n if (stream) {\n const tracks = stream.getTracks();\n for (const track of tracks)\n track.stop();\n }\n }\n async stop() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (video) {\n video.pause();\n this.stopStream(video.srcObject);\n video.remove();\n this.isStarted = false;\n }\n // Remove grid overlay if it exists\n const gridOverlay = document.getElementById(\"camera-grid-overlay\");\n gridOverlay === null || gridOverlay === void 0 ? void 0 : gridOverlay.remove();\n }\n async capture(options) {\n return new Promise((resolve, reject) => {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n reject(new Error(\"camera is not running\"));\n return;\n }\n // video.width = video.offsetWidth;\n let base64EncodedImage;\n if (video && video.videoWidth > 0 && video.videoHeight > 0) {\n const canvas = document.createElement(\"canvas\");\n const context = canvas.getContext(\"2d\");\n canvas.width = video.videoWidth;\n canvas.height = video.videoHeight;\n // flip horizontally back camera isn't used\n if (!this.isBackCamera) {\n context === null || context === void 0 ? void 0 : context.translate(video.videoWidth, 0);\n context === null || context === void 0 ? void 0 : context.scale(-1, 1);\n }\n context === null || context === void 0 ? void 0 : context.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);\n if (options.saveToGallery) {\n // saveToGallery is not supported on web\n }\n if (options.withExifLocation) {\n // withExifLocation is not supported on web\n }\n if ((options.format || \"jpeg\") === \"jpeg\") {\n base64EncodedImage = canvas\n .toDataURL(\"image/jpeg\", (options.quality || 85) / 100.0)\n .replace(\"data:image/jpeg;base64,\", \"\");\n }\n else {\n base64EncodedImage = canvas\n .toDataURL(\"image/png\")\n .replace(\"data:image/png;base64,\", \"\");\n }\n }\n resolve({\n value: base64EncodedImage,\n exif: {},\n });\n });\n }\n async captureSample(_options) {\n return this.capture(_options);\n }\n async stopRecordVideo() {\n throw new Error(\"stopRecordVideo not supported under the web platform\");\n }\n async startRecordVideo(_options) {\n console.log(\"startRecordVideo\", _options);\n throw new Error(\"startRecordVideo not supported under the web platform\");\n }\n async getSupportedFlashModes() {\n throw new Error(\"getSupportedFlashModes not supported under the web platform\");\n }\n async getHorizontalFov() {\n throw new Error(\"getHorizontalFov not supported under the web platform\");\n }\n async setFlashMode(_options) {\n throw new Error(`setFlashMode not supported under the web platform${_options}`);\n }\n async flip() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n // Stop current stream\n this.stopStream(video.srcObject);\n // Toggle camera position\n this.isBackCamera = !this.isBackCamera;\n // Get new constraints\n const constraints = {\n video: {\n facingMode: this.isBackCamera ? \"environment\" : \"user\",\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n try {\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n // Update current device ID from the new stream\n const videoTrack = stream.getVideoTracks()[0];\n if (videoTrack) {\n this.currentDeviceId = videoTrack.getSettings().deviceId || null;\n }\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n }\n else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n await video.play();\n }\n catch (error) {\n throw new Error(`Failed to flip camera: ${error}`);\n }\n }\n async setOpacity(_options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!!video && !!_options.opacity)\n video.style.setProperty(\"opacity\", _options.opacity.toString());\n }\n async isRunning() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n return { isRunning: !!video && !!video.srcObject };\n }\n async getAvailableDevices() {\n var _a;\n if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.enumerateDevices)) {\n throw new Error(\"getAvailableDevices not supported under the web platform\");\n }\n const devices = await navigator.mediaDevices.enumerateDevices();\n const videoDevices = devices.filter(device => device.kind === 'videoinput');\n // Group devices by position (front/back)\n const frontDevices = [];\n const backDevices = [];\n videoDevices.forEach((device, index) => {\n const label = device.label || `Camera ${index + 1}`;\n const labelLower = label.toLowerCase();\n // Determine device type based on label\n let deviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n if (labelLower.includes('ultra') || labelLower.includes('0.5')) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n }\n else if (labelLower.includes('telephoto') || labelLower.includes('tele') || labelLower.includes('2x') || labelLower.includes('3x')) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n }\n else if (labelLower.includes('depth') || labelLower.includes('truedepth')) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n const lensInfo = {\n deviceId: device.deviceId,\n label,\n deviceType,\n focalLength: 4.25,\n baseZoomRatio,\n minZoom: 1.0,\n maxZoom: 1.0\n };\n // Determine position and add to appropriate array\n if (labelLower.includes('back') || labelLower.includes('rear')) {\n backDevices.push(lensInfo);\n }\n else {\n frontDevices.push(lensInfo);\n }\n });\n const result = [];\n if (frontDevices.length > 0) {\n result.push({\n deviceId: frontDevices[0].deviceId,\n label: \"Front Camera\",\n position: \"front\",\n lenses: frontDevices,\n isLogical: false,\n minZoom: Math.min(...frontDevices.map(d => d.minZoom)),\n maxZoom: Math.max(...frontDevices.map(d => d.maxZoom))\n });\n }\n if (backDevices.length > 0) {\n result.push({\n deviceId: backDevices[0].deviceId,\n label: \"Back Camera\",\n position: \"rear\",\n lenses: backDevices,\n isLogical: false,\n minZoom: Math.min(...backDevices.map(d => d.minZoom)),\n maxZoom: Math.max(...backDevices.map(d => d.maxZoom))\n });\n }\n return { devices: result };\n }\n async getZoom() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n const stream = video.srcObject;\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n const capabilities = videoTrack.getCapabilities();\n const settings = videoTrack.getSettings();\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n // Get current device info to determine lens type\n let deviceType = DeviceType.WIDE_ANGLE;\n let baseZoomRatio = 1.0;\n if (this.currentDeviceId) {\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find(d => d.deviceId === this.currentDeviceId);\n if (device) {\n const labelLower = device.label.toLowerCase();\n if (labelLower.includes('ultra') || labelLower.includes('0.5')) {\n deviceType = DeviceType.ULTRA_WIDE;\n baseZoomRatio = 0.5;\n }\n else if (labelLower.includes('telephoto') || labelLower.includes('tele') || labelLower.includes('2x') || labelLower.includes('3x')) {\n deviceType = DeviceType.TELEPHOTO;\n baseZoomRatio = 2.0;\n }\n else if (labelLower.includes('depth') || labelLower.includes('truedepth')) {\n deviceType = DeviceType.TRUE_DEPTH;\n baseZoomRatio = 1.0;\n }\n }\n }\n const currentZoom = settings.zoom || 1;\n const lensInfo = {\n focalLength: 4.25,\n deviceType,\n baseZoomRatio,\n digitalZoom: currentZoom / baseZoomRatio\n };\n return {\n min: capabilities.zoom.min || 1,\n max: capabilities.zoom.max || 1,\n current: currentZoom,\n lens: lensInfo,\n };\n }\n async setZoom(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n const stream = video.srcObject;\n const videoTrack = stream.getVideoTracks()[0];\n if (!videoTrack) {\n throw new Error(\"no video track found\");\n }\n const capabilities = videoTrack.getCapabilities();\n if (!capabilities.zoom) {\n throw new Error(\"zoom not supported by this device\");\n }\n const zoomLevel = Math.max(capabilities.zoom.min || 1, Math.min(capabilities.zoom.max || 1, options.level));\n try {\n await videoTrack.applyConstraints({\n advanced: [{ zoom: zoomLevel }]\n });\n }\n catch (error) {\n throw new Error(`Failed to set zoom: ${error}`);\n }\n }\n async getFlashMode() {\n throw new Error(\"getFlashMode not supported under the web platform\");\n }\n async getDeviceId() {\n return { deviceId: this.currentDeviceId || \"\" };\n }\n async setDeviceId(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!(video === null || video === void 0 ? void 0 : video.srcObject)) {\n throw new Error(\"camera is not running\");\n }\n // Stop current stream\n this.stopStream(video.srcObject);\n // Update current device ID\n this.currentDeviceId = options.deviceId;\n // Get new constraints with specific device ID\n const constraints = {\n video: {\n deviceId: { exact: options.deviceId },\n width: { ideal: video.videoWidth || 640 },\n height: { ideal: video.videoHeight || 480 },\n },\n };\n try {\n // Try to determine camera position from device\n const devices = await navigator.mediaDevices.enumerateDevices();\n const device = devices.find(d => d.deviceId === options.deviceId);\n this.isBackCamera = (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes('back')) || (device === null || device === void 0 ? void 0 : device.label.toLowerCase().includes('rear')) || false;\n const stream = await navigator.mediaDevices.getUserMedia(constraints);\n video.srcObject = stream;\n // Update video transform based on camera\n if (this.isBackCamera) {\n video.style.transform = \"none\";\n video.style.webkitTransform = \"none\";\n }\n else {\n video.style.transform = \"scaleX(-1)\";\n video.style.webkitTransform = \"scaleX(-1)\";\n }\n await video.play();\n }\n catch (error) {\n throw new Error(`Failed to swap to device ${options.deviceId}: ${error}`);\n }\n }\n async getAspectRatio() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n const width = video.offsetWidth;\n const height = video.offsetHeight;\n if (width && height) {\n const ratio = width / height;\n // Check for portrait camera ratios: 4:3 -> 3:4, 16:9 -> 9:16\n if (Math.abs(ratio - (3 / 4)) < 0.01) {\n return { aspectRatio: '4:3' };\n }\n if (Math.abs(ratio - (9 / 16)) < 0.01) {\n return { aspectRatio: '16:9' };\n }\n }\n // Default to 4:3 if no specific aspect ratio is matched\n return { aspectRatio: '4:3' };\n }\n async setAspectRatio(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n if (options.aspectRatio) {\n const [widthRatio, heightRatio] = options.aspectRatio.split(':').map(Number);\n // For camera, use portrait orientation: 4:3 becomes 3:4, 16:9 becomes 9:16\n const ratio = heightRatio / widthRatio;\n // Get current position and size\n const rect = video.getBoundingClientRect();\n const currentWidth = rect.width;\n const currentHeight = rect.height;\n const currentRatio = currentWidth / currentHeight;\n let newWidth;\n let newHeight;\n if (currentRatio > ratio) {\n // Width is larger, fit by height and center horizontally\n newWidth = currentHeight * ratio;\n newHeight = currentHeight;\n }\n else {\n // Height is larger, fit by width and center vertically\n newWidth = currentWidth;\n newHeight = currentWidth / ratio;\n }\n // Calculate position\n let x, y;\n if (options.x !== undefined && options.y !== undefined) {\n // Use provided coordinates, ensuring they stay within screen boundaries\n x = Math.max(0, Math.min(options.x, window.innerWidth - newWidth));\n y = Math.max(0, Math.min(options.y, window.innerHeight - newHeight));\n }\n else {\n // Auto-center the view\n x = (window.innerWidth - newWidth) / 2;\n y = (window.innerHeight - newHeight) / 2;\n }\n video.style.width = `${newWidth}px`;\n video.style.height = `${newHeight}px`;\n video.style.left = `${x}px`;\n video.style.top = `${y}px`;\n video.style.position = 'absolute';\n return {\n width: Math.round(newWidth),\n height: Math.round(newHeight),\n x: Math.round(x),\n y: Math.round(y)\n };\n }\n else {\n video.style.objectFit = 'cover';\n const rect = video.getBoundingClientRect();\n return {\n width: Math.round(rect.width),\n height: Math.round(rect.height),\n x: Math.round(rect.left),\n y: Math.round(rect.top)\n };\n }\n }\n createGridOverlay(gridMode) {\n const overlay = document.createElement(\"div\");\n overlay.style.position = \"absolute\";\n overlay.style.top = \"0\";\n overlay.style.left = \"0\";\n overlay.style.width = \"100%\";\n overlay.style.height = \"100%\";\n overlay.style.pointerEvents = \"none\";\n overlay.style.zIndex = \"10\";\n const divisions = gridMode === \"3x3\" ? 3 : 4;\n // Create SVG for grid lines\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.style.width = \"100%\";\n svg.style.height = \"100%\";\n svg.style.position = \"absolute\";\n svg.style.top = \"0\";\n svg.style.left = \"0\";\n // Create grid lines\n for (let i = 1; i < divisions; i++) {\n // Vertical lines\n const verticalLine = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\n verticalLine.setAttribute(\"x1\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y1\", \"0%\");\n verticalLine.setAttribute(\"x2\", `${(i / divisions) * 100}%`);\n verticalLine.setAttribute(\"y2\", \"100%\");\n verticalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n verticalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(verticalLine);\n // Horizontal lines\n const horizontalLine = document.createElementNS(\"http://www.w3.org/2000/svg\", \"line\");\n horizontalLine.setAttribute(\"x1\", \"0%\");\n horizontalLine.setAttribute(\"y1\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"x2\", \"100%\");\n horizontalLine.setAttribute(\"y2\", `${(i / divisions) * 100}%`);\n horizontalLine.setAttribute(\"stroke\", \"rgba(255, 255, 255, 0.5)\");\n horizontalLine.setAttribute(\"stroke-width\", \"1\");\n svg.appendChild(horizontalLine);\n }\n overlay.appendChild(svg);\n return overlay;\n }\n async setGridMode(options) {\n // Web implementation of grid mode would need to be implemented\n // For now, just resolve as a no-op\n console.warn(`Grid mode '${options.gridMode}' is not yet implemented for web platform`);\n }\n async getGridMode() {\n // Web implementation - default to none\n return { gridMode: 'none' };\n }\n async getPreviewSize() {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n return {\n x: video.offsetLeft,\n y: video.offsetTop,\n width: video.width,\n height: video.height\n };\n }\n async setPreviewSize(options) {\n const video = document.getElementById(DEFAULT_VIDEO_ID);\n if (!video) {\n throw new Error(\"camera is not running\");\n }\n video.style.left = `${options.x}px`;\n video.style.top = `${options.y}px`;\n video.width = options.width;\n video.height = options.height;\n return {\n width: options.width,\n height: options.height,\n x: options.x,\n y: options.y\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["DeviceType","registerPlugin","WebPlugin"],"mappings":";;;AAAWA;IACX,CAAC,UAAU,UAAU,EAAE;IACvB,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW;IAC1C,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW;IAC1C,IAAI,UAAU,CAAC,WAAW,CAAC,GAAG,WAAW;IACzC,IAAI,UAAU,CAAC,YAAY,CAAC,GAAG,WAAW;IAC1C,IAAI,UAAU,CAAC,MAAM,CAAC,GAAG,MAAM;IAC/B,IAAI,UAAU,CAAC,WAAW,CAAC,GAAG,UAAU;IACxC,IAAI,UAAU,CAAC,QAAQ,CAAC,GAAG,QAAQ;IACnC,CAAC,EAAEA,kBAAU,KAAKA,kBAAU,GAAG,EAAE,CAAC,CAAC;;ACR9B,UAAC,aAAa,GAAGC,mBAAc,CAAC,eAAe,EAAE;IACtD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,gBAAgB,EAAE,CAAC;IACpE,CAAC;;ICDD,MAAM,gBAAgB,GAAG,aAAa;IAC/B,MAAM,gBAAgB,SAASC,cAAS,CAAC;IAChD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,EAAE;IACf;IACA;IACA;IACA;IACA,QAAQ,IAAI,CAAC,YAAY,GAAG,KAAK;IACjC,QAAQ,IAAI,CAAC,eAAe,GAAG,IAAI;IACnC,QAAQ,IAAI,CAAC,YAAY,GAAG,IAAI;IAChC,QAAQ,IAAI,CAAC,SAAS,GAAG,KAAK;IAC9B;IACA,IAAI,MAAM,wBAAwB,GAAG;IACrC,QAAQ,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC;IACxF;IACA,IAAI,MAAM,KAAK,CAAC,OAAO,EA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AK,EAAE,KAAK,CAAC,KAAK;IAC9B,YAAY,MAAM,EAAE,KAAK,CAAC;IAC1B,SAAS;IACT;IACA,IAAI,MAAM,cAAc,CAAC,OAAO,EAAE;IAClC,QAAQ,MAAM,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,gBAAgB,CAAC;IAC/D,QAAQ,IAAI,CAAC,KAAK,EAAE;IACpB,YAAY,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC;IACpD;IACA,QAAQ,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3C,QAAQ,KAAK,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;IAC1C,QAAQ,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK;IACnC,QAAQ,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM;IACrC,QAAQ,OAAO;IACf,YAAY,KAAK,EAAE,OAAO,CAAC,KAAK;IAChC,YAAY,MAAM,EAAE,OAAO,CAAC,MAAM;IAClC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS;IACT;IACA;;;;;;;;;;;;;;;"}
@@ -54,12 +54,59 @@ class CameraController: NSObject {
54
54
  }
55
55
 
56
56
  extension CameraController {
57
+ func prepareBasicSession() {
58
+ // Only prepare if we don't already have a session
59
+ guard self.captureSession == nil else { return }
60
+
61
+ print("[CameraPreview] Preparing basic camera session in background")
62
+
63
+ // Create basic capture session
64
+ self.captureSession = AVCaptureSession()
65
+
66
+ // Configure basic devices without full preparation
67
+ let deviceTypes: [AVCaptureDevice.DeviceType] = [
68
+ .builtInWideAngleCamera,
69
+ .builtInUltraWideCamera,
70
+ .builtInTelephotoCamera,
71
+ .builtInDualCamera,
72
+ .builtInDualWideCamera,
73
+ .builtInTripleCamera,
74
+ .builtInTrueDepthCamera
75
+ ]
76
+
77
+ let session = AVCaptureDevice.DiscoverySession(deviceTypes: deviceTypes, mediaType: AVMediaType.video, position: .unspecified)
78
+ let cameras = session.devices.compactMap { $0 }
79
+
80
+ // Find best cameras
81
+ let rearVirtualDevices = cameras.filter { $0.position == .back && $0.isVirtualDevice }
82
+ let bestRearVirtualDevice = rearVirtualDevices.max { $0.constituentDevices.count < $1.constituentDevices.count }
83
+
84
+ self.frontCamera = cameras.first(where: { $0.position == .front })
85
+
86
+ if let bestCamera = bestRearVirtualDevice {
87
+ self.rearCamera = bestCamera
88
+ } else if let firstRearCamera = cameras.first(where: { $0.position == .back }) {
89
+ self.rearCamera = firstRearCamera
90
+ }
91
+
92
+ print("[CameraPreview] Basic session prepared with \(cameras.count) devices")
93
+ }
94
+
57
95
  func prepare(cameraPosition: String, deviceId: String? = nil, disableAudio: Bool, cameraMode: Bool, aspectRatio: String? = nil, completionHandler: @escaping (Error?) -> Void) {
58
96
  func createCaptureSession() {
59
- self.captureSession = AVCaptureSession()
97
+ // Use existing session if available from background preparation
98
+ if self.captureSession == nil {
99
+ self.captureSession = AVCaptureSession()
100
+ }
60
101
  }
61
102
 
62
103
  func configureCaptureDevices() throws {
104
+ // Skip device discovery if cameras are already found during background preparation
105
+ if self.frontCamera != nil || self.rearCamera != nil {
106
+ print("[CameraPreview] Using pre-discovered cameras")
107
+ return
108
+ }
109
+
63
110
  // Expanded device types to support more camera configurations
64
111
  let deviceTypes: [AVCaptureDevice.DeviceType] = [
65
112
  .builtInWideAngleCamera,
@@ -207,14 +254,17 @@ extension CameraController {
207
254
  func configurePhotoOutput(cameraMode: Bool) throws {
208
255
  guard let captureSession = self.captureSession else { throw CameraControllerError.captureSessionIsMissing }
209
256
 
210
- // Configure session preset based on aspect ratio and other settings
211
- var targetPreset: AVCaptureSession.Preset = .photo // Default preset
257
+ // Configure session preset for high-quality preview
258
+ // Prioritize higher quality presets for better preview resolution
259
+ var targetPreset: AVCaptureSession.Preset = .high // Default to high quality
212
260
 
213
261
  if let aspectRatio = aspectRatio {
214
262
  switch aspectRatio {
215
263
  case "16:9":
216
- // Use HD presets for 16:9 aspect ratio
217
- if self.highResolutionOutput && captureSession.canSetSessionPreset(.hd1920x1080) {
264
+ // Use highest available HD preset for 16:9 aspect ratio
265
+ if captureSession.canSetSessionPreset(.hd4K3840x2160) {
266
+ targetPreset = .hd4K3840x2160
267
+ } else if captureSession.canSetSessionPreset(.hd1920x1080) {
218
268
  targetPreset = .hd1920x1080
219
269
  } else if captureSession.canSetSessionPreset(.hd1280x720) {
220
270
  targetPreset = .hd1280x720
@@ -222,26 +272,32 @@ extension CameraController {
222
272
  targetPreset = .high
223
273
  }
224
274
  case "4:3":
225
- // Use photo preset for 4:3 aspect ratio (traditional photo format)
226
- if self.highResolutionOutput && captureSession.canSetSessionPreset(.photo) {
275
+ // Use photo preset for 4:3 aspect ratio (highest quality)
276
+ if captureSession.canSetSessionPreset(.photo) {
227
277
  targetPreset = .photo
278
+ } else if captureSession.canSetSessionPreset(.high) {
279
+ targetPreset = .high
228
280
  } else {
229
281
  targetPreset = .medium
230
282
  }
231
283
  default:
232
- // Default behavior for unrecognized aspect ratios
233
- if !cameraMode && self.highResolutionOutput && captureSession.canSetSessionPreset(.photo) {
284
+ // Default to highest available quality
285
+ if captureSession.canSetSessionPreset(.photo) {
234
286
  targetPreset = .photo
235
- } else if cameraMode && self.highResolutionOutput && captureSession.canSetSessionPreset(.high) {
287
+ } else if captureSession.canSetSessionPreset(.high) {
236
288
  targetPreset = .high
289
+ } else {
290
+ targetPreset = .medium
237
291
  }
238
292
  }
239
293
  } else {
240
- // Original logic when no aspect ratio is specified
241
- if !cameraMode && self.highResolutionOutput && captureSession.canSetSessionPreset(.photo) {
294
+ // Default to highest available quality when no aspect ratio specified
295
+ if captureSession.canSetSessionPreset(.photo) {
242
296
  targetPreset = .photo
243
- } else if cameraMode && self.highResolutionOutput && captureSession.canSetSessionPreset(.high) {
297
+ } else if captureSession.canSetSessionPreset(.high) {
244
298
  targetPreset = .high
299
+ } else {
300
+ targetPreset = .medium
245
301
  }
246
302
  }
247
303
 
@@ -250,9 +306,11 @@ extension CameraController {
250
306
  captureSession.sessionPreset = targetPreset
251
307
  print("[CameraPreview] Set session preset to \(targetPreset) for aspect ratio: \(aspectRatio ?? "default")")
252
308
  } else {
253
- // Fallback to a basic preset if the target preset is not supported
254
- print("[CameraPreview] Target preset \(targetPreset) not supported, falling back to .medium")
255
- if captureSession.canSetSessionPreset(.medium) {
309
+ // Fallback to high quality preset if the target preset is not supported
310
+ print("[CameraPreview] Target preset \(targetPreset) not supported, falling back to .high")
311
+ if captureSession.canSetSessionPreset(.high) {
312
+ captureSession.sessionPreset = .high
313
+ } else if captureSession.canSetSessionPreset(.medium) {
256
314
  captureSession.sessionPreset = .medium
257
315
  }
258
316
  }
@@ -318,10 +376,25 @@ extension CameraController {
318
376
  self.previewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
319
377
  self.previewLayer?.videoGravity = AVLayerVideoGravity.resizeAspectFill
320
378
 
379
+ // Optimize preview layer for better quality
380
+ self.previewLayer?.connection?.videoOrientation = .portrait
381
+ self.previewLayer?.isOpaque = true
382
+
383
+ // Enable high-quality rendering
384
+ if #available(iOS 13.0, *) {
385
+ self.previewLayer?.videoGravity = .resizeAspectFill
386
+ }
387
+
321
388
  view.layer.insertSublayer(self.previewLayer!, at: 0)
322
- self.previewLayer?.frame = view.frame
389
+
390
+ // Disable animation for frame update
391
+ CATransaction.begin()
392
+ CATransaction.setDisableActions(true)
393
+ self.previewLayer?.frame = view.bounds
394
+ CATransaction.commit()
323
395
 
324
- print("[CameraPreview] Set preview layer frame to: \(view.frame)")
396
+ print("[CameraPreview] Set preview layer frame to view bounds: \(view.bounds)")
397
+ print("[CameraPreview] Session preset: \(captureSession.sessionPreset.rawValue)")
325
398
 
326
399
  updateVideoOrientation()
327
400
  }
@@ -329,9 +402,13 @@ extension CameraController {
329
402
  func addGridOverlay(to view: UIView, gridMode: String) {
330
403
  removeGridOverlay()
331
404
 
405
+ // Disable animation for grid overlay creation and positioning
406
+ CATransaction.begin()
407
+ CATransaction.setDisableActions(true)
332
408
  gridOverlayView = GridOverlayView(frame: view.bounds)
333
409
  gridOverlayView?.gridMode = gridMode
334
410
  view.addSubview(gridOverlayView!)
411
+ CATransaction.commit()
335
412
  }
336
413
 
337
414
  func removeGridOverlay() {