Skip to content

Commit

Permalink
Update Modal.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-NaN authored Feb 11, 2023
1 parent 38288fa commit 20a6f33
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,11 @@ class CameraModal extends Modal {


switchCameraButton.onclick = async () => {
cameraIndex = (cameraIndex + 1) % cameras.length;
this.videoStream = await getVideoStream();
cameraIndex = (cameraIndex + 1) % cameras.length;
this.videoStream = null;
this.videoStream = yield navigator.mediaDevices.getUserMedia({video: { deviceId: cameras[cameraIndex].deviceId }, audio: true});
videoEl.srcObject = this.videoStream;
videoEl.play();
};

snapPhotoButton.onclick = () => {
Expand Down Expand Up @@ -187,4 +190,4 @@ class CameraModal extends Modal {
}
}

export default CameraModal
export default CameraModal

0 comments on commit 20a6f33

Please sign in to comment.