Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
DeepAR Web is an augmented reality SDK that allows users to integrate advanced, Snapchat-like face lenses in the browser environment.
DeepAR Web supports:
❗ DeepAR Web requires an internet connection.
In order to use the DeepAR Web SDK you need to set up a license key for your web app on developer.deepar.ai.
⚠️ Note that license key is only required when deploying to production (non-localhost) domain.
Using npm
:
$ npm install deepar
Using yarn
:
$ yarn add deepar
We recommend using a bundler to correctly include assets like DeepAR effects files.
For example, if using Webpack, add this to your webpack.config.js
:
module.exports = {
// ...
module: {
rules: [
{
include: [
path.resolve(__dirname, 'effects/'),
],
type: 'asset/resource',
},
],
},
// ...
DeepAR requires a canvas element for the preview of camera, masks, filters and effects. You can add it directly in the HTML.
<canvas width="1280" height="720"></canvas>
Or you can create it in Javascript.
const canvas = document.createElement("canvas");
canvas.width = 1280;
canvas.height = 720;
⚠️ Note: Be sure to set
width
andheight
properties of thecanvas
!
Or you can create it in Javascript.
let canvas = document.createElement("canvas");
Note: Be sure to set
width
andheight
properties of thecanvas
!
There are two main ways to get deepar.js in your JavaScript project: via script tags or by installing it from NPM and using a build tool like Parcel, WebPack, or Rollup.
Add the following code to an HTML file:
<html>
<head>
<!-- Load deepar.js -->
<script src="https://cdn.jsdelivr.net/npm/deepar/js/deepar.js"> </script>
<script>
const deepAR = await deepar.initialize({
licenseKey: 'your_license_key_here',
canvas: document.getElementById('deepar-canvas'),
effect: 'https://cdn.jsdelivr.net/npm/deepar/effects/aviators'
});
</script>
</head>
<body>
<canvas width="1280" height="720" id="deepar-canvas"></canvas>
</body>
</html>>
Add deepar.js to your project using yarn or npm.
Note: Because we use ES2017 syntax (such as import), this workflow assumes you are using a modern browser or a bundler/transpiler to convert your code to something older browsers understand. However, you are free to use any build tool that you prefer.
import * as deepar from 'deepar';
import deeparEffect from './effects/effectFile'
const deepAR = await deepar.initialize({
licenseKey: 'your_license_key_here',
canvas: document.getElementById('deepar-canvas'),
effect: deeparEffect
});
All filters are represented by effect files in DeepAR. You can load them to preview the effect.
Places you can get DeepAR effects:
Load an effect using the switchEffect
method:
deepAR.switchEffect('path/to/effect/alien');
Take a screenshot.
const image = await deepAR.takeScreenshot();
Shoot a video.
deepAR.startVideoRecording();
// Video is now recording...
// When user is ready to stop recording.
const video = await deepAR.finishVideoRecording();
DeepAR will by default use the user facing camera. It will also ask the camera permission from the user.
Use the back camera on the phones:
const deepAR = await deepar.initialize({
// ...
additionalOptions: {
cameraConfig: {
facingMode: 'environment'
}
}
});
Set up your own camera or custom video source:
const deepAR = await deepar.initialize({
// ...
additionalOptions: {
cameraConfig: {
disableDefaultCamera: true
}
}
});
// HTMLVideoElement that can contain camera or any video.
const video = ...;
deepAR.setVideoElement(video, true);
Initialize DeepAR but start the camera later. This is used when you do not want to ask the camera permission right away.
const deepAR = await deepar.initialize({
// ...
additionalOptions: {
cameraConfig: {
disableDefaultCamera: true
}
}
});
// When you want to ask the camera permission and start the camera.
await deepAR.startCamera();
Please see: https://developer.deepar.ai/customer-agreement
FAQs
The official DeepAR Web SDK
The npm package deepar receives a total of 234 weekly downloads. As such, deepar popularity was classified as not popular.
We found that deepar demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.