Skip to content
Merged
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
18 changes: 18 additions & 0 deletions public/pay/camera_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ <h2>Camera Access Test</h2>
} else if (state === 'prompt') {
statusElem.className = 'alert alert-warning';
statusElem.innerHTML = 'Camera permission: <strong>not granted (prompt required)</strong>';
if (inDialogLink) inDialogLink.style.display = 'inline-block';
if (popupLink) popupLink.style.display = 'inline-block';
} else if (state === 'denied') {
statusElem.className = 'alert alert-danger';
statusElem.innerHTML = 'Camera permission: <strong>denied</strong>';
if (inDialogLink) inDialogLink.style.display = 'inline-block';
if (popupLink) popupLink.style.display = 'inline-block';
} else {
statusElem.className = 'alert alert-info';
Expand Down Expand Up @@ -104,6 +106,22 @@ <h2>Camera Access Test</h2>
}
}

async function requestCameraInDialog(evt) {
if (evt) evt.preventDefault();
logElem.style.display = 'none';
try {
const stream = await navigator.mediaDevices.getUserMedia({ video: true });
stream.getTracks().forEach(track => track.stop());
await checkCameraPermission();
} catch (err) {
console.error('getUserMedia error:', err);
logElem.className = 'alert alert-danger';
logElem.innerHTML = `<b>Camera error (${err.name})</b>: ${err.message || 'Access failed.'}`;
logElem.style.display = 'block';
await checkCameraPermission();
}
}

function openCameraAccessPopup(evt) {
if (evt) evt.preventDefault();
const popup = window.open('/pay/camera_access.html', 'camera_access_popup', 'width=500,height=400');
Expand Down