Guide lengkap untuk menjalankan Hand Gesture Control sebagai desktop app dengan Electron.
Electron app HARUS di-build terlebih dahulu sebelum dijalankan karena:
- MediaPipe memerlukan webpack bundling
- ES6 modules perlu di-transpile
- Dependencies perlu di-bundle
# Build dan jalankan Electron
npm run electronIni akan:
- Build aplikasi dengan webpack (production mode)
- Jalankan Electron dengan hasil build
# Build development dan jalankan
npm run electron:devIni akan:
- Build aplikasi dengan webpack (development mode)
- Jalankan Electron dengan hasil build
- Include source maps untuk debugging
npm run build:winOutput: build/Hand Gesture Control Setup.exe
npm run build:macOutput: build/Hand Gesture Control.dmg
npm run build:linuxOutput: build/Hand Gesture Control.AppImage
npm run build:allSolution: Run build first
npm run build
npm run electronSolution: Already fixed! The app disables GPU acceleration automatically.
Possible Causes:
- Camera permission not granted
- Camera in use by another app
- Antivirus blocking camera access
Solutions:
- Check Windows camera permissions
- Close other apps using camera
- Temporarily disable antivirus
- Try running as administrator
Solution: Ensure internet connection for first run (downloads model)
For offline use:
- Download model manually: https://storage.googleapis.com/mediapipe-models/hand_landmarker/hand_landmarker/float16/1/hand_landmarker.task
- Place in
src/models/hand_landmarker.task - Enable offline mode in config
Solution:
- Check console for errors (F12)
- Ensure build completed successfully
- Try rebuilding:
npm run build
| Feature | Web Mode | Electron Mode |
|---|---|---|
| Installation | None | Build required |
| Performance | Good | Better |
| Offline | Limited | Full support |
| Camera Access | Browser permission | Auto-granted |
| Distribution | URL | Executable file |
| Updates | Instant | Manual/Auto-update |
Edit electron/main.js for:
- Window size
- GPU acceleration
- DevTools
- Permissions
Edit src/js/config/systemConfig.js for:
- Camera resolution
- MediaPipe settings
- Performance options
Electron automatically grants:
- ✅ Camera access
- ✅ Microphone access (if needed)
- ✅ File system access
No manual permission required!
- Close Other Apps: Free up system resources
- Good Lighting: Better detection = less CPU
- Lower Resolution: Edit config if needed
- Disable Visualization: If FPS is low
Enable DevTools in development:
Edit electron/main.js:
if (process.env.NODE_ENV === 'development') {
mainWindow.webContents.openDevTools();
}Run with:
set NODE_ENV=development
npm run electron- Windows: ~150MB
- macOS: ~180MB
- Linux: ~160MB
Includes:
- Electron runtime
- Chromium engine
- Node.js
- Your app code
- MediaPipe models
- Use asar compression (already enabled)
- Exclude dev dependencies
- Use electron-builder compression
To enable auto-updates:
- Setup update server
- Configure electron-updater
- Implement update UI
See electron-builder documentation for details.
- Create icons (see
assets/README.md) - Place in
assets/folder - Rebuild app
Edit electron/package.json:
{
"build": {
"productName": "Your App Name"
}
}- Requires Visual C++ Redistributable
- May trigger Windows Defender (first run)
- GPU acceleration disabled by default
- Requires code signing for distribution
- Notarization needed for Gatekeeper
- Camera permission prompt on first run
- AppImage is portable (no installation)
- May need to mark as executable
- Works on most distributions
If you encounter issues:
- Check this guide
- Check console errors (F12)
- Read
README.md - Open GitHub issue
Remember: Always run npm run electron (not electron electron/main.js directly)