fix: switch camera
This commit is contained in:
parent
7afdf97697
commit
5fa4c640e3
@ -42,6 +42,13 @@
|
||||
<FeatherIcon name="arrow-left" class="size-4" />
|
||||
</template>
|
||||
</Button>
|
||||
<Button
|
||||
v-if="
|
||||
filesUploaderArea?.showCamera && !filesUploaderArea?.cameraImage
|
||||
"
|
||||
:label="__('Switch camera')"
|
||||
@click="() => filesUploaderArea.switchCamera()"
|
||||
/>
|
||||
<Button
|
||||
v-if="filesUploaderArea?.cameraImage"
|
||||
:label="__('Retake')"
|
||||
|
||||
@ -214,6 +214,11 @@ async function startCamera() {
|
||||
video.value.srcObject = stream
|
||||
}
|
||||
|
||||
function switchCamera() {
|
||||
facingMode.value = facingMode.value === 'environment' ? 'user' : 'environment'
|
||||
startCamera()
|
||||
}
|
||||
|
||||
const canvas = ref(null)
|
||||
|
||||
function captureImage() {
|
||||
@ -388,5 +393,6 @@ defineExpose({
|
||||
cameraImage,
|
||||
captureImage,
|
||||
uploadViaCamera,
|
||||
switchCamera,
|
||||
})
|
||||
</script>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user