diff --git a/apps/Finger drawing/app.js b/apps/Finger drawing/app.js index 34063ab..32281ac 100644 --- a/apps/Finger drawing/app.js +++ b/apps/Finger drawing/app.js @@ -4,8 +4,21 @@ let currentColor = 'black'; // Default color async function setupWebcam() { try { - const constraints = { video: { width: 640, height: 480 } }; - video.srcObject = await navigator.mediaDevices.getUserMedia(constraints); + // First list available devices to help with debugging + const devices = await navigator.mediaDevices.enumerateDevices(); + const videoDevices = devices.filter(device => device.kind === 'videoinput'); + console.log('Available video devices:', videoDevices); + + const constraints = { + video: { + width: 640, + height: 480 + } + }; + + const stream = await navigator.mediaDevices.getUserMedia(constraints); + video.srcObject = stream; + return new Promise((resolve) => { video.onloadedmetadata = () => { video.play(); @@ -13,7 +26,22 @@ async function setupWebcam() { }; }); } catch (err) { - console.error(err); + console.error('Webcam setup error:', err.name, err.message); + // Handle specific errors + switch (err.name) { + case 'NotAllowedError': + alert('Camera access was denied. Please check your browser permissions.'); + break; + case 'NotFoundError': + alert('No camera device was found. Please check your camera connection.'); + break; + case 'NotReadableError': + alert('Camera is in use by another application.'); + break; + default: + alert('Error accessing camera: ' + err.message); + } + throw err; } } diff --git a/apps/finger-draw.html b/apps/finger-draw.html new file mode 100644 index 0000000..82513a1 --- /dev/null +++ b/apps/finger-draw.html @@ -0,0 +1,327 @@ + + + + + + + Finger Drawing App + + + + + + + +
Status: Initializing...
+
Loading HandPose model...
+ +
+
+ Last spoken: +
+ Current color: black +
+ + +
+ +
+

Instructions

+
    +
  1. Allow access to your webcam when prompted
  2. +
  3. Point your index finger upwards to start drawing on the canvas
  4. +
  5. Speak a color (red, green, blue, yellow, orange, purple, black, white) to change the drawing color
  6. +
+
+ + + + diff --git a/apps/learn-javascript.html b/apps/learn-javascript.html index 94bb748..af23b18 100644 --- a/apps/learn-javascript.html +++ b/apps/learn-javascript.html @@ -2,54 +2,101 @@ - Turtle Graphics for 8th Graders + Learning JavaScript -

Welcome to Turtle Graphics Programming!

-

What shape would you like to program today?

+

A JavaScript Playground

+ +
+ -
- +
-
- - +
+ + + + + + +
- \ No newline at end of file +