|
|
@ -211,6 +211,12 @@ export default class PhotoDialog extends Vue { |
|
|
|
if (cameraComponent) { |
|
|
|
this.numDevices = (await cameraComponent.devices(["videoinput"])).length; |
|
|
|
this.mirror = cameraComponent.facingMode === "user"; |
|
|
|
// figure out which device is active |
|
|
|
const currentDeviceId = cameraComponent.currentDeviceID(); |
|
|
|
const devices = await cameraComponent.devices(["videoinput"]); |
|
|
|
this.activeDeviceNumber = devices.findIndex( |
|
|
|
(device) => device.deviceId === currentDeviceId, |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -218,7 +224,9 @@ export default class PhotoDialog extends Vue { |
|
|
|
const cameraComponent = this.$refs.camera as InstanceType<typeof Camera>; |
|
|
|
this.activeDeviceNumber = (this.activeDeviceNumber + 1) % this.numDevices; |
|
|
|
const devices = await cameraComponent?.devices(["videoinput"]); |
|
|
|
cameraComponent?.changeCamera(devices[this.activeDeviceNumber].deviceId); |
|
|
|
await cameraComponent?.changeCamera( |
|
|
|
devices[this.activeDeviceNumber].deviceId, |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
async takeImage(/* payload: MouseEvent */) { |
|
|
|