fix: re-request camera stream on retake when tracks are inactive (refs #123)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m20s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 51s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 3m20s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 51s
Deploy to Staging / Verify Staging (pull_request) Successful in 9s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
The retake button failed because the stream tracks could become inactive during the crop phase, but handleRetake never re-acquired the camera. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -151,7 +151,15 @@ export const CameraCapture: React.FC<CameraCaptureProps> = ({
|
||||
setCapturedFile(null);
|
||||
setCapturedImageSrc(null);
|
||||
setCaptureState('viewfinder');
|
||||
}, [capturedImageSrc]);
|
||||
|
||||
// Re-request camera if stream tracks are no longer active
|
||||
const isStreamActive = stream?.getVideoTracks().some(
|
||||
(track) => track.readyState === 'live'
|
||||
);
|
||||
if (!isStreamActive) {
|
||||
requestPermission();
|
||||
}
|
||||
}, [capturedImageSrc, stream, requestPermission]);
|
||||
|
||||
const handleCropReset = useCallback(() => {
|
||||
// Just reset crop area, keep the captured image
|
||||
|
||||
Reference in New Issue
Block a user