This error can have multiple causes. Follow these steps:
Steps:
- Open DevTools: Press F12 in browser
- Go to Console tab
- Look for error messages starting with
Hand tracking setup error: - Screenshot or note the exact error message
Common errors you might see:
TypeError: Cannot read property 'createDetector'→ Model loading issueNotAllowedError: Permission denied→ Camera permission not grantedNotFoundError: Requested device not found→ No camera connectedWebGL is not supported→ Browser doesn't support WebGL
Chrome/Edge:
- Click the lock icon 🔒 in address bar
- Find "Camera" setting
- Select "Allow"
- Refresh page
Firefox:
- Click lock icon 🔒 in address bar
- Set Camera to "Allow for this site"
- Refresh page
Safari:
- Settings → Privacy → Camera
- Find website and allow
- Refresh page
Run this in browser console (F12 → Console):
// Check WebGL support
const canvas = document.createElement('canvas');
const webgl = canvas.getContext('webgl') || canvas.getContext('experimental-webgl');
console.log('WebGL supported:', !!webgl);
// Check TensorFlow
console.log('TensorFlow:', typeof tf);Expected output:
WebGL supported: true
TensorFlow: object
If WebGL is false, try a different browser or enable WebGL in settings.
Windows:
- Open Camera app (built-in)
- Test if camera works
- Close Camera app before using browser
- Refresh browser page
Reason: Only one app can use the camera at a time
Camera access requires:
- ✅ HTTPS (secure connection)
- ✅ Localhost (127.0.0.1)
- ❌ Plain HTTP (http://, not https://)
Check your URL:
- ✅ http://localhost:5173 → OK
- ✅ https://yourdomain.com → OK
- ❌ http://192.168.x.x:5173 → NOT allowed
If hand detection fails:
- Click Keyboard button on Snake Game page
- Use Arrow Keys to control snake
- Works perfectly as alternative
If error mentions @mediapipe or cdn.jsdelivr.net:
Run in console:
fetch('https://cdn.jsdelivr.net/npm/@mediapipe/hands@0.4.1/wasm')
.then(r => r.ok ? console.log('✓ CDN accessible') : console.log('✗ CDN error:', r.status))
.catch(e => console.log('✗ Network error:', e.message));If error:
- Check internet connection
- Try different WiFi/network
- Corporate firewall might block CDN
| Browser | WebGL | Camera | Status |
|---|---|---|---|
| Chrome | ✅ | ✅ | Fully supported |
| Edge | ✅ | ✅ | Fully supported |
| Firefox | ✅ | ✅ | Fully supported |
| Safari | ✅ | Limited WebGL | |
| Opera | ✅ | ✅ | Fully supported |
If Safari: May need to enable WebGL in Develop menu
Once initialized successfully:
- Good lighting - well-lit room is important
- Clear background - plain background works best
- Hand fully visible - palm facing camera
- Steady movement - slow, deliberate gestures
- Minimum distance - index finger must point ~2 inches from wrist
Hand positions:
- 👆 Point UP = Snake moves UP
- 👉 Point RIGHT = Snake moves RIGHT
- 👇 Point DOWN = Snake moves DOWN
- 👈 Point LEFT = Snake moves LEFT
- Hard refresh page: Ctrl+Shift+R (Windows) or Cmd+Shift+R (Mac)
- Clear browser cache: DevTools → Application → Clear Storage
- Try different browser: Chrome if using Firefox, etc.
- Restart computer: Sometimes system needs restart
- Use keyboard mode: Works perfectly as fallback ✅
Before asking for help, verify:
- Camera permissions granted
- Camera not in use by other app
- Using localhost or HTTPS
- Browser console shows debug logs (check for
✓marks) - WebGL is supported
- Tried keyboard mode (works?)
- Hard refresh page (Ctrl+Shift+R)
- Using supported browser (Chrome/Edge/Firefox)
Paste in browser console (F12 → Console) to debug:
// Test 1: Check all APIs
console.log('--- API Check ---');
console.log('getUserMedia:', !!navigator.mediaDevices?.getUserMedia);
console.log('TensorFlow:', typeof tf !== 'undefined');
console.log('WebGL:', !!document.createElement('canvas').getContext('webgl'));
// Test 2: Request camera with logs
console.log('--- Requesting camera ---');
navigator.mediaDevices.getUserMedia({ video: true })
.then(stream => {
console.log('✓ Camera access granted');
stream.getTracks().forEach(t => t.stop());
})
.catch(err => console.log('✗ Camera error:', err.name, err.message));
// Test 3: Check MediaPipe availability
console.log('--- MediaPipe Check ---');
console.log('MediaPipe Hands:', typeof handPoseDetection !== 'undefined');If hand tracking never works on your device:
- Always use Keyboard Mode
- Arrow keys control snake perfectly
- No camera needed
- Better for privacy anyway!
Check browser console for exact error message and share:
- Error message (copy from console)
- Browser type and version
- Operating system
- Whether camera works in other apps
- Whether you granted permissions