Socket
Socket
Sign inDemoInstall

@telnyx/video-processors

Package Overview
Dependencies
2
Maintainers
10
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @telnyx/video-processors

Telnyx Video Processors JavaScript Library


Version published
Weekly downloads
0
decreased by-100%
Maintainers
10
Created
Weekly downloads
 

Readme

Source

Telnyx Video Processors

Telnyx Video Processors is a collection of video processing tools which can be used with Telnyx Video JavaScript SDK to apply transformations and filters to a VideoTrack.

   See it live here!

Features

The following Video Processors are provided to apply transformations and filters to a person's background.

Prerequisites

  • Node.js (v14+)
  • NPM (v6+, comes installed with newer Node versions)

Installation

NPM

You can install directly from npm.

yarn add @telnyx/video-processors

Using this method, you can import @telnyx/video-processors like so:

Applying a background image in video

import { VideoProcessor, Camera } from '@telnyx/video-processors';

let videoElement = document.getElementById('video');
let canvasElement = document.getElementById('canvas');

const videoProcessor = new VideoProcessor();

const image = new Image(1280, 720);
image.src = './mansao.webp';

window.navigator.mediaDevices
  .getUserMedia({ video: true, audio: false })
  .then((stream) => {
    videoElement.srcObject = stream;
    videoElement.play().then(async () => {
      const { camera, canvasVideoTrack } =
        await videoProcessor.createVirtualBackgroundStream({
          videoElementId: videoElement.id,
          canvasElementId: 'canvas',
          frameRate: 20,
          image: image,
        });
      videoElement.srcObject = new MediaStream([canvasVideoTrack]);

      await camera.start();
    });
  });

Applying a background blur in video

import { VideoProcessor, Camera } from '@telnyx/video-processors';

let videoElement = document.getElementById('video');
let canvasElement = document.getElementById('canvas');

const videoProcessor = new VideoProcessor();

window.navigator.mediaDevices
  .getUserMedia({ video: true, audio: false })
  .then((stream) => {
    videoElement.srcObject = stream;
    videoElement.play().then(async () => {
      const { camera, canvasVideoTrack } =
        await videoProcessor.createGaussianBlurBackgroundStream({
          videoElementId: videoElement.id,
          canvasElementId: canvasElement.id,
          frameRate: 20,
          blurAmount: 10,
        });
      videoElement.srcObject = new MediaStream([canvasVideoTrack]);

      await camera.start();
    });
  });

Test Demo

Run yarn build Copy /lib folder into examples/ folder Navigate to examples/ folder Run npx lite-server Access the lite-server URL e.g. http://localhost:3***

Keywords

FAQs

Last updated on 05 Jul 2022

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc