Open
Conversation
|
@Raz-js is attempting to deploy a commit to the Paper Design Team on Vercel. A member of the Team first needs to authorize it. |
Grenish
suggested changes
Apr 13, 2025
Grenish
left a comment
There was a problem hiding this comment.
The code is looking good but there are still some minor bugs that might affect the app video export feature
There was a problem hiding this comment.
Not all browsers support vp9. Consider fallback
mimeType: MediaRecorder.isTypeSupported('video/webm;codecs=vp9')
? 'video/webm;codecs=vp9'
: 'video/webm';Also for the following code,
useEffect(() => {
return () => {
if (recordingRef.current) {
recordingRef.current.stop();
}
};
}, []);If the component unmounts mid-recording, this is helpful, but consider stopping the stopwatch too.
useEffect(() => {
return () => {
recordingRef.current?.stop();
stopStopWatch();
};
}, []);There was a problem hiding this comment.
The code is pretty good and solid but there is one major bug that you might have not noticed. In the following code,
if (startTimeRef.current !== null) {
const elapsedMS = Date.now() - startTimeRef.current;
setTimeElapsed(Math.floor(elapsedMS / 1000));
}
setTimeElapsed((prev) => prev + 1);You're updating timeElapsed twice:
- Once using actual time difference
- Once adding
+1manually
Below is the suggested fix for the code.
const updateTime = useCallback(() => {
if (startTimeRef.current !== null) {
const elapsedMS = Date.now() - startTimeRef.current;
setTimeElapsed(Math.floor(elapsedMS / 1000));
}
rafRef.current = requestAnimationFrame(updateTime);
}, []);
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.
Used @KarimBenn22's PR as a foundation for this PR
What I changed:
Note: I'm also planning on attempting to find a method to allow the recorder to identify iterations and start and stop based on them.