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(), orroom.setVideoEffects()in a room, with aVideoEffectsConfigwhosebackgroundmode isVideoEffectsBackgroundMode.BLUR. On Android, addcom.google.mlkit:segmentation-selfie:16.0.0-beta6to your app'sbuild.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 callroom.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

