woah yeah quite a lot wrong here lol
1) timestamps is the entire array, so you need to add the index (in the export section)
2) you're likely getting a NotSupportedError from the mediaRecorder because not all systems support that codec, try
if (!MediaRecorder.isTypeSupported('video/webm; codecs=vp9')) {
console.error('❌ MediaRecorder VP9 not supported');
return;
}
instead
3) You seem to be generating random FPS values? is that correct?
4) chromeMediaSource is deprecated, use navigator.mediaDevices.getDisplayMedia() instead
5) are you aware you're calling clearInterval(intervalID) multiple times?
6) you should perhaps be checking if fpsChart actually exists?
7) what if sessionTimer.textContent is empty? (e.g. if the recording was too short)
1) timestamps is the entire array, so you need to add the index (in the export section)
2) you're likely getting a NotSupportedError from the mediaRecorder because not all systems support that codec, try
if (!MediaRecorder.isTypeSupported('video/webm; codecs=vp9')) {
console.error('❌ MediaRecorder VP9 not supported');
return;
}
instead
3) You seem to be generating random FPS values? is that correct?
4) chromeMediaSource is deprecated, use navigator.mediaDevices.getDisplayMedia() instead
5) are you aware you're calling clearInterval(intervalID) multiple times?
6) you should perhaps be checking if fpsChart actually exists?
7) what if sessionTimer.textContent is empty? (e.g. if the recording was too short)
PrettyTroubles · 26-30, F
@Sandcastler Wow much thanks!! I have been trying to get my video/game to preview but its not fetching so i was so annoyed XD
im gathering FPS and game footage so that i can see what is causing the fps to dip so low. and im trying to add a record button so i can record my game media and FPS
im gathering FPS and game footage so that i can see what is causing the fps to dip so low. and im trying to add a record button so i can record my game media and FPS
Northwest · M
@Sandcastler
The exportBtn's click handler has a bug. It incorrectly tries to join the entire timestamps array into every single row of the CSV file.
- Wrong: const csv = fpsLog.map((fps, i) => \timestamps,{fps}`).join('\n');`
- Right: const csv = fpsLog.map((fps, i) => \timestamps,{fps}`).join('\n');`
Placeholder FPS Calculation: The recordFPS function doesn't calculate the actual FPS of the video stream. It generates a random number,. OK for but not for produciton.
Recording Logic: You meant for monitorFPS to stop recording, but it's not properly implemented. You probably meant to capture performance drops (hint: filename: low_fps_capture.webm), it should trigger when FPS < 30.
- [i]Wrong: if (latest > 30 && isRecording)
- Right: if (latest < 30 && isRecording)
DRY: The logic to stop a recording is repeated in three different places. You can place it in a single helper function.
The exportBtn's click handler has a bug. It incorrectly tries to join the entire timestamps array into every single row of the CSV file.
- Wrong: const csv = fpsLog.map((fps, i) => \timestamps,{fps}`).join('\n');`
- Right: const csv = fpsLog.map((fps, i) => \timestamps,{fps}`).join('\n');`
Placeholder FPS Calculation: The recordFPS function doesn't calculate the actual FPS of the video stream. It generates a random number,. OK for but not for produciton.
Recording Logic: You meant for monitorFPS to stop recording, but it's not properly implemented. You probably meant to capture performance drops (hint: filename: low_fps_capture.webm), it should trigger when FPS < 30.
- [i]Wrong: if (latest > 30 && isRecording)
- Right: if (latest < 30 && isRecording)
DRY: The logic to stop a recording is repeated in three different places. You can place it in a single helper function.
DDonde · 31-35, M
What's the error you're running into?
PrettyTroubles · 26-30, F
@DDonde I think I fixed it lol it was a syntax error lol my fps chart appears to be working fine now... I hope lol