Merge pull request #12109 from zedascouves/master

Add camera choice option to QR scanner field
This commit is contained in:
Martin McKeaveney 2023-11-06 18:02:22 +00:00 committed by GitHub
commit 6a76fb4d90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

View File

@ -3598,6 +3598,22 @@
"value": "custom"
}
},
{
"type": "select",
"label": "Preferred camera",
"key": "preferredCamera",
"defaultValue": "environment",
"options": [
{
"label": "Front",
"value": "user"
},
{
"label": "Back",
"value": "environment"
}
]
},
{
"type": "event",
"label": "On change",

View File

@ -11,6 +11,7 @@
export let beepOnScan = false
export let beepFrequency = 2637
export let customFrequency = 1046
export let preferredCamera = "environment"
const dispatch = createEventDispatcher()
@ -20,7 +21,7 @@
let cameraEnabled
let cameraStarted = false
let html5QrCode
let cameraSetting = { facingMode: "environment" }
let cameraSetting = { facingMode: preferredCamera }
let cameraConfig = {
fps: 25,
qrbox: { width: 250, height: 250 },

View File

@ -14,6 +14,7 @@
export let beepOnScan
export let beepFrequency
export let customFrequency
export let preferredCamera
let fieldState
let fieldApi
@ -48,6 +49,7 @@
{beepOnScan}
{beepFrequency}
{customFrequency}
{preferredCamera}
/>
{/if}
</Field>