Cache waveform peaks and use direct URLs for faster replay loads#1223
Open
hilsonshrestha wants to merge 5 commits intodevfrom
Open
Cache waveform peaks and use direct URLs for faster replay loads#1223hilsonshrestha wants to merge 5 commits intodevfrom
hilsonshrestha wants to merge 5 commits intodevfrom
Conversation
|
A preview of c1958fe is uploaded and can be seen here: ✨ https://revisit.dev/study/PR1223 ✨ Changes may take a few minutes to propagate. |
Contributor
There was a problem hiding this comment.
Pull request overview
Improves replay performance by avoiding repeated full audio decode for waveform rendering and by switching replay media loading from full-blob fetches to direct URLs so the browser can stream/buffer.
Changes:
- Added support for caching/loading WaveSurfer waveform peaks via the storage engine.
- Updated replay components to use direct screen recording URLs instead of blob/object URLs.
- Updated audio provenance visualization to load cached peaks when available and persist peaks after first load.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/storage/engines/types.ts | Adds WaveformPeaks type + storage helpers for saving/loading cached peaks; adds screen recording URL getter. |
| src/components/screenRecording/ScreenRecordingReplay.tsx | Switches screen recording replay source to direct URL loading. |
| src/components/audioAnalysis/AudioProvenanceVis.tsx | Adds waveform peak caching logic and switches to direct media URLs for faster load. |
| src/analysis/individualStudy/thinkAloud/ThinkAloudFooter.tsx | Switches think-aloud footer screen recording load to direct URL. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| .catch((err) => console.warn('Failed to save waveform peaks:', err)); | ||
| }); | ||
|
|
||
| await waveSurfer.load(audioUrl, undefined, duration); |
Comment on lines
+936
to
+939
| async getWaveformPeaks(taskName: string, participantId: string): Promise<WaveformPeaks | null> { | ||
| const result = await this._getFromStorage(`audio/${participantId}_${taskName}`, 'waveform.peaks.json'); | ||
| if (!result || !('peaks' in result)) return null; | ||
| return result as WaveformPeaks; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Does this PR close any open issues?
Closes #1174
Give a longer description of what this PR addresses and why it's needed
Audio and screen recording replays were slow because WaveSurfer had to fully decode audio on every load to render the waveform. This PR caches decoded waveform peaks to storage after the first load so subsequent visits skip decoding. It also replaces entire blob fetches of audio and video with direct URL calls so that the media player can buffer stream.
PR also shows a warning when participant used a browser different.
Provide pictures/videos of the behavior before and after these changes (optional)
Are there any additional TODOs before this PR is ready to go?
x