Skip to content

fix: macOS webcam permission request and camera access not working#1

Merged
NewTurn2017 merged 2 commits intoNewTurn2017:mainfrom
rofeels:fix/macos-camera-permission
Mar 26, 2026
Merged

fix: macOS webcam permission request and camera access not working#1
NewTurn2017 merged 2 commits intoNewTurn2017:mainfrom
rofeels:fix/macos-camera-permission

Conversation

@rofeels
Copy link
Copy Markdown

@rofeels rofeels commented Mar 26, 2026

Summary

  • Add "camera" to setPermissionCheckHandler / setPermissionRequestHandler — without this, Electron silently blocks all getUserMedia({ video: true }) calls from the renderer
  • Add com.apple.security.device.camera, microphone, and audio-input entitlements to both entitlements.mac.plist and entitlements.mac.inherit.plist — required for Hardened Runtime signed builds
  • Add NSCameraUsageDescription to extendInfo in electron-builder.json5 and remove the misplaced com.apple.security.device.audio-input key from there

Root Cause

Signed builds with Hardened Runtime enforce entitlements strictly — any permission not declared is silently denied by macOS. In dev mode the app runs unsigned, so entitlements are never checked and the webcam worked fine. In production builds, the missing camera entitlement caused macOS to block the permission request entirely, so the app never appeared in System Settings › Privacy & Security › Camera.

Test plan

  • Build the app (npm run build:mac)
  • Reset TCC: tccutil reset Camera com.newturn2017.screencraft
  • Launch the app — camera permission dialog should appear
  • Check System Settings › Privacy & Security › Camera — ScreenCraft should be listed
  • Verify webcam overlay shows available camera devices

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Enabled camera, microphone, and audio input permissions on macOS, allowing the app to provide webcam overlay and audio capture capabilities.

NewTurn2017 and others added 2 commits March 26, 2026 15:35
- setPermissionCheckHandler/RequestHandler에 "camera" 권한 추가
- entitlements.mac.plist, inherit.plist에 camera/microphone/audio-input entitlement 추가
- electron-builder.json5에 NSCameraUsageDescription 추가 및 잘못된 extendInfo 키 제거

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3b42b251-0288-4cd8-9de4-0a47c5468c2a

📥 Commits

Reviewing files that changed from the base of the PR and between 0377ab7 and 13ff571.

📒 Files selected for processing (4)
  • build/entitlements.mac.inherit.plist
  • build/entitlements.mac.plist
  • electron-builder.json5
  • electron/main.ts

📝 Walkthrough

Walkthrough

These changes grant the macOS application runtime access to camera and microphone devices by adding corresponding entitlements to the app's plist configuration files, updating the build configuration with a camera usage description, and extending Electron's permission handler to allow camera access requests.

Changes

Cohort / File(s) Summary
macOS Entitlements
build/entitlements.mac.inherit.plist, build/entitlements.mac.plist
Added three new device access entitlements: com.apple.security.device.camera, com.apple.security.device.microphone, and com.apple.security.device.audio-input, each set to true.
Build Configuration
electron-builder.json5
Modified macOS extendInfo section: added NSCameraUsageDescription string describing camera access purpose for webcam overlay; removed com.apple.security.device.audio-input entry.
Electron Permission Handler
electron/main.ts
Extended the allowed permissions array in both setPermissionCheckHandler and setPermissionRequestHandler to include "camera" alongside existing "media", "audioCapture", and "microphone" permissions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Poem

🐰 A rabbit hopped through code so small,
Adding cameras one and all,
Microphones and audio rings,
Now the app can hear all things! 🎤📹

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main fix: enabling macOS webcam permission requests and camera access functionality.
Description check ✅ Passed The description includes clear motivation, root cause analysis, and a detailed test plan, though it lacks some template sections like Screenshots/Video and formal Type of Change checkbox.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@NewTurn2017 NewTurn2017 merged commit 08ba56f into NewTurn2017:main Mar 26, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants