Skip to content

Commit a8d6092

Browse files
committed
Ex19 - Corrections
1 parent c2f7b6b commit a8d6092

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

19 - Webcam Fun/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
<canvas class="photo"></canvas>
3636
<video class="player"></video>
37-
<div class="strip"></div>
3837
</div>
38+
<div class="strip"></div>
3939

4040
<audio class="snap" src="http://wesbos.com/demos/photobooth/snap.mp3" hidden></audio>
4141

19 - Webcam Fun/scripts.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,19 @@ function getVideo() {
2121

2222
//every 16ms (60fps), take a screenshot from the webcam and paint it on the canvas
2323
function paintToCanvas() {
24-
const width = video.videoWidth; // different de video.width ? taille de la video, et non pas de l'élément <video> ?
24+
const width = video.videoWidth; // different de video.width ? taille de la video, et non pas de l'�l�ment <video> ?
2525
const height = video.videoHeight;
2626
canvas.width = width;
2727
canvas.height = height;
2828
// return in case we need to stop the painting
2929
return setInterval(() => {
3030
ctx.drawImage(video, 0, 0);
3131

32-
//recupération des pixels de l'image pour faire des trucs funky
32+
//recuperation des pixels de l'image pour faire des trucs funky
3333
let pixels = ctx.getImageData(0, 0, width, height);
3434
//Array : r,g,b,alpha,r,g,b,alpha, etc. 4 entries in the array for each pixel
3535
//let's mess with the pixels
36-
pixels = redEffect(pixels);
36+
// pixels = redEffect(pixels);
3737

3838
// pixels = rgbtSplit(pixels);
3939

@@ -47,12 +47,12 @@ function takePhoto() {
4747
snap.currentTime = 0; //rewind sound every time
4848
snap.play();
4949
// get the data from the canvas. data will be a base64 string
50-
const data = canvas.getDataURL('image/jpeg');
50+
const data = canvas.toDataURL('image/jpeg');
5151
// create the download link for the snapshot
5252
const link = document.createElement('a');
5353
link.href = data;
5454
link.setAttribute('download', 'handsome'); //name of the file
55-
link.innerHTML = `<img src="${data}" alt="handsome me"`;
55+
link.innerHTML = `<img src="${data}" alt="handsome me"/>`;
5656
// insert the link
5757
strip.insertBefore(link, strip.firstChild);
5858
}

0 commit comments

Comments
 (0)