Recordly icon indicating copy to clipboard operation
Recordly copied to clipboard

macOS: Cursor telemetry not saved after DMG install (Apple Silicon, macOS 26)

Open JoshCork opened this issue 8 months ago • 9 comments

Bug Description

After installing Recordly v1.1.7 via the DMG on macOS 26.2 (Apple Silicon M3), cursor telemetry .cursor.json files are not being created alongside recordings. The editor shows "No cursor telemetry available — Record a screencast first to generate cursor-based suggestions."

Environment

  • OS: macOS 26.2 (Build 25C56) — Apple Silicon (M3 MacBook Pro)
  • Recordly version: v1.1.7 (DMG install to /Applications/Recordly.app)
  • Permissions granted: Screen Recording ✅, Accessibility ✅
  • Quarantine flags: Cleared via xattr -cr

Reproduction Steps

  1. Install Recordly v1.1.7 via DMG
  2. Grant Screen Recording and Accessibility permissions in System Settings
  3. Record a screencast (any duration, tried multiple 30s+ recordings)
  4. Open recording in editor
  5. Click the zoom suggestions / wand button
  6. See toast: "No cursor telemetry available"

Evidence

Recordings made with npm run dev (dev build) do produce .cursor.json files. Recordings made with the DMG-installed app do not.

# Recordings WITH cursor.json (dev build, same machine, same day):
recording-1774718957877.mp4.cursor.json  (1.5MB, ~10:35am)
recording-1774719579103.mp4.cursor.json  (1.5MB, ~10:45am)
recording-1774743781164.mp4.cursor.json  (77KB,  ~5:23pm)

# Recordings WITHOUT cursor.json (DMG install, 7pm onward):
recording-1774749616308.mp4  ← no .cursor.json
recording-1774750149033.mp4  ← no .cursor.json
recording-1774750394518.mp4  ← no .cursor.json
recording-1774751693887.mp4  ← no .cursor.json

The cursor.json files that exist from the dev build look correct:

{
  "version": 2,
  "samples": [
    { "timeMs": 1, "cx": 0.462, "cy": 0.940, "interactionType": "move", "cursorType": "arrow" }
  ]
}

Analysis

After reviewing the source code, the cursor telemetry flow is:

  1. Recording start (set-recording-state handler, handlers.ts:3901) → starts 33ms interval sampling via sampleCursorPoint()
  2. Recording stop (handlers.ts:3916) → calls snapshotCursorTelemetryForPersistence() to move activeCursorSamples → pendingCursorSamples
  3. Finalization (finalizeStoredVideo(), handlers.ts:2604) → calls persistPendingCursorTelemetry() which writes videoPath + ".cursor.json"
  4. Editor load (VideoEditor.tsx:1740) → reads the .cursor.json file via get-cursor-telemetry IPC handler

Likely root causes (in order of probability):

1. persistPendingCursorTelemetry() fails silently or never runs At handlers.ts:2575-2585, there is no try-catch around the fs.writeFile() call. If the write fails (permissions, path issue, etc.), the error propagates up through finalizeStoredVideo() which also lacks error handling at line 2610. However, since the recording itself saves successfully, the error may be swallowed somewhere upstream or the function may not be called at all in the DMG build's code path.

2. activeCursorSamples is empty when recording stops If sampleCursorPoint() never executes during recording (interval not starting, or getNormalizedCursorPoint() returning null), then snapshotCursorTelemetryForPersistence() exits early at line 2588 because activeCursorSamples.length === 0, and no file is written.

3. DMG build uses different app data path The dev build stores data in ~/Library/Application Support/Recordly-dev/ while the DMG uses ~/Library/Application Support/Recordly/. If there's a path resolution mismatch for the cursor file write (e.g., currentVideoPath doesn't match where the recording was actually saved), the .cursor.json could be written to the wrong location or fail.

4. Native cursor monitor binary fails to spawn in DMG context The startNativeCursorMonitor() function at handlers.ts:2257 spawns the bundled openscreen-native-cursor-monitor binary. While cursor position sampling uses Electron's getScreen().getCursorScreenPoint() (which should work regardless), the overall cursor capture initialization could be affected if the native monitor spawn throws and isn't caught properly.

5. uiohook native module not rebuilt for DMG Electron version The interaction capture (startInteractionCapture()) uses uiohook-napi for mouse click events. If this native module wasn't properly rebuilt for the DMG's Electron version, it could cause cursor capture to fail at initialization.

Suggested Fix

Add error handling around persistPendingCursorTelemetry() in finalizeStoredVideo(), and add diagnostic logging to identify where the pipeline breaks:

// handlers.ts:2604
async function finalizeStoredVideo(videoPath: string) {
  const validation = await validateRecordedVideo(videoPath)
  snapshotCursorTelemetryForPersistence()
  currentVideoPath = videoPath
  currentProjectPath = null
  
  try {
    await persistPendingCursorTelemetry(videoPath)
  } catch (error) {
    console.error('Failed to persist cursor telemetry:', error)
    // Don't let telemetry failure break video finalization
  }
  
  // ...
}

And add logging in snapshotCursorTelemetryForPersistence():

function snapshotCursorTelemetryForPersistence() {
  console.log(`[cursor] snapshot: ${activeCursorSamples.length} active samples`)
  if (activeCursorSamples.length === 0) {
    console.warn('[cursor] No active cursor samples to snapshot')
    return
  }
  // ...
}

Workaround

Running via npm run dev from source (~/Source/recordly) produces cursor telemetry correctly on the same machine. DMG install does not.

JoshCork avatar Mar 29 '26 02:03 JoshCork

Root Cause Found

The cursor telemetry issue is a downstream symptom of an ffmpeg permission error.

Error Chain

  1. node_modules/ffmpeg-static/ffmpeg lacks execute permission after npm install --ignore-scripts
  2. Audio muxing fails: spawn ffmpeg EACCES
  3. validateRecordedVideo() fails because the MP4 can't be decoded (audio mux produced no output)
  4. finalizeStoredVideo() throws at the validation step (line ~2611)
  5. persistPendingCursorTelemetry() is never reached — cursor data is lost

Fix

chmod +x node_modules/ffmpeg-static/ffmpeg

Suggested Code Fix

finalizeStoredVideo() should persist cursor telemetry before video validation, or at minimum wrap validation in a try-catch so telemetry isn't lost when validation fails:

async function finalizeStoredVideo(videoPath: string) {
  // Persist cursor telemetry FIRST — don't let validation failures lose cursor data
  snapshotCursorTelemetryForPersistence()
  currentVideoPath = videoPath
  currentProjectPath = null
  
  try {
    await persistPendingCursorTelemetry(videoPath)
  } catch (error) {
    console.error('[cursor] Failed to persist telemetry:', error)
  }

  // Validation can fail without losing telemetry
  const validation = await validateRecordedVideo(videoPath)
  // ...
}

Also, the postinstall.mjs script should ensure ffmpeg has execute permissions after install, or --ignore-scripts users should be warned.

Console Output Confirming the Chain

Failed to mux native macOS audio into capture: Error: spawn .../ffmpeg EACCES
Failed to stop native ScreenCaptureKit recording: Error: Recorded output could not be decoded: .../recording.mp4
    at validateRecordedVideo (main.js:843)
    at finalizeStoredVideo (main.js:2611)

JoshCork avatar Mar 29 '26 02:03 JoshCork

Confirmed Fix

Symlinking node_modules/ffmpeg-static/ffmpeg to Homebrew's /opt/homebrew/bin/ffmpeg resolves the issue completely. Cursor telemetry, auto-zoom suggestions, and audio muxing all work.

Root Cause (refined)

The ffmpeg-static npm package bundles an unsigned ffmpeg binary that cannot be ad-hoc signed (codesign returns "invalid or unsupported format for signature"). macOS 26 (Tahoe) blocks execution of unsigned binaries, producing Unknown system error -88 at spawn time.

Workaround

# Install ffmpeg via Homebrew (if not already installed)
brew install ffmpeg

# Replace the broken npm binary with a symlink
mv node_modules/ffmpeg-static/ffmpeg node_modules/ffmpeg-static/ffmpeg.broken
ln -s /opt/homebrew/bin/ffmpeg node_modules/ffmpeg-static/ffmpeg

Suggested Permanent Fix

Consider one of:

  1. Prefer system ffmpeg — check which ffmpeg before falling back to ffmpeg-static
  2. Ad-hoc sign during postinstall — though this specific binary resists signing
  3. Switch to @ffmpeg-installer/ffmpeg or another package that ships properly signed binaries
  4. Document macOS 26+ requirement for Homebrew ffmpeg in dev setup

Environment

  • macOS 26.2 (Tahoe), Apple Silicon M3
  • Recordly v1.1.7 (dev build via npm run dev)
  • Homebrew ffmpeg 8.0.1

JoshCork avatar Mar 29 '26 03:03 JoshCork

Awesome input Josh, did you try the 119 version already? and see if those issue are persistent?

Litemint09 avatar Mar 30 '26 10:03 Litemint09

the macOS 26 unsigned binary rejection thing bit us too. we build a screen capture SDK and initially tried bundling ffmpeg for encoding, but the codesigning requirements on Tahoe made it unreliable. switched to using VideoToolbox's VTCompressionSession for H.265 encoding directly - no child process to spawn, no permission issues, and the hardware encoder on Apple Silicon is basically free. biggest gotcha was getting the pixel format right from the ScreenCaptureKit output - kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange works but you need to match the color space or you get washed out colors in the output.

m13v avatar Mar 30 '26 22:03 m13v

fwiw here's how we handle the VideoToolbox encoding pipeline for screen capture: https://github.com/m13v/macos-session-replay/blob/main/Sources/SessionReplay/VideoChunkEncoder.swift - the chunked encoding approach means you can write segments to disk continuously without keeping everything in memory.

m13v avatar Mar 30 '26 22:03 m13v

@m13v Thanks for the context on VideoToolbox — that makes a lot of sense. Dropping ffmpeg entirely and going straight to VTCompressionSession avoids the unsigned binary problem altogether on Tahoe. Good tip on the pixel format matching with kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange — that's a subtle one.

@Litemint09 I was on v1.1.7 (both DMG and dev build). Haven't tried 1.1.9 yet — I'll give it a shot and report back. The Homebrew ffmpeg symlink workaround is solid for now on the dev build.

For what it's worth, the core issue chain was: unsigned ffmpeg binary blocked by macOS 26 → audio mux fails → validateRecordedVideo() throws → finalizeStoredVideo() never reaches persistPendingCursorTelemetry() → cursor data lost. Even if the ffmpeg issue gets solved, it might be worth reordering finalizeStoredVideo() to persist cursor telemetry before validation so one failure doesn't cascade into the other.

JoshCork avatar Mar 30 '26 23:03 JoshCork

Willing to accept PRs :)

webadderall avatar Mar 31 '26 12:03 webadderall

Original issue fixed

webadderall avatar Apr 01 '26 05:04 webadderall

nice, might put one together for the codesign path. the key fix for macOS 26 is signing the binary with a Developer ID before bundling it into the DMG, then running notarytool submit and stapling the ticket. happy to document the exact flow if that would be useful.

m13v avatar Apr 04 '26 01:04 m13v