Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions packages/modules/web-actions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

### Fixed

- We fixed an issue where the take picture button dissapear when video is not ready.

## [2.11.1] - 2025-10-31

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export async function TakePicture(picture, showConfirmationScreen, pictureQualit
let stream;
let videoIsReady = false;
let shouldFaceEnvironment = true;
let retryAttempt = 0;
const {
video,
wrapper,
Expand Down Expand Up @@ -84,12 +85,30 @@ export async function TakePicture(picture, showConfirmationScreen, pictureQualit
});
switchControl.addEventListener("click", switchControlHandler);
actionControl.addEventListener("click", () => {

if(!videoIsReady){
actionControl.disabled = true;
// reload video if not ready yet (some devices need this extra step)
if(retryAttempt < 3){
retryAttempt++;
} else {
mx.ui.error(getUserText("Media not available.", "Media niet beschikbaar."));
return;
}
video.load();
setTimeout(() => {
actionControl.click();
}, 50);
return;
}

removeAllControlButtons();
if (showConfirmationScreen) {
// Delay the `takePictureHandler` to the next cycle so the UI preparations can go first. Otherwise, the control-buttons are not removed while the second screen is being set up.
setTimeout(() => {
takePictureHandler(() => {
addAllControlButtons();
retryAttempt = 0;
video.play();
});
}, 0);
Expand All @@ -101,6 +120,8 @@ export async function TakePicture(picture, showConfirmationScreen, pictureQualit
closeControlHandler();
});
}

actionControl.disabled = false;
});
video.addEventListener("loadedmetadata", () => (videoIsReady = true));
function getVideoCanvas() {
Expand Down
Loading