Skip to main content

Virtual Background

With a virtual background, you gain the flexibility to modify your background by blurring it, applying solid colors, or incorporating custom images. This capability allows for personalization and customization of your video environment, enabling you to create a more tailored visual experience.

In this section, we will walk you through the process of adding a custom virtual background to your RealtimeKit meetings.

warning

This might affect performance since it uses BitmapVideoFilter which requires additional processing power to apply the filters over the video stream.

Installation

You can add the pre-packaged filters to your project by adding the following dependency to your build.gradle file:

dependencies {
// (other dependencies)
implementation 'com.cloudflare.realtimekit:filters:+'
}

Usage

This package currently exposes VirtualBackgroundVideoFilter which can be used with FilterVideoProcessor.

// Create a virtual background filter with a custom background image.
val bgFilter = VirtualBackgroundVideoFilter(context, R.drawable.background)

// Initialize the video processor with the filter.
val processor = FilterVideoProcessor(eglBase, bgFilter)

// Pass it to the video processor.
val meeting = RealtimeKitMeetingBuilder
.setVideoProcessor(eglBase, processor)
.build(activity)