Request the user to start their webcam stream var video= document.querySelector(“#videoElement”); if(navigator.mediaDevices.getUserMedia){ navigator.mediaDevices.getUserMedia({ video: true }) .then(function (stream) { video.srcObject = stream; }) .catch(function (error) { console.log(“Error streaming”); }); } Using the getUserMedia() API which allows you to access a user’s camera and mic without any plugins Streams have inputs (video) and outputs (video) The if-conditional checks if the getUserMedia is supported Syntax: navigator.mediaDevices.getUserMedia(constraints).then(successCallback).catch(errorCallback) The
SailorMoon Pose Signup/Login #machinelearning
Took me a day to finish the above + read on posenet and have it running on a local server. My webcam on my laptop isn’t all that great but should suffice for the time being. Below are steps for the project so far: Use getUserMedia method of the web media API to detect a webcam and get permission from the user to stream video
51-100 #javascript interview questions
Writing a book with Packt
Amidst a global pandemic (Covid- 19), I will be sitting quietly like a farm mouse and write a book with a publisher called Packt. The book will be focused on JavaScript interview questions in the form of practical coding questions.
forEach( ), sort( ) and filter( ) for newbies
forEach() ES6 has introduced the forEach() method which allows you to loop through an array. Arrays as you may already know are of the type ‘object’. In contrast to the string,number,boolean, undefined and symbol types which are primitive data types. For example if we console.log the typeof operator to find the typeof array, objectwill be logged, as seen below: const yummies = [‘Ice-cream’,’Cupcake’,’Donut’,’Cupcake’]; console.log(typeof yummies)//
Easy Peasy Git for Github with clix
Original Question asked by student Is there a way to show that folder structure in git? I’m struggling to visualize how it looks in git and how we would push that structure to git. Are there instructions for how to create the structure on our computers then push it to git? Answer Git is a version control tool. For example when you write an essay
JavaScript filter()
Part of my “Functional JavaScript” programming notes Syntax: let newArray = Oldarray.filter(callback(element, index, array)); Explanation: The filter method returns a new array from the filtered items from the oldArray Items are filtered according to some condition To do so a callback function is used The callback function takes 3 arguments: element: The current element index: the index of the current element array: the old array
Browser Snapchat Clone
Not sure why I never updated my blog with that but last summer I coded a browser based SnapChat clone. Oh! so much fun. It’s been coded by using JavaScript and a face tracking library called tracking.js NOTE: for whatever reason the code doesn’t work for you is mostly like (95%) because of a cross browser compatibility issue. I’ve tested this on IE, Chrome and
Sweet & Sour mongoose.js methods – 3
A short snippet to assist in linking of social media accounts in a userschema when using mongoDB & mongoose.js async function generateOrFindUser(accessToken, refreshToken, profile, done) { const email = profile.emails[0].value; const name = profile.displayName || profile.username; const facebookId = profile.id; if (email) { let updatedUser = await User.findOneAndUpdate({facebookId},{email,name,facebookId}, {‘upsert’: true, ‘new’: true}, done); } else { var emailError = new Error(“Your email privacy settings prevent
Sailormoon Pose Recognition decisions
In October I will be working on pose recognition signup/login using tensorflow.js (during my free’ time which means the time remaining from my free time which is already being used up to make a unity3d project). This means knowing what decisions to take very early on. The project is till now loosely defined as in “pose recognition” only implies that you can signup and