@capacitor-community/camera-preview
Advanced tools
Comparing version 6.0.0 to 6.0.1
@@ -58,6 +58,6 @@ export type CameraPosition = 'rear' | 'front'; | ||
export interface CameraPreviewPlugin { | ||
start(options: CameraPreviewOptions): Promise<{}>; | ||
startRecordVideo(options: CameraPreviewOptions): Promise<{}>; | ||
stop(): Promise<{}>; | ||
stopRecordVideo(): Promise<{}>; | ||
start(options: CameraPreviewOptions): Promise<void>; | ||
startRecordVideo(options: CameraPreviewOptions): Promise<void>; | ||
stop(): Promise<void>; | ||
stopRecordVideo(): Promise<void>; | ||
capture(options: CameraPreviewPictureOptions): Promise<{ | ||
@@ -76,3 +76,6 @@ value: string; | ||
flip(): Promise<void>; | ||
setOpacity(options: CameraOpacityOptions): Promise<{}>; | ||
setOpacity(options: CameraOpacityOptions): Promise<void>; | ||
isCameraStarted(): Promise<{ | ||
value: boolean; | ||
}>; | ||
} |
@@ -10,5 +10,5 @@ import { WebPlugin } from '@capacitor/core'; | ||
constructor(); | ||
start(options: CameraPreviewOptions): Promise<{}>; | ||
startRecordVideo(): Promise<{}>; | ||
stopRecordVideo(): Promise<{}>; | ||
start(options: CameraPreviewOptions): Promise<void>; | ||
startRecordVideo(): Promise<void>; | ||
stopRecordVideo(): Promise<void>; | ||
stop(): Promise<any>; | ||
@@ -25,2 +25,5 @@ capture(options: CameraPreviewPictureOptions): Promise<any>; | ||
setOpacity(_options: CameraOpacityOptions): Promise<any>; | ||
isCameraStarted(): Promise<{ | ||
value: boolean; | ||
}>; | ||
} |
@@ -10,3 +10,5 @@ import { WebPlugin } from '@capacitor/core'; | ||
async start(options) { | ||
// eslint-disable-next-line no-async-promise-executor | ||
return new Promise(async (resolve, reject) => { | ||
var _a; | ||
await navigator.mediaDevices | ||
@@ -45,3 +47,3 @@ .getUserMedia({ | ||
parent.appendChild(videoElement); | ||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | ||
if ((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) { | ||
const constraints = { | ||
@@ -64,3 +66,3 @@ video: { | ||
videoElement.play(); | ||
resolve({}); | ||
resolve(); | ||
}, (err) => { | ||
@@ -88,4 +90,3 @@ reject(err); | ||
const tracks = st.getTracks(); | ||
for (let i = 0; i < tracks.length; i++) { | ||
const track = tracks[i]; | ||
for (const track of tracks) { | ||
track.stop(); | ||
@@ -97,3 +98,3 @@ } | ||
async capture(options) { | ||
return new Promise((resolve, _) => { | ||
return new Promise((resolve) => { | ||
const video = document.getElementById('video'); | ||
@@ -131,2 +132,3 @@ const canvas = document.createElement('canvas'); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async setFlashMode(_options) { | ||
@@ -144,3 +146,6 @@ throw new Error('setFlashMode not supported under the web platform'); | ||
} | ||
async isCameraStarted() { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
//# sourceMappingURL=web.js.map |
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
var core = require('@capacitor/core'); | ||
@@ -19,3 +17,5 @@ | ||
async start(options) { | ||
// eslint-disable-next-line no-async-promise-executor | ||
return new Promise(async (resolve, reject) => { | ||
var _a; | ||
await navigator.mediaDevices | ||
@@ -54,3 +54,3 @@ .getUserMedia({ | ||
parent.appendChild(videoElement); | ||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | ||
if ((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) { | ||
const constraints = { | ||
@@ -73,3 +73,3 @@ video: { | ||
videoElement.play(); | ||
resolve({}); | ||
resolve(); | ||
}, (err) => { | ||
@@ -97,4 +97,3 @@ reject(err); | ||
const tracks = st.getTracks(); | ||
for (let i = 0; i < tracks.length; i++) { | ||
const track = tracks[i]; | ||
for (const track of tracks) { | ||
track.stop(); | ||
@@ -106,3 +105,3 @@ } | ||
async capture(options) { | ||
return new Promise((resolve, _) => { | ||
return new Promise((resolve) => { | ||
const video = document.getElementById('video'); | ||
@@ -140,2 +139,3 @@ const canvas = document.createElement('canvas'); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async setFlashMode(_options) { | ||
@@ -153,2 +153,5 @@ throw new Error('setFlashMode not supported under the web platform'); | ||
} | ||
async isCameraStarted() { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -155,0 +158,0 @@ |
@@ -1,2 +0,2 @@ | ||
var capacitorSplashScreen = (function (exports, core) { | ||
var capacitorCameraPreview = (function (exports, core) { | ||
'use strict'; | ||
@@ -16,3 +16,5 @@ | ||
async start(options) { | ||
// eslint-disable-next-line no-async-promise-executor | ||
return new Promise(async (resolve, reject) => { | ||
var _a; | ||
await navigator.mediaDevices | ||
@@ -51,3 +53,3 @@ .getUserMedia({ | ||
parent.appendChild(videoElement); | ||
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) { | ||
if ((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia) { | ||
const constraints = { | ||
@@ -70,3 +72,3 @@ video: { | ||
videoElement.play(); | ||
resolve({}); | ||
resolve(); | ||
}, (err) => { | ||
@@ -94,4 +96,3 @@ reject(err); | ||
const tracks = st.getTracks(); | ||
for (let i = 0; i < tracks.length; i++) { | ||
const track = tracks[i]; | ||
for (const track of tracks) { | ||
track.stop(); | ||
@@ -103,3 +104,3 @@ } | ||
async capture(options) { | ||
return new Promise((resolve, _) => { | ||
return new Promise((resolve) => { | ||
const video = document.getElementById('video'); | ||
@@ -137,2 +138,3 @@ const canvas = document.createElement('canvas'); | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
async setFlashMode(_options) { | ||
@@ -150,2 +152,5 @@ throw new Error('setFlashMode not supported under the web platform'); | ||
} | ||
async isCameraStarted() { | ||
throw this.unimplemented('Not implemented on web.'); | ||
} | ||
} | ||
@@ -160,4 +165,2 @@ | ||
Object.defineProperty(exports, '__esModule', { value: true }); | ||
return exports; | ||
@@ -164,0 +167,0 @@ |
{ | ||
"name": "@capacitor-community/camera-preview", | ||
"version": "6.0.0", | ||
"version": "6.0.1", | ||
"description": "Camera preview", | ||
@@ -14,6 +14,6 @@ "main": "dist/plugin.cjs.js", | ||
"verify:web": "npm run build", | ||
"build": "npm run clean && tsc && rollup -c rollup.config.js", | ||
"build": "npm run clean && tsc && rollup -c rollup.config.mjs", | ||
"clean": "rimraf './dist'", | ||
"watch": "tsc --watch", | ||
"lint": "concurrently -g \"npm:eslint\" \"npm:prettier -- --check\" \"npm run swiftlint -- lint ios\"", | ||
"lint": "concurrently -g \"npm:eslint\" \"npm:prettier -- --check --plugin=prettier-plugin-java\" \"npm run swiftlint -- lint ios\"", | ||
"fmt": "concurrently -g \"npm:eslint -- --fix\" \"npm:prettier -- --write\" \"npm:swiftlint -- lint --fix --format ios\"", | ||
@@ -29,17 +29,17 @@ "eslint": "eslint . --ext ts", | ||
"devDependencies": { | ||
"@capacitor/android": "^6.0.0", | ||
"@capacitor/core": "^6.0.0", | ||
"@capacitor/ios": "^6.0.0", | ||
"@ionic/eslint-config": "^0.3.0", | ||
"@ionic/prettier-config": "^2.0.0", | ||
"@ionic/swiftlint-config": "^1.1.2", | ||
"concurrently": "^7.0.0", | ||
"eslint": "^7.32.0", | ||
"husky": "^7.0.4", | ||
"prettier": "^2.5.1", | ||
"prettier-plugin-java": "^1.6.1", | ||
"pretty-quick": "^3.1.3", | ||
"rimraf": "^3.0.2", | ||
"rollup": "^2.79.1", | ||
"swiftlint": "^1.0.1", | ||
"@capacitor/android": "^6.2.0", | ||
"@capacitor/core": "^6.2.0", | ||
"@capacitor/ios": "^6.2.0", | ||
"@ionic/eslint-config": "^0.4.0", | ||
"@ionic/prettier-config": "^4.0.0", | ||
"@ionic/swiftlint-config": "^2.0.0", | ||
"concurrently": "^9.1.0", | ||
"eslint": "^8.57.1", | ||
"husky": "^9.1.7", | ||
"prettier": "^3.4.2", | ||
"prettier-plugin-java": "^2.6.5", | ||
"pretty-quick": "^4.0.0", | ||
"rimraf": "^6.0.1", | ||
"rollup": "^4.28.1", | ||
"swiftlint": "^2.0.0", | ||
"typescript": "^4.3.2" | ||
@@ -85,3 +85,7 @@ }, | ||
"url": "https://github.com/capacitor-community/camera-preview/issues" | ||
}, | ||
"engines": { | ||
"node": ">=18.0.0", | ||
"npm": ">=9.0.0" | ||
} | ||
} |
@@ -300,2 +300,10 @@ <p align="center"><br><img src="https://user-images.githubusercontent.com/236501/85893648-1c92e880-b7a8-11ea-926d-95355b8175c7.png" width="128" height="128" /></p> | ||
### isCameraStarted() ---- ANDROID and iOS only | ||
<info>Check or detect if the camera has been started</info><br/> | ||
```javascript | ||
const { value } = await CameraPreview.isCameraStarted(); | ||
``` | ||
# Settings | ||
@@ -302,0 +310,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
317077
568
457
0