Skip to main content
Version: 0.1.x

MediaEffects library - Android

Introduction

  • The MediaEffects library enhances video applications with advanced media effects, including virtual backgrounds. It supports real-time processing and is optimized for Android devices.

  • The MediaEffects library offers three classes to customize your video background: using a custom image, applying a blur effect, or choosing a solid color.

info

The Virtual Background feature in VideoSDK can be utilized regardless of the meeting environment, including the pre-call screen.

1. BackgroundImageProcessor

  • BackgroundImageProcessor sets a specified image as the background in a video stream, allowing you to customize the visual appearance of the video.

  • BackgroundImageProcessor class provides following method.

    • setBackgroundSource() method updates the virtual background by setting a new image as the background that the user wants to switch to.

      • Parameters: Uri: An image URI for the background image.

      • Return Type: void

val uri = Uri.parse("https://st.depositphotos.com/2605379/52364/i/450/depositphotos_523648932-stock-photo-concrete-rooftop-night-city-view.jpg")
val backgroundImageProcessor = BackgroundImageProcessor(uri) // Sets the background image

val newUri = Uri.parse("https://img.freepik.com/free-photo/plant-against-blue-wall-mockup_53876-96052.jpg?size=626&ext=jpg&ga=GA1.1.2008272138.1723420800&semt=ais_hybrid")
backgroundImageProcessor.setBackgroundSource(newUri) // Changed background image

2. BackgroundBlurProcessor

  • BackgroundBlurProcessor applies a blur effect to the video background, with the intensity controlled by a float value, creating a softened visual effect.

  • BackgroundBlurProcessor class provides following method.

    • setBlurRadius() method adjusts the blur effect on the video background, with the blur strength controlled by the specified float value.

      • Parameters: Float: representing the blur strength; higher values mean stronger blur. The supported range is 0 to 25.

      • Return Type: void

val backgroundBlurProcessor = BackgroundBlurProcessor(25, this) // Applies a blur with intensity 25
backgroundBlurProcessor.setBlurRadius(17) // Changes the blur intensity to 17

3. BackgroundColorProcessor

  • BackgroundColorProcessor sets a solid color as the video background using a Color object, enabling you to create a uniform color backdrop for your video.

  • BackgroundColorProcessor class provides following method.

    • setBackgroundColor() method sets the color that user wants to switch to, for virtual background effect.

      • Parameters: Integer: Specifies the color for the virtual background.
      • Return Type: void
val backgroundColorProcessor = BackgroundColorProcessor(Color.BLUE) // Sets the background color to blue
backgroundColorProcessor.setBackgroundColor(Color.CYAN) // Changes the background color to CYAN

Got a Question? Ask us on discord