diff --git a/src/pages/devicesSearch/camera.vue b/src/pages/devicesSearch/camera.vue index 8c2f834..88e89b5 100644 --- a/src/pages/devicesSearch/camera.vue +++ b/src/pages/devicesSearch/camera.vue @@ -135,14 +135,7 @@ export default { // 启动相机预览 startCamera() { - if (typeof window.CameraPreview === 'undefined') { - uni.showToast({ - title: '相机插件未安装', - icon: 'none' - }); - return; - } - + document.addEventListener('deviceready', () => { window.CameraPreview.startCamera( this.cameraPreviewOptions, () => { @@ -156,7 +149,8 @@ export default { icon: 'none' }); } - ); + ) + }) }, // 停止相机预览 diff --git a/src/pages/devicesSearch/ocrSearch.nvue b/src/pages/devicesSearch/ocrSearch.nvue index 853af9f..3c3438e 100644 --- a/src/pages/devicesSearch/ocrSearch.nvue +++ b/src/pages/devicesSearch/ocrSearch.nvue @@ -1,79 +1,118 @@ @@ -83,6 +122,10 @@ export default { data() { return { + showCamera: false, + isTaking: false, + isProcessing: false, + cameraStarted: false, queryParams: {}, queryCodeParams: { maCode: "", @@ -101,104 +144,337 @@ export default { onUnload() { // 移除事件监听 uni.$off('ocrResult', this.handleOcrResult); + // 确保相机被停止 + this.stopCamera(); }, methods: { - // 打开自定义相机页面 - openCustomCamera() { - uni.navigateTo({ - url: '/pages/devicesSearch/camera' + // 检查相机权限 + async checkCameraPermission() { + return new Promise((resolve, reject) => { + // 在 App 端检查相机权限 + // #ifdef APP-PLUS + plus.android.requestPermissions( + ['android.permission.CAMERA'], + (result) => { + if (result.granted && result.granted.length > 0) { + resolve(true); + } else { + reject(new Error('相机权限被拒绝')); + } + }, + (error) => { + reject(new Error('权限检查失败')); + } + ); + // #endif + + // #ifndef APP-PLUS + resolve(true); // 其他平台默认有权限 + // #endif }); }, - // 处理OCR识别结果 - handleOcrResult(result) { - if (result.success && result.result) { - this.queryCodeParams.maCode = result.result; + // 打开相机 + async openCamera() { + try { + // 检查权限 + await this.checkCameraPermission(); + + // 显示相机界面 + this.showCamera = true; + + // 等待DOM更新后初始化相机 + await this.$nextTick(); + await this.initCamera(); + } catch (error) { + console.error('打开相机失败:', error); uni.showToast({ - title: '识别成功', - icon: 'success' + title: error.message || '相机启动失败', + icon: 'none' + }); + this.showCamera = false; + } + }, + + // 初始化相机 + async initCamera() { + return new Promise((resolve, reject) => { + // 检查插件是否可用 + if (!window.CameraPreview) { + reject(new Error('相机插件未加载')); + return; + } + + const options = { + x: 0, + y: 0, + width: window.innerWidth || 375, + height: window.innerHeight || 667, + camera: 'rear', // 后置摄像头 + tapPhoto: false, + previewDrag: false, + toBack: true, // 将预览放到背景 + alpha: 1, + colorEffect: 'none' + }; + + window.CameraPreview.startCamera( + options, + () => { + console.log('相机启动成功'); + this.cameraStarted = true; + resolve(); + }, + (error) => { + console.error('相机启动失败:', error); + reject(new Error('相机启动失败: ' + error)); + } + ); + }); + }, + + // 关闭相机 + async closeCamera() { + try { + await this.stopCamera(); + } catch (error) { + console.error('关闭相机出错:', error); + } finally { + this.showCamera = false; + this.cameraStarted = false; + } + }, + + // 停止相机 + async stopCamera() { + if (!this.cameraStarted || !window.CameraPreview) { + return Promise.resolve(); + } + + return new Promise((resolve) => { + window.CameraPreview.stopCamera( + () => { + console.log('相机已停止'); + this.cameraStarted = false; + resolve(); + }, + (error) => { + console.error('停止相机失败:', error); + this.cameraStarted = false; + resolve(); // 即使失败也继续 + } + ); + }); + }, + + // 拍照 + async takePicture() { + if (!this.cameraStarted || this.isTaking) { + return; + } + + this.isTaking = true; + + try { + const imageData = await new Promise((resolve, reject) => { + const options = { + quality: 85, + targetHeight: 1920, + targetWidth: 1080 + }; + + window.CameraPreview.takePicture( + options, + (imageData) => { + resolve(imageData); + }, + (error) => { + reject(new Error('拍照失败: ' + error)); + } + ); }); - // 自动执行编码检索 - this.$nextTick(() => { - this.getCode(); - }); - } else { + await this.processImage(imageData); + } catch (error) { + console.error('拍照失败:', error); uni.showToast({ - title: '识别失败', + title: error.message || '拍照失败', + icon: 'none' + }); + } finally { + this.isTaking = false; + } + }, + + // 处理图片 + async processImage(imageData) { + this.isProcessing = true; + + try { + const response = await new Promise((resolve, reject) => { + uni.request({ + url: '/material/app/ocr/getOcrCode', + method: 'POST', + data: { + image: imageData, + jiju_type: '', + auth_lic: 'xIWDlaDVdijcBB4mjhGCPYk5Kvk8tHZJbUn+vW+ih15+MYx98e/PXyBmKL5gFcWMPznLgDA15QuSAnZQSLddwdy9HkZgtuQDEEZZ351Eyb1eiDUccUnyoSGIrNimbx5TooBNNPYqU4qJeFrPJXAqjBHzRrxoBxuR2CEGKQPgHC4=' + }, + timeout: 30000, // 30秒超时 + success: resolve, + fail: reject + }); + }); + + if (response.data?.data?.result) { + this.queryCodeParams.maCode = response.data.data.result; + await this.closeCamera(); + this.getCode(); + uni.showToast({ + title: '识别成功', + icon: 'success' + }); + } else { + uni.showToast({ + title: '未识别到有效编码', + icon: 'none' + }); + } + } catch (error) { + console.error('OCR识别失败:', error); + uni.showToast({ + title: '识别失败,请重试', + icon: 'none' + }); + } finally { + this.isProcessing = false; + } + }, + + // 打开相册 + openGallery() { + uni.chooseImage({ + count: 1, + sourceType: ['album'], + success: (res) => { + if (res.tempFilePaths && res.tempFilePaths.length > 0) { + // 将本地图片转换为base64 + this.convertImageToBase64(res.tempFilePaths[0]); + } + }, + fail: (error) => { + console.error('选择图片失败:', error); + uni.showToast({ + title: '选择图片失败', + icon: 'none' + }); + } + }); + }, + + // 将图片转换为base64 + convertImageToBase64(filePath) { + // #ifdef APP-PLUS + plus.io.resolveLocalFileSystemURL(filePath, (entry) => { + entry.file((file) => { + const reader = new plus.io.FileReader(); + reader.onloadend = (e) => { + this.processImage(e.target.result); + }; + reader.readAsDataURL(file); + }); + }); + // #endif + + // #ifndef APP-PLUS + // 其他平台可以直接使用文件路径 + this.processImage(filePath); + // #endif + }, + + // 编码检索 + async getCode() { + if (!this.queryCodeParams.maCode.trim()) { + uni.showToast({ + title: '请输入设备编码', + icon: 'none' + }); + return; + } + + try { + const response = await new Promise((resolve, reject) => { + uni.request({ + url: '/material/ma_machine/getHisByCode', + method: 'GET', + data: {maCode: this.queryCodeParams.maCode}, + success: resolve, + fail: reject + }); + }); + + if (response.data?.data && response.data.data.length > 0) { + this.optionList = response.data.data.map(option => ({ + value: option.maId, + text: option.maCode + })); + + if (response.data.data.length === 1) { + this.codeData = response.data.data[0]; + } + } else { + uni.showToast({ + title: '未查询到该编号信息', + icon: 'none' + }); + } + } catch (error) { + console.error('查询失败:', error); + uni.showToast({ + title: '查询失败,请重试', icon: 'none' }); } }, - // 编码检索 - async getCode() { - let param = { - maCode: this.queryCodeParams.maCode, - } - uni.request({ - url: '/material/ma_machine/getHisByCode', - method: 'get', - data: param, - success: response => { - response = response.data; - if (response.data && response.data.length !== 0) { - this.optionList = response.data.map(option => ({ - value: option.maId, - text: option.maCode - })) - if (response.data.length === 1) { - this.codeData = response.data[0] - } - } else { - uni.showToast({ - title: '未查询到该编号信息', - icon: 'none', - duration: 2000 - }) - } - }, - fail: err => { - console.log(err) - } - }) - }, - - changeTag() { - if (!this.queryCodeParams.maId) return + // 标签改变 + async changeTag() { + if (!this.queryCodeParams.maId) return; try { - let param = { - maId: this.queryCodeParams.maId, + const response = await new Promise((resolve, reject) => { + uni.request({ + url: '/material/ma_machine/getHisByCode', + method: 'GET', + data: {maId: this.queryCodeParams.maId}, + success: resolve, + fail: reject + }); + }); + + if (response.data?.data && response.data.data.length > 0) { + this.codeData = response.data.data[0]; + } else { + uni.showToast({ + title: '获取编号信息失败', + icon: 'none' + }); } - uni.request({ - url: '/material/ma_machine/getHisByCode', - method: 'get', - data: param, - success: response => { - response = response.data; - if (response.data && response.data.length !== 0) { - this.codeData = response.data[0] - } else { - uni.showToast({ - title: '获取编号信息失败', - icon: 'none', - duration: 2000 - }) - } - }, - fail: err => { - console.log(err) - } - }) } catch (error) { - console.error("获取编号信息失败", error) + console.error("获取编号信息失败", error); uni.showToast({ title: '获取信息失败', - icon: 'none', - duration: 2000 - }) + icon: 'none' + }); + } + }, + + // 处理OCR结果 + handleOcrResult(result) { + if (result && result.code) { + this.queryCodeParams.maCode = result.code; + this.getCode(); } } } @@ -222,64 +498,6 @@ export default { margin-bottom: 24rpx; } -.table-list-item :deep(.uni-forms) { - .uni-forms-item { - margin-bottom: 24rpx; - padding: 0; - } - - .uni-forms-item:last-child { - margin-bottom: 0; - } - - .uni-forms-item__label { - color: #8c8c8c; - font-size: 28rpx; - font-weight: 500; - padding: 0; - line-height: 1.8; - } - - .uni-forms-item__content { - display: flex; - align-items: center; - min-height: unset; - } -} - -.table-list-item :deep(.uni-row) { - .uni-col-6 { - color: #8c8c8c; - font-size: 28rpx; - font-weight: 500; - } - - .cont { - color: #262626; - font-size: 28rpx; - font-weight: 500; - line-height: 1.8; - } -} - -.table-list-item :deep(.uni-easyinput__content) { - background-color: #f7f8fa; - border: 2rpx solid #e8e8e8; - border-radius: 12rpx; - height: 75rpx; - transition: all 0.3s ease; -} - -.table-list-item :deep(.uni-easyinput__content:focus-within) { - border-color: #3784fb; - box-shadow: 0 0 0 2rpx rgba(55, 132, 251, 0.1); -} - -.table-list-item :deep(.uni-easyinput__content-input) { - font-size: 28rpx; - color: #262626; -} - .scan-btn { height: 88rpx; background: #4b8eff; @@ -290,29 +508,207 @@ export default { font-size: 32rpx; font-weight: 600; box-shadow: 0 6rpx 20rpx rgba(55, 132, 251, 0.2); - margin: 0; - padding: 0; } .coding-btn { - background: #fff; - color: #ff9800; - border: 2rpx solid rgba(255, 152, 0, 0.5); - background: linear-gradient(to bottom, rgba(255, 152, 0, 0.05), rgba(255, 152, 0, 0.1)); + padding: 10rpx 0; + color: #fe9a09; + background-color: #fff7eb; + border: 1px solid #fe9a09; border-radius: 12rpx; text-align: center; font-size: 28rpx; font-weight: 600; - letter-spacing: 1rpx; } -.select-container { - margin-top: 24rpx; +/* 相机预览样式 */ +.camera-container { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-color: #000; + z-index: 9999; } -.data-select { - background-color: #f7f8fa; - border: 2rpx solid #e8e8e8; - border-radius: 12rpx; +.top-tip { + position: absolute; + top: 80rpx; + left: 50%; + transform: translateX(-50%); + z-index: 10; + width: 100%; + text-align: center; +} + +.tip-text { + background-color: rgba(0, 0, 0, 0.7); + color: #fff; + font-size: 32rpx; + font-weight: bold; + padding: 20rpx 30rpx; + border-radius: 10rpx; +} + +.viewfinder-container { + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + z-index: 10; +} + +.viewfinder { + position: relative; + width: 500rpx; + height: 600rpx; + border: 4rpx solid rgba(255, 255, 255, 0.5); + border-radius: 20rpx; +} + +.corner { + position: absolute; + width: 60rpx; + height: 60rpx; + border: 6rpx solid #4b8eff; +} + +.corner-top-left { + top: -6rpx; + left: -6rpx; + border-right: none; + border-bottom: none; + border-top-left-radius: 20rpx; +} + +.corner-top-right { + top: -6rpx; + right: -6rpx; + border-left: none; + border-bottom: none; + border-top-right-radius: 20rpx; +} + +.corner-bottom-left { + bottom: -6rpx; + left: -6rpx; + border-right: none; + border-top: none; + border-bottom-left-radius: 20rpx; +} + +.corner-bottom-right { + bottom: -6rpx; + right: -6rpx; + border-left: none; + border-top: none; + border-bottom-right-radius: 20rpx; +} + +.bottom-controls { + position: absolute; + bottom: 100rpx; + left: 0; + right: 0; + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + padding: 0 100rpx; + z-index: 10; +} + +.control-btn { + width: 100rpx; + height: 100rpx; + background-color: rgba(255, 255, 255, 0.2); + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + border: 2rpx solid rgba(255, 255, 255, 0.3); +} + +.control-icon { + color: #fff; + font-size: 40rpx; + font-weight: bold; +} + +.photo-btn { + width: 140rpx; + height: 140rpx; + background-color: rgba(255, 255, 255, 0.2); + border-radius: 50%; + display: flex; + justify-content: center; + align-items: center; + border: 6rpx solid #fff; + transition: all 0.2s ease; +} + +.photo-btn.taking { + transform: scale(0.9); + background-color: rgba(75, 142, 255, 0.8); +} + +.photo-btn-inner { + width: 100rpx; + height: 100rpx; + background-color: #fff; + border-radius: 50%; + transition: all 0.2s ease; +} + +.photo-btn.taking .photo-btn-inner { + background-color: #4b8eff; +} + +.loading-overlay { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.7); + display: flex; + justify-content: center; + align-items: center; + z-index: 20; +} + +.loading-content { + display: flex; + flex-direction: column; + align-items: center; + background-color: rgba(255, 255, 255, 0.9); + padding: 60rpx; + border-radius: 20rpx; +} + +.loading-spinner { + width: 60rpx; + height: 60rpx; + border: 6rpx solid #f3f3f3; + border-top: 6rpx solid #4b8eff; + border-radius: 50%; + animation: spin 1s linear infinite; + margin-bottom: 30rpx; +} + +@keyframes spin { + 0% { + transform: rotate(0deg); + } + 100% { + transform: rotate(360deg); + } +} + +.loading-text { + color: #333; + font-size: 32rpx; + font-weight: bold; } diff --git a/src/static/cordova/cordova_plugins.js b/src/static/cordova/cordova_plugins.js index dc9ebab..4fe3042 100644 --- a/src/static/cordova/cordova_plugins.js +++ b/src/static/cordova/cordova_plugins.js @@ -1,415 +1,323 @@ -cordova.define('cordova/plugin_list', function(require, exports, module) { +cordova.define("cordova/plugin_list", function (require, exports, module) { module.exports = [ { - "id": "cordova-plugin-battery-status.battery", - "file": "plugins/cordova-plugin-battery-status/www/battery.js", - "pluginId": "cordova-plugin-battery-status", - "clobbers": [ - "navigator.battery" - ] + id: "cordova-plugin-battery-status.battery", + file: "plugins/cordova-plugin-battery-status/www/battery.js", + pluginId: "cordova-plugin-battery-status", + clobbers: ["navigator.battery"], }, { - "id": "cordova-plugin-camera.Camera", - "file": "plugins/cordova-plugin-camera/www/CameraConstants.js", - "pluginId": "cordova-plugin-camera", - "clobbers": [ - "Camera" - ] + id: "cordova-plugin-camera.Camera", + file: "plugins/cordova-plugin-camera/www/CameraConstants.js", + pluginId: "cordova-plugin-camera", + clobbers: ["Camera"], }, { - "id": "cordova-plugin-camera.CameraPopoverOptions", - "file": "plugins/cordova-plugin-camera/www/CameraPopoverOptions.js", - "pluginId": "cordova-plugin-camera", - "clobbers": [ - "CameraPopoverOptions" - ] + id: "cordova-plugin-camera.CameraPopoverOptions", + file: "plugins/cordova-plugin-camera/www/CameraPopoverOptions.js", + pluginId: "cordova-plugin-camera", + clobbers: ["CameraPopoverOptions"], }, { - "id": "cordova-plugin-camera.camera", - "file": "plugins/cordova-plugin-camera/www/Camera.js", - "pluginId": "cordova-plugin-camera", - "clobbers": [ - "navigator.camera" - ] + id: "cordova-plugin-camera.camera", + file: "plugins/cordova-plugin-camera/www/Camera.js", + pluginId: "cordova-plugin-camera", + clobbers: ["navigator.camera"], }, { - "id": "cordova-plugin-camera.CameraPopoverHandle", - "file": "plugins/cordova-plugin-camera/www/ios/CameraPopoverHandle.js", - "pluginId": "cordova-plugin-camera", - "clobbers": [ - "CameraPopoverHandle" - ] + id: "cordova-plugin-camera.CameraPopoverHandle", + file: "plugins/cordova-plugin-camera/www/ios/CameraPopoverHandle.js", + pluginId: "cordova-plugin-camera", + clobbers: ["CameraPopoverHandle"], }, { - "id": "cordova-plugin-device.device", - "file": "plugins/cordova-plugin-device/www/device.js", - "pluginId": "cordova-plugin-device", - "clobbers": [ - "device" - ] + id: "cordova-plugin-device.device", + file: "plugins/cordova-plugin-device/www/device.js", + pluginId: "cordova-plugin-device", + clobbers: ["device"], }, { - "id": "cordova-plugin-dialogs.notification", - "file": "plugins/cordova-plugin-dialogs/www/notification.js", - "pluginId": "cordova-plugin-dialogs", - "merges": [ - "navigator.notification" - ] + id: "cordova-plugin-dialogs.notification", + file: "plugins/cordova-plugin-dialogs/www/notification.js", + pluginId: "cordova-plugin-dialogs", + merges: ["navigator.notification"], }, { - "id": "cordova-plugin-file.DirectoryEntry", - "file": "plugins/cordova-plugin-file/www/DirectoryEntry.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.DirectoryEntry" - ] + id: "cordova-plugin-file.DirectoryEntry", + file: "plugins/cordova-plugin-file/www/DirectoryEntry.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.DirectoryEntry"], }, { - "id": "cordova-plugin-file.DirectoryReader", - "file": "plugins/cordova-plugin-file/www/DirectoryReader.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.DirectoryReader" - ] + id: "cordova-plugin-file.DirectoryReader", + file: "plugins/cordova-plugin-file/www/DirectoryReader.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.DirectoryReader"], }, { - "id": "cordova-plugin-file.Entry", - "file": "plugins/cordova-plugin-file/www/Entry.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.Entry" - ] + id: "cordova-plugin-file.Entry", + file: "plugins/cordova-plugin-file/www/Entry.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.Entry"], }, { - "id": "cordova-plugin-file.File", - "file": "plugins/cordova-plugin-file/www/File.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.File" - ] + id: "cordova-plugin-file.File", + file: "plugins/cordova-plugin-file/www/File.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.File"], }, { - "id": "cordova-plugin-file.FileEntry", - "file": "plugins/cordova-plugin-file/www/FileEntry.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileEntry" - ] + id: "cordova-plugin-file.FileEntry", + file: "plugins/cordova-plugin-file/www/FileEntry.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileEntry"], }, { - "id": "cordova-plugin-file.FileError", - "file": "plugins/cordova-plugin-file/www/FileError.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileError" - ] + id: "cordova-plugin-file.FileError", + file: "plugins/cordova-plugin-file/www/FileError.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileError"], }, { - "id": "cordova-plugin-file.FileReader", - "file": "plugins/cordova-plugin-file/www/FileReader.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileReader" - ] + id: "cordova-plugin-file.FileReader", + file: "plugins/cordova-plugin-file/www/FileReader.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileReader"], }, { - "id": "cordova-plugin-file.FileSystem", - "file": "plugins/cordova-plugin-file/www/FileSystem.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileSystem" - ] + id: "cordova-plugin-file.FileSystem", + file: "plugins/cordova-plugin-file/www/FileSystem.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileSystem"], }, { - "id": "cordova-plugin-file.FileUploadOptions", - "file": "plugins/cordova-plugin-file/www/FileUploadOptions.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileUploadOptions" - ] + id: "cordova-plugin-file.FileUploadOptions", + file: "plugins/cordova-plugin-file/www/FileUploadOptions.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileUploadOptions"], }, { - "id": "cordova-plugin-file.FileUploadResult", - "file": "plugins/cordova-plugin-file/www/FileUploadResult.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileUploadResult" - ] + id: "cordova-plugin-file.FileUploadResult", + file: "plugins/cordova-plugin-file/www/FileUploadResult.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileUploadResult"], }, { - "id": "cordova-plugin-file.FileWriter", - "file": "plugins/cordova-plugin-file/www/FileWriter.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.FileWriter" - ] + id: "cordova-plugin-file.FileWriter", + file: "plugins/cordova-plugin-file/www/FileWriter.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.FileWriter"], }, { - "id": "cordova-plugin-file.Flags", - "file": "plugins/cordova-plugin-file/www/Flags.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.Flags" - ] + id: "cordova-plugin-file.Flags", + file: "plugins/cordova-plugin-file/www/Flags.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.Flags"], }, { - "id": "cordova-plugin-file.LocalFileSystem", - "file": "plugins/cordova-plugin-file/www/LocalFileSystem.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.LocalFileSystem" - ], - "merges": [ - "window" - ] + id: "cordova-plugin-file.LocalFileSystem", + file: "plugins/cordova-plugin-file/www/LocalFileSystem.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.LocalFileSystem"], + merges: ["window"], }, { - "id": "cordova-plugin-file.Metadata", - "file": "plugins/cordova-plugin-file/www/Metadata.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.Metadata" - ] + id: "cordova-plugin-file.Metadata", + file: "plugins/cordova-plugin-file/www/Metadata.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.Metadata"], }, { - "id": "cordova-plugin-file.ProgressEvent", - "file": "plugins/cordova-plugin-file/www/ProgressEvent.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.ProgressEvent" - ] + id: "cordova-plugin-file.ProgressEvent", + file: "plugins/cordova-plugin-file/www/ProgressEvent.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.ProgressEvent"], }, { - "id": "cordova-plugin-file.fileSystems", - "file": "plugins/cordova-plugin-file/www/fileSystems.js", - "pluginId": "cordova-plugin-file" + id: "cordova-plugin-file.fileSystems", + file: "plugins/cordova-plugin-file/www/fileSystems.js", + pluginId: "cordova-plugin-file", }, { - "id": "cordova-plugin-file.requestFileSystem", - "file": "plugins/cordova-plugin-file/www/requestFileSystem.js", - "pluginId": "cordova-plugin-file", - "clobbers": [ - "window.requestFileSystem" - ] + id: "cordova-plugin-file.requestFileSystem", + file: "plugins/cordova-plugin-file/www/requestFileSystem.js", + pluginId: "cordova-plugin-file", + clobbers: ["window.requestFileSystem"], }, { - "id": "cordova-plugin-file.resolveLocalFileSystemURI", - "file": "plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js", - "pluginId": "cordova-plugin-file", - "merges": [ - "window" - ] + id: "cordova-plugin-file.resolveLocalFileSystemURI", + file: "plugins/cordova-plugin-file/www/resolveLocalFileSystemURI.js", + pluginId: "cordova-plugin-file", + merges: ["window"], }, { - "id": "cordova-plugin-file.isChrome", - "file": "plugins/cordova-plugin-file/www/browser/isChrome.js", - "pluginId": "cordova-plugin-file", - "runs": true + id: "cordova-plugin-file.isChrome", + file: "plugins/cordova-plugin-file/www/browser/isChrome.js", + pluginId: "cordova-plugin-file", + runs: true, }, { - "id": "cordova-plugin-file.iosFileSystem", - "file": "plugins/cordova-plugin-file/www/ios/FileSystem.js", - "pluginId": "cordova-plugin-file", - "merges": [ - "FileSystem" - ] + id: "cordova-plugin-file.iosFileSystem", + file: "plugins/cordova-plugin-file/www/ios/FileSystem.js", + pluginId: "cordova-plugin-file", + merges: ["FileSystem"], }, { - "id": "cordova-plugin-file.fileSystems-roots", - "file": "plugins/cordova-plugin-file/www/fileSystems-roots.js", - "pluginId": "cordova-plugin-file", - "runs": true + id: "cordova-plugin-file.fileSystems-roots", + file: "plugins/cordova-plugin-file/www/fileSystems-roots.js", + pluginId: "cordova-plugin-file", + runs: true, }, { - "id": "cordova-plugin-file.fileSystemPaths", - "file": "plugins/cordova-plugin-file/www/fileSystemPaths.js", - "pluginId": "cordova-plugin-file", - "merges": [ - "cordova" - ], - "runs": true + id: "cordova-plugin-file.fileSystemPaths", + file: "plugins/cordova-plugin-file/www/fileSystemPaths.js", + pluginId: "cordova-plugin-file", + merges: ["cordova"], + runs: true, }, { - "id": "cordova-plugin-geolocation.Coordinates", - "file": "plugins/cordova-plugin-geolocation/www/Coordinates.js", - "pluginId": "cordova-plugin-geolocation", - "clobbers": [ - "Coordinates" - ] + id: "cordova-plugin-geolocation.Coordinates", + file: "plugins/cordova-plugin-geolocation/www/Coordinates.js", + pluginId: "cordova-plugin-geolocation", + clobbers: ["Coordinates"], }, { - "id": "cordova-plugin-geolocation.PositionError", - "file": "plugins/cordova-plugin-geolocation/www/PositionError.js", - "pluginId": "cordova-plugin-geolocation", - "clobbers": [ - "PositionError" - ] + id: "cordova-plugin-geolocation.PositionError", + file: "plugins/cordova-plugin-geolocation/www/PositionError.js", + pluginId: "cordova-plugin-geolocation", + clobbers: ["PositionError"], }, { - "id": "cordova-plugin-geolocation.Position", - "file": "plugins/cordova-plugin-geolocation/www/Position.js", - "pluginId": "cordova-plugin-geolocation", - "clobbers": [ - "Position" - ] + id: "cordova-plugin-geolocation.Position", + file: "plugins/cordova-plugin-geolocation/www/Position.js", + pluginId: "cordova-plugin-geolocation", + clobbers: ["Position"], }, { - "id": "cordova-plugin-geolocation.geolocation", - "file": "plugins/cordova-plugin-geolocation/www/geolocation.js", - "pluginId": "cordova-plugin-geolocation", - "clobbers": [ - "navigator.geolocation" - ] + id: "cordova-plugin-geolocation.geolocation", + file: "plugins/cordova-plugin-geolocation/www/geolocation.js", + pluginId: "cordova-plugin-geolocation", + clobbers: ["navigator.geolocation"], }, { - "id": "cordova-plugin-inappbrowser.inappbrowser", - "file": "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", - "pluginId": "cordova-plugin-inappbrowser", - "clobbers": [ - "cordova.InAppBrowser.open" - ] + id: "cordova-plugin-inappbrowser.inappbrowser", + file: "plugins/cordova-plugin-inappbrowser/www/inappbrowser.js", + pluginId: "cordova-plugin-inappbrowser", + clobbers: ["cordova.InAppBrowser.open"], }, { - "id": "cordova-plugin-media.MediaError", - "file": "plugins/cordova-plugin-media/www/MediaError.js", - "pluginId": "cordova-plugin-media", - "clobbers": [ - "window.MediaError" - ] + id: "cordova-plugin-media.MediaError", + file: "plugins/cordova-plugin-media/www/MediaError.js", + pluginId: "cordova-plugin-media", + clobbers: ["window.MediaError"], }, { - "id": "cordova-plugin-media.Media", - "file": "plugins/cordova-plugin-media/www/Media.js", - "pluginId": "cordova-plugin-media", - "clobbers": [ - "window.Media" - ] + id: "cordova-plugin-media.Media", + file: "plugins/cordova-plugin-media/www/Media.js", + pluginId: "cordova-plugin-media", + clobbers: ["window.Media"], }, { - "id": "cordova-plugin-media-capture.CaptureAudioOptions", - "file": "plugins/cordova-plugin-media-capture/www/CaptureAudioOptions.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "CaptureAudioOptions" - ] + id: "cordova-plugin-media-capture.CaptureAudioOptions", + file: "plugins/cordova-plugin-media-capture/www/CaptureAudioOptions.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["CaptureAudioOptions"], }, { - "id": "cordova-plugin-media-capture.CaptureImageOptions", - "file": "plugins/cordova-plugin-media-capture/www/CaptureImageOptions.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "CaptureImageOptions" - ] + id: "cordova-plugin-media-capture.CaptureImageOptions", + file: "plugins/cordova-plugin-media-capture/www/CaptureImageOptions.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["CaptureImageOptions"], }, { - "id": "cordova-plugin-media-capture.CaptureVideoOptions", - "file": "plugins/cordova-plugin-media-capture/www/CaptureVideoOptions.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "CaptureVideoOptions" - ] + id: "cordova-plugin-media-capture.CaptureVideoOptions", + file: "plugins/cordova-plugin-media-capture/www/CaptureVideoOptions.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["CaptureVideoOptions"], }, { - "id": "cordova-plugin-media-capture.CaptureError", - "file": "plugins/cordova-plugin-media-capture/www/CaptureError.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "CaptureError" - ] + id: "cordova-plugin-media-capture.CaptureError", + file: "plugins/cordova-plugin-media-capture/www/CaptureError.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["CaptureError"], }, { - "id": "cordova-plugin-media-capture.MediaFileData", - "file": "plugins/cordova-plugin-media-capture/www/MediaFileData.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "MediaFileData" - ] + id: "cordova-plugin-media-capture.MediaFileData", + file: "plugins/cordova-plugin-media-capture/www/MediaFileData.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["MediaFileData"], }, { - "id": "cordova-plugin-media-capture.MediaFile", - "file": "plugins/cordova-plugin-media-capture/www/MediaFile.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "MediaFile" - ] + id: "cordova-plugin-media-capture.MediaFile", + file: "plugins/cordova-plugin-media-capture/www/MediaFile.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["MediaFile"], }, { - "id": "cordova-plugin-media-capture.helpers", - "file": "plugins/cordova-plugin-media-capture/www/helpers.js", - "pluginId": "cordova-plugin-media-capture", - "runs": true + id: "cordova-plugin-media-capture.helpers", + file: "plugins/cordova-plugin-media-capture/www/helpers.js", + pluginId: "cordova-plugin-media-capture", + runs: true, }, { - "id": "cordova-plugin-media-capture.capture", - "file": "plugins/cordova-plugin-media-capture/www/capture.js", - "pluginId": "cordova-plugin-media-capture", - "clobbers": [ - "navigator.device.capture" - ] + id: "cordova-plugin-media-capture.capture", + file: "plugins/cordova-plugin-media-capture/www/capture.js", + pluginId: "cordova-plugin-media-capture", + clobbers: ["navigator.device.capture"], }, { - "id": "cordova-plugin-network-information.network", - "file": "plugins/cordova-plugin-network-information/www/network.js", - "pluginId": "cordova-plugin-network-information", - "clobbers": [ - "navigator.connection" - ] + id: "cordova-plugin-network-information.network", + file: "plugins/cordova-plugin-network-information/www/network.js", + pluginId: "cordova-plugin-network-information", + clobbers: ["navigator.connection"], }, { - "id": "cordova-plugin-network-information.Connection", - "file": "plugins/cordova-plugin-network-information/www/Connection.js", - "pluginId": "cordova-plugin-network-information", - "clobbers": [ - "Connection" - ] + id: "cordova-plugin-network-information.Connection", + file: "plugins/cordova-plugin-network-information/www/Connection.js", + pluginId: "cordova-plugin-network-information", + clobbers: ["Connection"], }, { - "id": "cordova-plugin-screen-orientation.screenorientation", - "file": "plugins/cordova-plugin-screen-orientation/www/screenorientation.js", - "pluginId": "cordova-plugin-screen-orientation", - "clobbers": [ - "cordova.plugins.screenorientation" - ] + id: "cordova-plugin-screen-orientation.screenorientation", + file: "plugins/cordova-plugin-screen-orientation/www/screenorientation.js", + pluginId: "cordova-plugin-screen-orientation", + clobbers: ["cordova.plugins.screenorientation"], }, { - "id": "cordova-plugin-statusbar.statusbar", - "file": "plugins/cordova-plugin-statusbar/www/statusbar.js", - "pluginId": "cordova-plugin-statusbar", - "clobbers": [ - "window.StatusBar" - ] + id: "cordova-plugin-statusbar.statusbar", + file: "plugins/cordova-plugin-statusbar/www/statusbar.js", + pluginId: "cordova-plugin-statusbar", + clobbers: ["window.StatusBar"], }, { - "id": "cordova-plugin-vibration.notification", - "file": "plugins/cordova-plugin-vibration/www/vibration.js", - "pluginId": "cordova-plugin-vibration", - "merges": [ - "navigator" - ] + id: "cordova-plugin-vibration.notification", + file: "plugins/cordova-plugin-vibration/www/vibration.js", + pluginId: "cordova-plugin-vibration", + merges: ["navigator"], }, { - "id": "cordova-plugin-security.security", - "file": "plugins/cordova-plugin-security/www/Security.js", - "pluginId": "cordova-plugin-security", - "merges": [ - "navigator.security" - ] + id: "cordova-plugin-security.security", + file: "plugins/cordova-plugin-security/www/Security.js", + pluginId: "cordova-plugin-security", + merges: ["navigator.security"], }, { - "id": "phonegap-plugin-barcodescanner.BarcodeScanner", - "file": "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js", - "pluginId": "phonegap-plugin-barcodescanner", - "clobbers": [ - "cordova.plugins.barcodeScanner" - ] + id: "phonegap-plugin-barcodescanner.BarcodeScanner", + file: "plugins/phonegap-plugin-barcodescanner/www/barcodescanner.js", + pluginId: "phonegap-plugin-barcodescanner", + clobbers: ["cordova.plugins.barcodeScanner"], }, { - "id": "cordova-plugin-zxing.Zxing", - "file": "plugins/cordova-plugin-zxing/www/scan.js", - "pluginId": "cordova-plugin-zxing", - "clobbers": [ - "cordova.plugins.zxingScan" - ] + id: "cordova-plugin-zxing.Zxing", + file: "plugins/cordova-plugin-zxing/www/scan.js", + pluginId: "cordova-plugin-zxing", + clobbers: ["cordova.plugins.zxingScan"], + }, + { + id: "cordova-plugin-camera-preview.CameraPreview", + file: "plugins/cordova-plugin-camera-preview/www/CameraPreview.js", + pluginId: "cordova-plugin-camera-preview", + clobbers: ["CameraPreview"], }, ]; module.exports.metadata = { @@ -429,6 +337,7 @@ cordova.define('cordova/plugin_list', function(require, exports, module) { "cordova-plugin-vibration": "3.1.1", "cordova-plugin-security": "1.0.0", "cordova.plugins.zxingScan": "1.0.0", - "phonegap-plugin-barcodescanner": "8.1.0" + "phonegap-plugin-barcodescanner": "8.1.0", + "cordova-plugin-camera-preview": "0.14.0", }; }); diff --git a/src/static/cordova/plugins/cordova-plugin-camera-preview/www/CameraPreview.js b/src/static/cordova/plugins/cordova-plugin-camera-preview/www/CameraPreview.js new file mode 100644 index 0000000..294c37c --- /dev/null +++ b/src/static/cordova/plugins/cordova-plugin-camera-preview/www/CameraPreview.js @@ -0,0 +1,339 @@ +cordova.define("cordova-plugin-camera-preview.CameraPreview", function(require, exports, module) { +var argscheck = require('cordova/argscheck'), + utils = require('cordova/utils'), + exec = require('cordova/exec'); + +var PLUGIN_NAME = "CameraPreview"; + +var CameraPreview = function() {}; + +function isFunction(obj) { + return !!(obj && obj.constructor && obj.call && obj.apply); +}; + +CameraPreview.startCamera = function(options, onSuccess, onError) { + if (!options) { + options = {}; + } else if (isFunction(options)) { + onSuccess = options; + options = {}; + } + + options.x = options.x || 0; + options.y = options.y || 0; + + options.width = options.width || window.screen.width; + options.height = options.height || window.screen.height; + + options.camera = options.camera || CameraPreview.CAMERA_DIRECTION.FRONT; + + if (typeof(options.tapPhoto) === 'undefined') { + options.tapPhoto = true; + } + + if (typeof (options.tapFocus) == 'undefined') { + options.tapFocus = false; + } + + options.previewDrag = options.previewDrag || false; + + options.toBack = options.toBack || false; + + if (typeof(options.alpha) === 'undefined') { + options.alpha = 1; + } + + options.disableExifHeaderStripping = options.disableExifHeaderStripping || false; + + options.storeToFile = options.storeToFile || false; + + exec(onSuccess, onError, PLUGIN_NAME, "startCamera", [ + options.x, + options.y, + options.width, + options.height, + options.camera, + options.tapPhoto, + options.previewDrag, + options.toBack, + options.alpha, + options.tapFocus, + options.disableExifHeaderStripping, + options.storeToFile + ]); +}; + +CameraPreview.stopCamera = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "stopCamera", []); +}; + +CameraPreview.switchCamera = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "switchCamera", []); +}; + +CameraPreview.hide = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "hideCamera", []); +}; + +CameraPreview.show = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "showCamera", []); +}; + +CameraPreview.takeSnapshot = function(opts, onSuccess, onError) { + if (!opts) { + opts = {}; + } else if (isFunction(opts)) { + onSuccess = opts; + opts = {}; + } + + if (!isFunction(onSuccess)) { + return false; + } + + if (!opts.quality || opts.quality > 100 || opts.quality < 0) { + opts.quality = 85; + } + + exec(onSuccess, onError, PLUGIN_NAME, "takeSnapshot", [opts.quality]); +}; + +CameraPreview.takePicture = function(opts, onSuccess, onError) { + if (!opts) { + opts = {}; + } else if (isFunction(opts)) { + onSuccess = opts; + opts = {}; + } + + if (!isFunction(onSuccess)) { + return false; + } + + opts.width = opts.width || 0; + opts.height = opts.height || 0; + + if (!opts.quality || opts.quality > 100 || opts.quality < 0) { + opts.quality = 85; + } + + exec(onSuccess, onError, PLUGIN_NAME, "takePicture", [opts.width, opts.height, opts.quality]); +}; + +CameraPreview.setColorEffect = function(effect, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setColorEffect", [effect]); +}; + +CameraPreview.setZoom = function(zoom, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setZoom", [zoom]); +}; + +CameraPreview.getMaxZoom = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getMaxZoom", []); +}; + +CameraPreview.getZoom = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getZoom", []); +}; + +CameraPreview.getHorizontalFOV = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getHorizontalFOV", []); +}; + +CameraPreview.setPreviewSize = function(dimensions, onSuccess, onError) { + dimensions = dimensions || {}; + dimensions.width = dimensions.width || window.screen.width; + dimensions.height = dimensions.height || window.screen.height; + + exec(onSuccess, onError, PLUGIN_NAME, "setPreviewSize", [dimensions.width, dimensions.height]); +}; + +CameraPreview.getSupportedPictureSizes = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getSupportedPictureSizes", []); +}; + +CameraPreview.getSupportedFlashModes = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getSupportedFlashModes", []); +}; + +CameraPreview.getSupportedColorEffects = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getSupportedColorEffects", []); +}; + +CameraPreview.setFlashMode = function(flashMode, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setFlashMode", [flashMode]); +}; + +CameraPreview.getFlashMode = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getFlashMode", []); +}; + +CameraPreview.getSupportedFocusModes = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getSupportedFocusModes", []); +}; + +CameraPreview.getFocusMode = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getFocusMode", []); +}; + +CameraPreview.setFocusMode = function(focusMode, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setFocusMode", [focusMode]); +}; + +CameraPreview.tapToFocus = function(xPoint, yPoint, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "tapToFocus", [xPoint, yPoint]); +}; + +CameraPreview.getExposureModes = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getExposureModes", []); +}; + +CameraPreview.getExposureMode = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getExposureMode", []); +}; + +CameraPreview.setExposureMode = function(exposureMode, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setExposureMode", [exposureMode]); +}; + +CameraPreview.getExposureCompensation = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getExposureCompensation", []); +}; + +CameraPreview.setExposureCompensation = function(exposureCompensation, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setExposureCompensation", [exposureCompensation]); +}; + +CameraPreview.getExposureCompensationRange = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getExposureCompensationRange", []); +}; + +CameraPreview.getSupportedWhiteBalanceModes = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getSupportedWhiteBalanceModes", []); +}; + +CameraPreview.getWhiteBalanceMode = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getWhiteBalanceMode", []); +}; + +CameraPreview.setWhiteBalanceMode = function(whiteBalanceMode, onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "setWhiteBalanceMode", [whiteBalanceMode]); +}; + +CameraPreview.getCameraCharacteristics = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "getCameraCharacteristics", []); +}; + +CameraPreview.onBackButton = function(onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "onBackButton"); +}; + +CameraPreview.getBlob = function (url, onSuccess, onError) { + var xhr = new XMLHttpRequest + xhr.onload = function() { + if (xhr.status != 0 && (xhr.status < 200 || xhr.status >= 300)) { + if (isFunction(onError)) { + onError('Local request failed'); + } + return; + } + var blob = new Blob([xhr.response], {type: "image/jpeg"}); + if (isFunction(onSuccess)) { + onSuccess(blob); + } + }; + xhr.onerror = function() { + if (isFunction(onError)) { + onError('Local request failed'); + } + }; + xhr.open('GET', url); + xhr.responseType = 'arraybuffer'; + xhr.send(null); +}; + +CameraPreview.startRecordVideo = function (opts, onSuccess, onError) { + if (!opts) { + opts = {}; + } else if (isFunction(opts)) { + onSuccess = opts; + opts = {}; + } + + if (!isFunction(onSuccess)) { + return false; + } + + opts.width = opts.width || 0; + opts.height = opts.height || 0; + + if (!opts.quality || opts.quality > 100 || opts.quality < 0) { + opts.quality = 85; + } + + exec(onSuccess, onError, PLUGIN_NAME, "startRecordVideo", [opts.cameraDirection, opts.width, opts.height, opts.quality, opts.withFlash]); +}; + +CameraPreview.stopRecordVideo = function (onSuccess, onError) { + exec(onSuccess, onError, PLUGIN_NAME, "stopRecordVideo"); +}; + +CameraPreview.FOCUS_MODE = { + FIXED: 'fixed', + AUTO: 'auto', + CONTINUOUS: 'continuous', // IOS Only + CONTINUOUS_PICTURE: 'continuous-picture', // Android Only + CONTINUOUS_VIDEO: 'continuous-video', // Android Only + EDOF: 'edof', // Android Only + INFINITY: 'infinity', // Android Only + MACRO: 'macro' // Android Only +}; + +CameraPreview.EXPOSURE_MODE = { + LOCK: 'lock', + AUTO: 'auto', // IOS Only + CONTINUOUS: 'continuous', // IOS Only + CUSTOM: 'custom' // IOS Only +}; + +CameraPreview.WHITE_BALANCE_MODE = { + LOCK: 'lock', + AUTO: 'auto', + CONTINUOUS: 'continuous', + INCANDESCENT: 'incandescent', + CLOUDY_DAYLIGHT: 'cloudy-daylight', + DAYLIGHT: 'daylight', + FLUORESCENT: 'fluorescent', + SHADE: 'shade', + TWILIGHT: 'twilight', + WARM_FLUORESCENT: 'warm-fluorescent' +}; + +CameraPreview.FLASH_MODE = { + OFF: 'off', + ON: 'on', + AUTO: 'auto', + RED_EYE: 'red-eye', // Android Only + TORCH: 'torch' +}; + +CameraPreview.COLOR_EFFECT = { + AQUA: 'aqua', // Android Only + BLACKBOARD: 'blackboard', // Android Only + MONO: 'mono', + NEGATIVE: 'negative', + NONE: 'none', + POSTERIZE: 'posterize', + SEPIA: 'sepia', + SOLARIZE: 'solarize', // Android Only + WHITEBOARD: 'whiteboard' // Android Only +}; + +CameraPreview.CAMERA_DIRECTION = { + BACK: 'back', + FRONT: 'front' +}; + +module.exports = CameraPreview; + +});