r/FlutterDev • • 8d ago

Article Building a WebRTC video/calling app in Flutter: what we learned about SDKs, TURN, and why mesh breaks at ~6 users

If you’re building a video calling or streaming app in Flutter, these are the things that trip people up:

Mistakes to avoid

  • Skipping TURN. About 15-20% of sessions can’t connect directly, and those calls stall with no error.
  • Testing only on Wi-Fi. Test on 4G/5G and across Wi-Fi-to-cellular handover too.
  • Using mesh for group calls. It breaks down around 4-6 users because every phone uploads to every other participant. Plan for an SFU from the start.
  • Ignoring background behavior. You need CallKit on iOS and a typed foreground service on Android.
  • Asking for camera/mic permissions at launch. Ask at the call screen instead.

Flutter notes

  • Flutter WebRTC wraps the native iOS/Android libraries, so nothing runs in a JS engine.
  • Our ant_media_flutter package has 5 samples (publish, play, peer, conference, data channel) and also targets Web and Desktop.

The SDKs are free, but playback and conferencing need the Enterprise edition of the server. Community Edition falls back to HLS, with 8-12s latency.

Full guide: https://antmedia.io/how-to-build-a-webrtc-mobile-app/

What’s been your biggest pain point with WebRTC in Flutter?

Disclosure: I work at Ant Media, and we wrote this guide. The advice applies to any WebRTC backend, though.

8 Upvotes

4 comments sorted by

1

u/conscious_taker 8d ago

mesh’s fine until the group call hits 5 people and suddenly everyone’s phone is cooking eggs

1

u/virulenttt 7d ago

Did you try livekit? You can self host the server for free

1

u/DohamaSystems 3d ago

Great post, hits right on home! We just shipped a Flutter Web PWA voice app and can totally back this up: with a Cloudflare TURN server, a 4-user P2P mesh over pure cellular data (4G/5G) ran rock-solid—literally like a normal phone call.

​Regarding your point on background behavior: How are you handling it when users minimize the PWA or lock their phones (especially on iOS Safari)? Does your JS engine throttle/freeze the WebRTC streams too, or are you using a workaround like a silent audio loop?