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