Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
virtual-bg
Advanced tools
Readme
Install from npm using:
npm install virtual-bg
or include directly in HTML:
<script src="https://cdn.jsdelivr.net/npm/virtual-bg@latest/virtual-bg.min.js"></script>
<div>
<video autoplay="true" id="inputVideoElement"></video>
<canvas id="output_canvas"></canvas>
</div>
import { segmentBackground, applyBlur, applyImageBackground } from'virtual-bg';
const inputVideoElement = document.querySelector('#inputVideoElement');
const outputCanvasElement = document.querySelector('#output_canvas');
let myStream = await navigator.mediaDevices.getUserMedia({
video: true
});
inputVideoElement.srcObject = myStream;
// segments foreground & background
segmentBackground(inputVideoElement, outputCanvasElement);
// applies a blur intensity of 7px to the background
applyBlur(7);
// applies an image background
const image = new Image();
image.src = 'https://imageurl.jpg'
applyImageBackground(image);
segmentBackground(inputVideoElement, outputCanvasElement, modelSelection <optional>);
Parameters:
inputVideoElement
: <HTMLVideoElement> Source of video which is to be used for applying segmentation.outputCanvasElement
: <HTMLCanvasElement> Canvas Element where output is to be displayed.modelSelection
: Numerical value to select type of model to be used for segmentation. applyBlur(blurIntensity <optional>);
Parameters:
blurIntensity
: Numerical value in pixels to apply a blur filter to the background. This uses the same filter as used in CSS blur filterapplyImageBackground(imageElement);
Parameters:
imageElement
: <HTMLImageElement> Image element to be set as background. You can create a new element dynamically using the Image() constructor.applyVideoBackground(videoElement);
Parameters:
videoElement
: <HTMLVideoElement> Video element to be set as background.applyScreenBackground(screenCaptureStream);
Parameters:
screenCaptureStream
: <MediaStream> Stream obtained from the Screen Capture APIAn example use case for this can be when user has set screen capture as the background and want to present something.
changeForegroundType(foregroundType, offset<optional>);
Parameters:
foregroundType
: normal | presenter
Type of foreground. Presenter mode shrinks the foreground and displays it in the bottom right corner.offset
: Numerical value in pixels for setting custom offset when presenter mode is selected.Note: I'm using mediapipe's selfie segmentation model and library as a base.
For any doubts/feedback/suggestions, please start an issue/discussion at https://github.com/akhil-rana/virtual-bg or contact me at contact@akhilrana.com
FAQs
Easily add virtual background effects to your video/camera input inside any web browser
The npm package virtual-bg receives a total of 55 weekly downloads. As such, virtual-bg popularity was classified as not popular.
We found that virtual-bg demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.