Skip to content

Conversation

@supervoidcoder
Copy link
Member

#131 thats what it fixes

Resolves

What Github issue does this resolve (if any, if not then please include link)?

  • Resolves #

Proposed Changes

Describe what this Pull Request does

Reason for Changes

Explain why these changes should be made. Why is this helpful or necessary? Why should this be added?

Test Coverage

Please show how you have added tests to cover your changes

Browser Coverage

Check the OS/browser combinations tested (At least 2)

Mac

  • Chrome
  • Firefox
  • Safari

Windows

  • Chrome
  • Firefox
  • Edge

Chromebook

  • Chrome

iPad

  • Safari

Android Tablet

  • Chrome

@devloai

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

🎉 MEGA PR Test & Analysis Complete!

Hi @supervoidcoder! Your PR has been fully tested and analyzed! 🚀✨


🌍 Test Deployment

Live Preview: https://OmniBlocks.github.io/scratch-gui/supervoidcoder/226/


🧪 Test Results

ESLint: ❌ Found issues

  • Errors: 0
  • Warnings: 0

Unit Tests:

  • Total: 37 tests
  • ✅ Passed: 1
  • ❌ Failed: 0

Integration Tests:

  • Total: 37 tests
  • ✅ Passed: 0
  • ❌ Failed: 15
  • ⏭️ Skipped: 1

📄 Full test outputs available in artifacts


🔦 Performance Audit (Lighthouse)

✅ Audit completed successfully!

📊 Lighthouse Scores:

  • 🔴 Performance: 33/100
  • 🟠 Accessibility: 70/100
  • 🟢 Best Practices: 93/100
  • 🟠 SEO: 88/100

⚡ Core Web Vitals:

  • First Contentful Paint: 43.2 s
  • Largest Contentful Paint: 48.2 s
  • Total Blocking Time: 1,060 ms
  • Cumulative Layout Shift: 0
  • Speed Index: 43.2 s

🟢 90-100 (Good) | 🟠 50-89 (Needs Improvement) | 🔴 0-49 (Poor)

📄 Full report in artifacts


📦 Bundle Size Analysis

Total Build Size: 136M

📦 Top 5 Largest JavaScript Files:

  • 20M - samples3.js
  • 20M - player/samples3.js
  • 13M - player/drumsamples.js
  • 13M - drumsamples.js
  • 9.5M - samples2.js

🎨 Top 5 Largest CSS Files:

  • No CSS files found (might be inlined in JS)

♿ Accessibility Testing

✅ Accessibility scan completed!


📊 Build Details


💡 Pro Tip: Only one build was needed for all these checks - saving CI/CD minutes! 🎯

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Improved recording reliability with clearer fallback so recordings complete even if post-record conversion to MP4 fails
  • Improvements

    • Recordings now default to WebM and will attempt MP4 conversion afterward; on failure the original WebM is preserved
    • Added detailed logging for recording and conversion steps to improve transparency and troubleshooting

✏️ Tip: You can customize this high-level summary in your review settings.

Walkthrough

Recordings now default to WebM; when MP4 is requested the code attempts an ffmpeg conversion using added flags (-fflags +genpts, -video_track_timescale 90000, -muxpreload 0, -muxdelay 0) with verbose logging. On conversion failure the original WebM is returned as a fallback.

Changes

Cohort / File(s) Summary
Media recorder userscript
src/addons/addons/mediarecorder/userscript.js
Default recording changed to WebM; added console logs for format selection, conversion start/complete/error; convertWebmToMp4 call reordered so -i precedes encoding flags and now includes -fflags +genpts, -video_track_timescale 90000, -muxpreload 0, -muxdelay 0; conversion is attempted whenever selectedFormat is mp4 and failures fall back to returning the original WebM.
ESLint ignore
.eslintignore
Whitespace-only change to the static/* ignore line (no functional effect).

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant Recorder as MediaRecorder
  participant FS as FileSystem
  participant FFmpeg as ffmpeg (convertWebmToMp4)
  Note over Recorder,FS: Recording always saved as WebM
  User->>Recorder: Stop recording (selectedFormat = mp4?)
  Recorder->>FS: save WebM blob
  alt selectedFormat == mp4
    Recorder->>FFmpeg: convert WebM -> MP4 (adds +genpts, timescale, mux flags)
    FFmpeg-->>Recorder: success (MP4)
    alt success
      Recorder->>User: deliver MP4 (logged)
    else error
      Recorder->>User: deliver WebM (fallback, logged)
    end
  else selectedFormat != mp4
    Recorder->>User: deliver WebM
  end
  Note right of FFmpeg: conversion logging added (start/complete/error)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review focus:
    • convertWebmToMp4 ffmpeg argument ordering and correctness
    • Error-handling and fallback path that returns WebM
    • Places that decide recording mime type / selectedFormat logic and related console logs

Possibly related PRs

Poem

🐇
I hop through frames with careful care,
I mark each tick and mend each glare.
WebM first, MP4 I seek—
If ffmpeg stumbles, I stay meek;
I hand your clip, whole and fair.

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is minimally related to the changeset, containing only a reference '#131 thats what it fixes' with an unfilled template, providing no meaningful explanation of the proposed changes, reasons, or test coverage. Complete the PR description by filling in the 'Proposed Changes', 'Reason for Changes', and 'Test Coverage' sections with specific details about the modifications made and testing performed.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title refers to fixing a media recorder timestamp issue, which aligns with the main changes (ffmpeg flags for timestamp handling and conversion logic), though the title contains a typo and is vague about what 'timestapm' refers to.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch media-fix-timetsamtp-thign

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 01c98a4 and 8fea082.

📒 Files selected for processing (1)
  • .eslintignore (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .eslintignore
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (actions)
  • GitHub Check: mega-test

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@supervoidcoder
Copy link
Member Author

Unable to perform a code review. You have run out of credits 😔 Please upgrade your plan or buy additional credits from the subscription page.

thank you because i DIDN'T ASK that's what coderabbit is for

@supervoidcoder
Copy link
Member Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

✅ Actions performed

Full review triggered.

  bvxdfghjhgfdfghjhgfghjhgfghgghghhh dep update 67
@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

🎉 MEGA PR Test & Analysis Complete!

Hi @supervoidcoder! Your PR has been fully tested and analyzed! 🚀✨


🌍 Test Deployment

Live Preview: https://OmniBlocks.github.io/scratch-gui/supervoidcoder/226/


🧪 Test Results

ESLint: ❌ Found issues

  • Errors: 0
  • Warnings: 0

Unit Tests:

  • Total: 37 tests
  • ✅ Passed: 1
  • ❌ Failed: 0

Integration Tests:

  • Total: 37 tests
  • ✅ Passed: 0
  • ❌ Failed: 15
  • ⏭️ Skipped: 1

📄 Full test outputs available in artifacts


🔦 Performance Audit (Lighthouse)

✅ Audit completed successfully!

📊 Lighthouse Scores:

  • 🔴 Performance: 38/100
  • 🟠 Accessibility: 70/100
  • 🟢 Best Practices: 93/100
  • 🟠 SEO: 88/100

⚡ Core Web Vitals:

  • First Contentful Paint: 46.2 s
  • Largest Contentful Paint: 49.5 s
  • Total Blocking Time: 680 ms
  • Cumulative Layout Shift: 0
  • Speed Index: 46.2 s

🟢 90-100 (Good) | 🟠 50-89 (Needs Improvement) | 🔴 0-49 (Poor)

📄 Full report in artifacts


📦 Bundle Size Analysis

Total Build Size: 136M

📦 Top 5 Largest JavaScript Files:

  • 20M - samples3.js
  • 20M - player/samples3.js
  • 13M - player/drumsamples.js
  • 13M - drumsamples.js
  • 9.5M - samples2.js

🎨 Top 5 Largest CSS Files:

  • No CSS files found (might be inlined in JS)

♿ Accessibility Testing

✅ Accessibility scan completed!


📊 Build Details


💡 Pro Tip: Only one build was needed for all these checks - saving CI/CD minutes! 🎯

@supervoidcoder
Copy link
Member Author

/test pr

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

MEGA PR Test Failed @supervoidcoder

Something went wrong during the build or analysis process.
Total time:

Check the logs for details: View Logs

@supervoidcoder
Copy link
Member Author

@coderabbitai lol what the heck ive never seen a github workflow run out of internet before lol
npm error code 1
npm error git dep preparation failed
npm error command /opt/hostedtoolcache/node/20.19.5/x64/bin/node /opt/hostedtoolcache/node/20.19.5/x64/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/runner/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error npm warn using --force Recommended protections disabled.
npm error npm error code 1
npm error npm error git dep preparation failed
npm error npm error command /opt/hostedtoolcache/node/20.19.5/x64/bin/node /opt/hostedtoolcache/node/20.19.5/x64/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/runner/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm error npm error npm warn using --force Recommended protections disabled.
npm error npm error npm warn deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm error npm error npm warn deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm error npm error npm warn deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm error npm error npm warn deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm error npm error npm warn deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm error npm error npm warn deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm error npm error npm warn deprecated babel-eslint@8.2.6: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm error npm error npm warn deprecated core-js@2.6.12: core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.
npm error npm error npm error code ECONNRESET
npm error npm error npm error network aborted
npm error npm error npm error network This is a problem related to network connectivity.
npm error npm error npm error network In most cases you are behind a proxy or have bad network settings.
npm error npm error npm error network
npm error npm error npm error network If you are behind a proxy, please make sure that the
npm error npm error npm error network 'proxy' config is set properly. See: 'npm help config'
npm error npm error npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-10-16T21_37_21_638Z-debug-0.log
npm error npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-10-16T21_36_47_051Z-debug-0.log
npm error A complete log of this run can be found in: /home/runner/.npm/_logs/2025-10-16T21_36_27_995Z-debug-0.log
Error: Process completed with exit code 1.

@supervoidcoder
Copy link
Member Author

/test pr

@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

🎉 MEGA PR Test & Analysis Complete!

Hi @supervoidcoder! Your PR has been fully tested and analyzed! 🚀✨


🌍 Test Deployment

Live Preview: https://OmniBlocks.github.io/scratch-gui/supervoidcoder/226/


🧪 Test Results

ESLint: ❌ Found issues

  • Errors: 0
  • Warnings: 0

Unit Tests:

  • Total: 37 tests
  • ✅ Passed: 1
  • ❌ Failed: 0

Integration Tests:

  • Total: 37 tests
  • ✅ Passed: 0
  • ❌ Failed: 15
  • ⏭️ Skipped: 1

📄 Full test outputs available in artifacts


🔦 Performance Audit (Lighthouse)

✅ Audit completed successfully!

📊 Lighthouse Scores:

  • 🔴 Performance: 28/100
  • 🟠 Accessibility: 70/100
  • 🟢 Best Practices: 93/100
  • 🟠 SEO: 88/100

⚡ Core Web Vitals:

  • First Contentful Paint: 43.0 s
  • Largest Contentful Paint: 48.3 s
  • Total Blocking Time: 1,550 ms
  • Cumulative Layout Shift: 0
  • Speed Index: 43.0 s

🟢 90-100 (Good) | 🟠 50-89 (Needs Improvement) | 🔴 0-49 (Poor)

📄 Full report in artifacts


📦 Bundle Size Analysis

Total Build Size: 136M

📦 Top 5 Largest JavaScript Files:

  • 20M - samples3.js
  • 20M - player/samples3.js
  • 13M - player/drumsamples.js
  • 13M - drumsamples.js
  • 9.5M - samples2.js

🎨 Top 5 Largest CSS Files:

  • No CSS files found (might be inlined in JS)

♿ Accessibility Testing

✅ Accessibility scan completed!


📊 Build Details


💡 Pro Tip: Only one build was needed for all these checks - saving CI/CD minutes! 🎯

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Tip

For best results, initiate chat on the files or code changes.

@supervoidcoder, haha yes! That's a classic GitHub Actions transient network issue. The ECONNRESET error during npm install is unfortunately a known intermittent problem with the hosted runners - sometimes they experience temporary network connectivity issues when fetching dependencies from npm registry or git repositories.

The good news is you already did the right thing by re-running the workflow with /test pr again! These network errors are typically transient and resolve themselves on retry.

If the issue persists after a few retries, it could be:

  • A temporary outage with npm registry or GitHub's git servers
  • An issue with a specific dependency that's timing out

But in most cases, the second run should succeed. You can monitor the new workflow run to see if it completes successfully. 🤞

@supervoidcoder
Copy link
Member Author

@coderabbitai can you STOP SPAMMING

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Tip

For best results, initiate chat on the files or code changes.

@supervoidcoder, I sincerely apologize for the spam! That was absolutely not intentional. It looks like there was a bug that caused the Free Plan notification to be posted multiple times in quick succession.

This shouldn't happen, and I understand how frustrating that must be. The issue appears to have resolved itself now, but if you continue to see any repetitive messages, please let me know and I can help escalate it.

Again, my apologies for the noise. Is there anything else I can help you with regarding this PR?

@supervoidcoder
Copy link
Member Author

@coderabbitai bro pls delete all these spam comments

@OmniBlocks OmniBlocks deleted a comment from github-actions bot Oct 16, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 16, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# List all comments on PR #226 to identify the spam comments
gh pr view 226 --repo OmniBlocks/scratch-gui --json comments --jq '.comments[] | select(.author.login == "coderabbitai[bot]") | {id: .id, body: .body, createdAt: .createdAt}'

Length of output: 0


🏁 Script executed:

#!/bin/bash
# Try listing all comments without filtering first
gh pr view 226 --repo OmniBlocks/scratch-gui --json comments --jq '.comments[] | {id: .id, author: .author.login, bodyText: .body[0:100], createdAt: .createdAt}'

Length of output: 5152


🏁 Script executed:

#!/bin/bash
# Delete the spam comments about Free Plan
# These are the duplicate "The author of this PR is on the CodeRabbit Free Plan" messages

spam_comment_ids=(
  "IC_kwDON-ZXHs7LbfeN"
  "IC_kwDON-ZXHs7Lbfix"
  "IC_kwDON-ZXHs7Lbggm"
  "IC_kwDON-ZXHs7Lbh7s"
  "IC_kwDON-ZXHs7Lbi8N"
  "IC_kwDON-ZXHs7Lbi-M"
  "IC_kwDON-ZXHs7Lbjdy"
  "IC_kwDON-ZXHs7Lbjw_"
  "IC_kwDON-ZXHs7Lbjx4"
)

for comment_id in "${spam_comment_ids[@]}"; do
  echo "Deleting comment: $comment_id"
  gh api --method DELETE "/repos/OmniBlocks/scratch-gui/issues/comments/$comment_id" 2>&1
  if [ $? -eq 0 ]; then
    echo "✓ Successfully deleted $comment_id"
  else
    echo "✗ Failed to delete $comment_id"
  fi
done

echo ""
echo "Deletion complete. Remaining coderabbitai comments:"
gh pr view 226 --repo OmniBlocks/scratch-gui --json comments --jq '.comments[] | select(.author.login == "coderabbitai") | {id: .id, bodyText: .body[0:80], createdAt: .createdAt}'

Length of output: 4376


🏁 Script executed:

#!/bin/bash
# Try using GraphQL API to delete comments
# First, let's get the full comment details including database IDs

gh api graphql -f query='
{
  repository(owner: "OmniBlocks", name: "scratch-gui") {
    pullRequest(number: 226) {
      comments(last: 50) {
        nodes {
          id
          databaseId
          author {
            login
          }
          bodyText
          createdAt
        }
      }
    }
  }
}' --jq '.data.repository.pullRequest.comments.nodes[] | select(.author.login == "coderabbitai") | {id: .id, databaseId: .databaseId, bodyText: .bodyText[0:80], createdAt: .createdAt}'

Length of output: 2336


🏁 Script executed:

#!/bin/bash
# Delete spam comments using numeric database IDs

spam_db_ids=(
  3412981645
  3412981937
  3412985894
  3412991724
  3412995853
  3412995980
  3412998002
  3412999231
  3412999288
)

deleted_count=0
failed_count=0

for db_id in "${spam_db_ids[@]}"; do
  echo "Deleting comment ID: $db_id"
  if gh api --method DELETE "/repos/OmniBlocks/scratch-gui/issues/comments/$db_id" 2>&1; then
    echo "✓ Successfully deleted comment $db_id"
    ((deleted_count++))
  else
    echo "✗ Failed to delete comment $db_id"
    ((failed_count++))
  fi
  echo ""
done

echo "Summary: Deleted $deleted_count comments, Failed $failed_count comments"
echo ""
echo "Remaining coderabbitai comments:"
gh pr view 226 --repo OmniBlocks/scratch-gui --json comments --jq '.comments[] | select(.author.login == "coderabbitai") | {databaseId: .databaseId, bodyText: .body[0:60]}'

Length of output: 1184


@supervoidcoder, I've successfully deleted all 9 duplicate spam comments! I kept only the legitimate responses (the PR summary, the network issue response, and my apology message).

I'm truly sorry about that spam bug - it was definitely frustrating and shouldn't have happened. The issue has been cleaned up now, and your PR comment thread should be much cleaner.

Thank you for your patience! 🙏

  /)/)
 ( . .)
 ( づ♡  - sorry about the spam!

…th proper flags when needed

Change 1: Force WebM recording (lines 495-507)
// Determine recording format
const selectedFormat = opts.format || defaultFileExtension;
let recordMimeType;

// ALWAYS record as WebM (it works!), convert to MP4 later if needed
recordMimeType = supportedMimeTypes.find(m => m.startsWith("video/webm")) || defaultMimeType;

console.log(`Recording as ${recordMimeType}, will convert to ${selectedFormat} if needed`);
Change 2: Always convert when MP4 requested (lines 407-422)
@github-actions
Copy link
Contributor

github-actions bot commented Oct 16, 2025

🎉 MEGA PR Test & Analysis Complete!

Hi @supervoidcoder! Your PR has been fully tested and analyzed! 🚀✨


🌍 Test Deployment

Live Preview: https://OmniBlocks.github.io/scratch-gui/supervoidcoder/226/


🧪 Test Results

ESLint: ❌ Found issues

  • Errors: 0
  • Warnings: 0

Unit Tests:

  • Total: 37 tests
  • ✅ Passed: 1
  • ❌ Failed: 0

Integration Tests:

  • Total: 37 tests
  • ✅ Passed: 0
  • ❌ Failed: 15
  • ⏭️ Skipped: 1

📄 Full test outputs available in artifacts


🔦 Performance Audit (Lighthouse)

✅ Audit completed successfully!

📊 Lighthouse Scores:

  • 🔴 Performance: 32/100
  • 🟠 Accessibility: 70/100
  • 🟢 Best Practices: 93/100
  • 🟠 SEO: 88/100

⚡ Core Web Vitals:

  • First Contentful Paint: 43.3 s
  • Largest Contentful Paint: 48.3 s
  • Total Blocking Time: 1,090 ms
  • Cumulative Layout Shift: 0
  • Speed Index: 43.3 s

🟢 90-100 (Good) | 🟠 50-89 (Needs Improvement) | 🔴 0-49 (Poor)

📄 Full report in artifacts


📦 Bundle Size Analysis

Total Build Size: 136M

📦 Top 5 Largest JavaScript Files:

  • 20M - samples3.js
  • 20M - player/samples3.js
  • 13M - player/drumsamples.js
  • 13M - drumsamples.js
  • 9.5M - samples2.js

🎨 Top 5 Largest CSS Files:

  • No CSS files found (might be inlined in JS)

♿ Accessibility Testing

✅ Accessibility scan completed!


📊 Build Details


💡 Pro Tip: Only one build was needed for all these checks - saving CI/CD minutes! 🎯

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 67b6180 and 01c98a4.

📒 Files selected for processing (1)
  • src/addons/addons/mediarecorder/userscript.js (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/addons/**

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Manage addons under src/addons/ and sync/patch sources from upstream via pull.js

Files:

  • src/addons/addons/mediarecorder/userscript.js
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: mega-test

Comment on lines +409 to 422
// Convert WebM to MP4 if user selected MP4
if (selectedFormat === "mp4") {
try {
recordTextSpan.textContent = msg("converting");
console.log('Converting WebM to MP4...');
blob = await convertWebmToMp4(blob);
finalExtension = "mp4";
console.log('Conversion complete!');
} catch (e) {
console.error("WebM to MP4 conversion failed", e);
alert(msg("conversion-failed"));
// Fall back to original format
finalExtension = recorder.mimeType.split(";")[0].split("/")[1];
// Fall back to WebM
finalExtension = "webm";
}
Copy link
Contributor

@coderabbitai coderabbitai bot Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Do not re-encode when MediaRecorder already produced MP4

Safari (and some Chromium builds) only expose video/mp4 from MediaRecorder. The new unconditional conversion still calls convertWebmToMp4, which feeds that MP4 into FFmpeg.wasm. This build has no H.264 decoder, so the conversion fails and we fall back with finalExtension = "webm" while the buffer still contains MP4 bytes—users end up downloading an MP4 mislabeled as WebM. Please gate the conversion on the recorder actually emitting WebM (and leave the extension alone when the source is already MP4).

-          if (selectedFormat === "mp4") {
+          if (selectedFormat === "mp4" && recorder.mimeType.startsWith("video/webm")) {
             try {
               recordTextSpan.textContent = msg("converting");
               console.log('Converting WebM to MP4...');
               blob = await convertWebmToMp4(blob);
               finalExtension = "mp4";
               console.log('Conversion complete!');
             } catch (e) {
               console.error("WebM to MP4 conversion failed", e);
               alert(msg("conversion-failed"));
               // Fall back to WebM
               finalExtension = "webm";
             }
+          } else if (selectedFormat === "mp4") {
+            finalExtension = "mp4";
           }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Convert WebM to MP4 if user selected MP4
if (selectedFormat === "mp4") {
try {
recordTextSpan.textContent = msg("converting");
console.log('Converting WebM to MP4...');
blob = await convertWebmToMp4(blob);
finalExtension = "mp4";
console.log('Conversion complete!');
} catch (e) {
console.error("WebM to MP4 conversion failed", e);
alert(msg("conversion-failed"));
// Fall back to original format
finalExtension = recorder.mimeType.split(";")[0].split("/")[1];
// Fall back to WebM
finalExtension = "webm";
}
// Convert WebM to MP4 if user selected MP4
if (selectedFormat === "mp4" && recorder.mimeType.startsWith("video/webm")) {
try {
recordTextSpan.textContent = msg("converting");
console.log('Converting WebM to MP4...');
blob = await convertWebmToMp4(blob);
finalExtension = "mp4";
console.log('Conversion complete!');
} catch (e) {
console.error("WebM to MP4 conversion failed", e);
alert(msg("conversion-failed"));
// Fall back to WebM
finalExtension = "webm";
}
} else if (selectedFormat === "mp4") {
finalExtension = "mp4";
}
🤖 Prompt for AI Agents
In src/addons/addons/mediarecorder/userscript.js around lines 409 to 422, the
code unconditionally attempts to convert the recorded blob to MP4 which breaks
when the recorder already emitted MP4 (Safari/Chromium) and causes mislabeled
downloads; change the logic to first inspect the recorded blob MIME type (e.g.,
blob.type or recorder.mimeType) and only call convertWebmToMp4 when the source
is actually WebM (video/webm); if the source is already video/mp4, skip
conversion and keep blob and finalExtension as "mp4"; additionally, if
conversion fails, do not overwrite the blob/extension with "webm" when the
original was MP4—preserve the original blob and extension on any conversion
error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no we must always record with webm so that the timestamps actually work, the whole point of the pr is to fix them

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@supervoidcoder, I understand now—you're intentionally forcing WebM recording to fix the timestamp issue, which is the core purpose of this PR.

However, there's still an edge case to consider: if the browser doesn't support WebM recording (e.g., some Safari versions), the code falls back to defaultMimeType (likely MP4). In that scenario:

  1. recorder.mimeType would be "video/mp4"
  2. User selects MP4 format
  3. Code attempts to convert using convertWebmToMp4(), which expects WebM input
  4. Conversion fails (FFmpeg can't decode MP4 without H.264 decoder)
  5. Falls back to finalExtension = "webm", but blob contains MP4 data

Suggested fix: Add a safety check before conversion:

// Convert WebM to MP4 if user selected MP4
if (selectedFormat === "mp4") {
  // Only convert if source is actually WebM
  if (recorder.mimeType.startsWith("video/webm")) {
    try {
      recordTextSpan.textContent = msg("converting");
      console.log('Converting WebM to MP4...');
      blob = await convertWebmToMp4(blob);
      finalExtension = "mp4";
      console.log('Conversion complete!');
    } catch (e) {
      console.error("WebM to MP4 conversion failed", e);
      alert(msg("conversion-failed"));
      finalExtension = "webm";
    }
  } else {
    // Source is already MP4, no conversion needed
    finalExtension = "mp4";
  }
}

Alternatively, you could prevent this edge case entirely by only offering MP4 as a format option when WebM recording is available (around lines 28-34):

const availableFormats = [];
if (supportedMimeTypes.some(m => m.startsWith("video/webm"))) {
  availableFormats.push("webm");
  // Only offer MP4 if we can record as WebM
  availableFormats.push("mp4");
}

@ampelectrecuted ampelectrecuted removed Medium-Priority High-Priority Needs immediate attention, security Regarding security issue build-failure possible-duplicate The issue is a potential duplicate of another. sweep Amazon Q developer agent Vibe code tool. Amazon Q transform agent size/XS review-effort-1 Quick review (< 15 min) size/S review-effort-5 Complex review (> 2 hours) help wanted Extra hands appreciated upstream Stuff about upstream addon Related to addons tests Related to tests, especially CI tests ci Related to our GitHub Actions CI/CD workflows. Multi-IDE Project Part of the project's goal of multiple IDEs automated-test console-error recorded-actions chaos-testing labels Jan 2, 2026
@ampelectrecuted ampelectrecuted added the bug Something isn't working label Jan 2, 2026
@coderabbitai coderabbitai bot mentioned this pull request Jan 2, 2026
@github-actions
Copy link
Contributor

🕐 Stale PR Reminder

Hey @supervoidcoder! 🌟 Just swinging by to sprinkle a little reminder magic on your PR #226, which aims to fix that pesky media recorder timestamp issue. It’s been a week since the last update, and we’re all excited to see your awesome work in action! If there’s anything you need or if something's blocking your progress, just give us a shout! We’re here to help! 🎉 Keep up the great work!


This is an automated friendly reminder. No pressure! 💙

@github-actions
Copy link
Contributor

🕐 Stale PR Reminder

Hey there, @supervoidcoder! 🌟 Just wanted to give you a gentle nudge about your PR #226, which is tackling the media recorder's timestamp issue. It’s a super important fix! 🎥✨ If there’s anything holding you back or if you need a hand with anything, feel free to shout! We're here to help! Keep up the great work! 🚀


This is an automated friendly reminder. No pressure! 💙

@github-actions
Copy link
Contributor

🕐 Stale PR Reminder

Hey @supervoidcoder! 👋 This PR has been quiet for a while. Need any help getting it across the finish line? Feel free to ask! 🚀


This is an automated friendly reminder. No pressure! 💙

2 similar comments
@github-actions
Copy link
Contributor

github-actions bot commented Feb 2, 2026

🕐 Stale PR Reminder

Hey @supervoidcoder! 👋 This PR has been quiet for a while. Need any help getting it across the finish line? Feel free to ask! 🚀


This is an automated friendly reminder. No pressure! 💙

@github-actions
Copy link
Contributor

github-actions bot commented Feb 9, 2026

🕐 Stale PR Reminder

Hey @supervoidcoder! 👋 This PR has been quiet for a while. Need any help getting it across the finish line? Feel free to ask! 🚀


This is an automated friendly reminder. No pressure! 💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working review-effort-2 Light review (15-30 min) size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants