Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add camera choice option to QR scanner field #12109

Merged
merged 22 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/client/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3419,6 +3419,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",
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/components/app/forms/CodeScanner.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
export let beepOnScan = false
export let beepFrequency = 2637
export let customFrequency = 1046
export let preferredCamera = "environment"

const dispatch = createEventDispatcher()

Expand All @@ -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 },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
export let beepOnScan
export let beepFrequency
export let customFrequency
export let preferredCamera

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