diff --git a/examples/javascript/BodyPix/BodyPix_Webcam/sketch.js b/examples/javascript/BodyPix/BodyPix_Webcam/sketch.js index be85ac648..c5d789854 100644 --- a/examples/javascript/BodyPix/BodyPix_Webcam/sketch.js +++ b/examples/javascript/BodyPix/BodyPix_Webcam/sketch.js @@ -14,10 +14,11 @@ async function setup() { // create a canvas to draw to canvas = createCanvas(width, height); ctx = canvas.getContext('2d'); - // get the video - video = await getVideo(); // load bodyPix with video bodypix = await ml5.bodyPix(options) + // get the video + video = await getVideo(); + } // when the dom is loaded, call make(); @@ -86,4 +87,4 @@ function createCanvas(w, h){ canvas.height = h; document.body.appendChild(canvas); return canvas; -} \ No newline at end of file +}