Skip to main content
Version: 5.x.x

Virtual Background - Flutter

caution

The videosdk_media_effects plugin does not work with Flutter SDK v5.0.0. It depends on videosdk_webrtc, which you must remove when you upgrade to v5.0.0.

Use these instead:

  • Background blur: call VideoSDK.setVideoEffects(), or room.setVideoEffects() in a room, with a VideoEffectsConfig whose background mode is VideoEffectsBackgroundMode.BLUR. On Android, add com.google.mlkit:segmentation-selfie:16.0.0-beta6 to your app's build.gradle. On iOS, blur needs iOS 15 or later.
  • Background image: on iOS, pass the image's file path or URL to room.setVideoProcessor(), and call room.removeVideoProcessor() to remove it. Android has no built-in background image.
final applied = await VideoSDK.setVideoEffects(
const VideoEffectsConfig(
background: VideoEffectsBackground(mode: VideoEffectsBackgroundMode.BLUR),
),
);

if (applied?['applied'] != true) {
debugPrint("Blur is not running: ${applied?['reason']}");
}

setVideoEffects() works before and after you join. Send the whole configuration each time: an effect you leave out goes back to its default, so setVideoEffects(const VideoEffectsConfig()) turns blur off. To learn more, see Video Effects.

For the other changes in v5.0.0, see the migration guide.

API Reference​

Got a Question? Ask us on discord


Was this helpful?

Not helpfulHelpful