##introduction selfiebg.js is a small script that injects and allows you to use the users web cam and streaming media as a video background to your website, kinda letting you allow your users to make the site their own
selfiebg.js is built on a module reveal pattern exposing three (3) core methods.
- setup()
- start()
- stop()
selfiebg.js is an IIFE (immediately-invoked function expression) and executes the setup() method on load, simply include the file at the bottom of your html page before the closing body tag
/* ** @description include selfiebg.js or selfiebg.min.js */ <script src="selfiebg.min.js"></script> </body>
you can set the boolean value of button_require, by default it is set to false setting the boolean value to true creates a button that allows the user to terminate the user media stream by invoking the stop() method
Below is a quick screengrab of the script running once the user allows the sharing of their camera (yep, it's a pitcure of me)
view the example file for more information. or check out the live example here