Skip to main content

Flutter Compact Call Tutorial

Build a mobile call with mediasfu_sdk@2.4.1. The supplied room gives you a join screen, people list, microphone, camera, screen sharing where supported, remote media, leave, and host end.

Prerequisites​

  • Flutter 3.38.1 or newer plus Android Studio or Xcode.
  • An HTTPS endpoint in your signed-in app that provides /api/mediasfu/create-room and /api/mediasfu/join-room.
  • Camera and microphone permissions in the Android and iOS projects.

Project files​

Use the complete Flutter starter app. It includes the complete pubspec.yaml, lib/main.dart, lib/room_backend.dart, and lib/scenarios.dart files. It starts with Compact call selected and forwards only MediaSFU room payloads to your application backend.

flutter create my_mediasfu_app
cd my_mediasfu_app

For an isolated local test, the starter accepts a short-lived app token. It is not a MediaSFU credential. Replace that temporary input with your normal signed-in session before distributing the app; reusable MediaSFU credentials remain only in the authenticated backend.

Run​

cd my_mediasfu_app
flutter pub get
flutter run

Expected result​

Choose Compact call, enter the HTTPS app-backend address and an app session token, then create or join. Two devices can see the participant list and test microphone, camera, screen sharing, leave, and host end.

Recovery​

  • Return to app sign-in after authorization is rejected; do not retry with a Cloud key.
  • Leave the person connected when capture permission is denied and let them retry that device control.
  • Check the device audio route and the other person's microphone before reconnecting for silent audio.

Cleanup​

Use Leave for one person and End only for the authorized room action. Clear app-owned room state, timers, and subscriptions after exit; the backend expires authority by policy.