Vectorly AI Filters Library

Vectorly AI Filters Library

Class

BackgroundFilter

new BackgroundFilter(input, params)

Return a webgl context based on the config

Parameters

  • input MediaStream | MediaStreamTrack | HTMLMediaElement

    Input to the BackgroundFilter; Either a MediaStream object from getUserMedia or a MediaStreamTrack which is a video track or a video tag

  • params object

    Properties

    • token string <optional>

      Token used to fetch models from server; Signup on Vectorly dashboard to get the token

    • background string <optional>
      https://files.vectorly.io/demo/videocall/virtual-background.png

      URL of background image to use; Set this to "blur" to use blurred background from the video

    • blurRadius number <optional>
      5

      Value of blur radius to use, typically set as a value between [1, 10];

    • debug boolean <optional>
      false

Methods

async

changeBackground(backgroundopt)

async changeBackground - Change the background used in the filter

Parameters

  • background string <optional>
    https://files.vectorly.io/demo/videocall/virtual-background.png

    URL of background image to use; Set this to "blur" to use blurred background from the video

async

changeBlurRadius(blurRadiusopt)

async changeBlurRadius - Change the radius to increase or decrease blur strength

Parameters

  • blurRadius Number <optional>
    5

    Value of blur radius to use, typically set as a value between [1, 10];

async

changeInput(input)

async changeInput - Change the input to the background filter

Parameters

  • input MediaStream | MediaStreamTrack | HTMLMediaElement

    Input to the BackgroundFilter; Either a MediaStream object from getUserMedia or a video tag

async

disable() → {MediaStream}

disable - Disables background filter processing. Returns input stream as a new MediaStream object

Returns

  • MediaStream

    Outputs the input MediaStream object with no filter applies

async

enable() → {MediaStream}

enable - Enables background filter processing. Returns processed output stream as a MediaStream object

Returns

  • MediaStream

    Outputs MediaStream object which is the processed input stream with the background filter applied

async

getOutput() → {MediaStream}

async getOutput - Get the output MediaStream

Returns

  • MediaStream

    Outputs MediaStream object which is the processed input stream with the background filter applied

async

getOutputTrack() → {MediaStreamTrack}

async getOutputTrack - Get the output MediaStreamTrack

Returns

  • MediaStreamTrack

    Outputs MediaStreamTrack object which is the processed input video track with the background filter applied