npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cutout-video-sdk

v0.1.7

Published

cutout-video-sdk

Downloads

7

Readme

Installing

Using npm:

$ npm install cutout-video-sdk

Using CDN:

<script src="https://d38b044pevnwc9.cloudfront.net/cutout-nuxt/videoMatting/cutout-video-sdk.0.1.3.js"></script>

Usage

Constructor:

PicupVideoCutout(token, background, options, useMicrophone)

  • token: User needs to get authorized token from cutout.pro business, whose email is [email protected]. The officail site is https://www.cutout.pro
  • background: The video background is replaced by the specified image.
  • options: Other options, for example '{ width: 1280, height: 720 }' can be used to constrain the video width and height

Constructor Sample:

import PicupVideoCutout from 'cutout-video-sdk';
...

new PicupVideoCutout(token) //Initialize a video stream that return the original video stream from camera
new PicupVideoCutout(token, "blur") //Initialize a video stream that can make a blur background effect
new PicupVideoCutout(token, "https://d38b044pevnwc9.cloudfront.net/cutout-nuxt/videoMatting/bgimg_big_1.jpg") //Initialize a video stream that the video background is replaced by the specified image
new PicupVideoCutout(token, '', { width: 1280, height: 720 }) //Initialize a video stream with specified video width and height. The local camera should also support the specified video width and height
new PicupVideoCutout(token, "transparent") //Initialize a video stream that can make a transparent background effect
new PicupVideoCutout(token, 'transparent', {}, true) //Initialize a stream with video and audio

token

Full code sample

Following code shows a sample that use a video tag to show the cutout video stream

let customStreamVideo = document.getElementById('customStreamVideo');
let token = "xxx";
let background = "https://d38b044pevnwc9.cloudfront.net/cutout-nuxt/videoMatting/bgimg_big_1.jpg";
//let background = "blur";

let picupVideoBgSwapTest = new PicupVideoCutout(token, background);
picupVideoBgSwapTest.getOutputStream().then((videoSource) => {
    console.log('picupVideoBgSwapTest-1', videoSource)
    customStreamVideo.srcObject = videoSource
    customStreamVideo.play()
}).catch(function(err) {
    console.log('picupVideoBgSwapTest-err', err, err.name, err.message);
});

Following code shows a sample how to return a canvas, and you can do something with this canvas

let returnCanvas = picupVideoBgSwapTest.captureCanvas()

let newCanvas = document.createElement('canvas')
let newCanvasCtxs = newCanvas.getContext( '2d' );
newCanvas.width = returnCanvas.width
newCanvas.height = returnCanvas.height
newCanvas.drawImage(returnCanvas, 0, 0, newCanvas.width, newCanvas.height);

Other functions

changeBackground(newBackground):

'blur' is a special value for blurring the background

let background = "https://d38b044pevnwc9.cloudfront.net/cutout-nuxt/videoMatting/bgimg_big_2.jpg"
picupVideoBgSwapTest.changeBackground(background)

disable():

Temporarily stop the video processing

picupVideoBgSwapTest.disable()

enable():

Enable the video processing

picupVideoBgSwapTest.enable()

stop():

Permanently stop video processing

picupVideoBgSwapTest.stop()

requestFrameRate(rate):

Change the video frame rate

let rate = 30
picupVideoBgSwapTest.requestFrameRate(rate)

captureCanvas():

Get canvas object

picupVideoBgSwapTest.captureCanvas()