From f41d9b9c4885eb64fe06c9a6277430a356977473 Mon Sep 17 00:00:00 2001 From: Jack Wilburn Date: Wed, 18 Mar 2026 22:56:03 -0600 Subject: [PATCH] Add webcam recording support --- public/libraries/webcam-recording/config.json | 21 + .../assets/screen-recording-introduction.md | 6 +- .../assets/screen-recording-page.md | 3 +- public/library-screen-recording/config.json | 7 +- .../assets/webcam-recording-introduction.md | 13 + .../assets/webcam-recording-page.md | 5 + public/library-webcam-recording/config.json | 46 ++ .../individualStudy/StudyAnalysisTabs.tsx | 3 +- .../thinkAloud/ThinkAloudFooter.tsx | 40 +- src/components/ConfigSwitcher.tsx | 9 +- src/components/StepRenderer.tsx | 3 +- .../audioAnalysis/AudioProvenanceVis.tsx | 8 +- src/components/downloader/DownloadButtons.tsx | 52 +- src/components/interface/AppAside.tsx | 9 +- .../screenRecording/ScreenRecordingReplay.tsx | 144 +++-- src/controllers/ComponentController.tsx | 4 +- src/parser/LibraryConfigSchema.json | 40 ++ src/parser/StudyConfigSchema.json | 44 ++ src/parser/types.ts | 4 + .../assets/ScreenRecording.tsx | 199 ++++--- .../assets/WebcamRecording.tsx | 164 ++++++ src/storage/engines/FirebaseStorageEngine.ts | 15 + src/storage/engines/LocalStorageEngine.ts | 12 + src/storage/engines/SupabaseStorageEngine.ts | 11 + src/storage/engines/types.ts | 33 ++ src/store/hooks/recordingConfigUtils.ts | 14 + src/store/hooks/useRecording.ts | 539 ++++++++++-------- src/store/hooks/useRecordingConfig.spec.ts | 77 +++ src/store/hooks/useRecordingConfig.ts | 26 +- src/store/hooks/useReplay.ts | 212 ++++--- src/store/store.tsx | 4 + src/store/types.ts | 1 + src/utils/handleDownloadFiles.ts | 90 +++ src/utils/useStudyRecordings.spec.ts | 81 +++ src/utils/useStudyRecordings.ts | 44 +- 35 files changed, 1494 insertions(+), 489 deletions(-) create mode 100644 public/libraries/webcam-recording/config.json create mode 100644 public/library-webcam-recording/assets/webcam-recording-introduction.md create mode 100644 public/library-webcam-recording/assets/webcam-recording-page.md create mode 100644 public/library-webcam-recording/config.json create mode 100644 src/public/libraries/webcam-recording/assets/WebcamRecording.tsx create mode 100644 src/store/hooks/recordingConfigUtils.ts create mode 100644 src/store/hooks/useRecordingConfig.spec.ts create mode 100644 src/utils/useStudyRecordings.spec.ts diff --git a/public/libraries/webcam-recording/config.json b/public/libraries/webcam-recording/config.json new file mode 100644 index 0000000000..59da888745 --- /dev/null +++ b/public/libraries/webcam-recording/config.json @@ -0,0 +1,21 @@ +{ + "$schema": "https://raw.githubusercontent.com/revisit-studies/study/v2.4.1/src/parser/LibraryConfigSchema.json", + "description": "This is a library for getting webcam recording permissions and starting webcam recording.", + "components": { + "webcamRecordingPermission": { + "description": "Get permission to start webcam recording", + "type": "react-component", + "path": "libraries/webcam-recording/assets/WebcamRecording.tsx", + "nextButtonLocation": "belowStimulus", + "nextButtonText": "Continue", + "recordAudio": false, + "response": [{ + "hidden": true, + "type": "reactive", + "id": "webcamRecordingPermission", + "prompt": "Webcam recording enabled" + }] + } + }, + "sequences": {} +} diff --git a/public/library-screen-recording/assets/screen-recording-introduction.md b/public/library-screen-recording/assets/screen-recording-introduction.md index 7f159cc397..f96c44d9cf 100644 --- a/public/library-screen-recording/assets/screen-recording-introduction.md +++ b/public/library-screen-recording/assets/screen-recording-introduction.md @@ -1,11 +1,10 @@ -# Screen Recording - +# Screen And Webcam Recording This is a demo of the library `screen-recording`. -This is a required library for screen recording. It provides a component that request user permission for screen and microphone permissions. Then, it starts screen capture until the end of the study. +This library provides a component that can request screen, webcam, and microphone permissions together. In this example, screen and webcam capture are both enabled and continue until the end of the study. ## Available Components @@ -16,4 +15,3 @@ This is a required library for screen recording. It provides a component that re None - diff --git a/public/library-screen-recording/assets/screen-recording-page.md b/public/library-screen-recording/assets/screen-recording-page.md index 6b429fc838..da5d66bdc9 100644 --- a/public/library-screen-recording/assets/screen-recording-page.md +++ b/public/library-screen-recording/assets/screen-recording-page.md @@ -1,9 +1,8 @@ # Demo Page -Any stimulus that follows the `screenRecordingPermission` page can be recorded. +Any stimulus that follows the `screenRecordingPermission` page can capture both screen and webcam video. Explore the webpage in the iframe below, then proceed to the next page.