Skip to main content

Quickstart

Use this page when the goal is to get a MediaSFU SDK integration running with the least amount of decision overhead.

Fastest path by SDK or platform

SDK or platformStart hereBest when
ReactJSReactJS SDKYou want the most direct web integration path.
AngularAngular SDKYou want Angular-native DI and wrappers.
React NativeReact Native SDKYou are shipping a bare RN app.
ExpoReact Native Expo SDKYou are on the Expo-managed workflow.
VueVue SDKYou want composition-friendly Vue integration.
FlutterFlutter SDKYou want one Dart codebase across mobile, web, desktop, or embedded surfaces.
Android / KotlinKotlin SDKYou want a native Android or Kotlin Multiplatform Compose-first room surface.
Apple / SwiftSwift SDKYou want a native Swift entry point for iOS, iPadOS, or macOS.
UnityUnity SDKYou want a Unity-owned scene, UI, and media presentation layer.
Sharedmediasfu-sharedYou are building your own wrapper or framework integration.

Native platform quick picks

  • Start with Kotlin SDK for native Android apps or Kotlin Multiplatform Compose surfaces.
  • Start with Swift SDK for native Apple-platform apps that present MediaSFU from SwiftUI or UIKit/AppKit flows.
  • Start with Unity SDK when the room experience belongs inside a Unity scene or interactive 3D product.
  • Start with Flutter SDK when you want one codebase to cover Android, iOS, web, desktop, and other Flutter targets.

Copy/paste starters

Use these when you need a working starter on the page itself instead of jumping out to another SDK guide first.

Android / Kotlin

Add the artifact:

dependencies {
implementation("com.mediasfu:mediasfu-sdk-android:1.0.1")
}

Mount the default room surface:

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import com.mediasfu.sdk.model.Credentials
import com.mediasfu.sdk.ui.mediasfu.MediasfuGeneric
import com.mediasfu.sdk.ui.mediasfu.MediasfuGenericOptions

class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MediasfuGeneric(
options = MediasfuGenericOptions(
credentials = Credentials("your_username", "your_api_key")
)
)
}
}
}

Apple / Swift

Add the Swift package:

https://github.com/MediaSFU/mediasfu-apple-sdk.git

Present the hosted room controller:

import MediaSFUAppleSDK

let bridge = MediaSFUIosHostBridge()
let config = bridge.makeLaunchConfig()

config.apiUserName = "your-api-username"
config.apiKey = "your-64-character-api-key"
config.localLink = ""
config.connectMediaSFU = true
config.userName = "alice"
config.roomName = "mediasfu-demo"
config.action = "create"
config.eventType = "conference"
config.durationMinutes = 60
config.capacity = 100
config.autoProceed = false
config.useModernUI = true
config.useModernTheme = true

let controller = bridge.makeHostViewController(config: config)
controller.modalPresentationStyle = .fullScreen
present(controller, animated: true)

Unity

Install com.mediasfu.mediasoup-client-unity first, then com.mediasfu.unity.

using MediaSFU.Unity;

var client = new MediaSfuClient(
new MediaSfuClientOptions
{
ConnectionMode = MediaSfuConnectionMode.Cloud,
Credentials = new MediaSfuCredentials
{
ApiUserName = "your-api-username",
ApiKey = "your-64-character-api-key"
}
}
);

var deviceResult = MediaSfuNativePluginWebRtcEngine.TryCreateWebRtcDevice(
new MediaSfuNativePluginWebRtcEngineOptions
{
EnableVerboseLogging = true
});

if (!deviceResult.Success)
{
UnityEngine.Debug.LogError(deviceResult.Detail);
return;
}

client.AttachWebRtcDevice(deviceResult.Value);

var join = await client.JoinRoomAsync(
new MediaSfuJoinRoomRequest
{
MeetingId = "s12345678",
UserName = "player-one",
IsLevel = "0"
}
);

if (!join.Success)
{
UnityEngine.Debug.LogError(join.Detail);
return;
}

var connect = await client.ConnectMediaAsync();
if (!connect.Success)
{
UnityEngine.Debug.LogError(connect.Detail);
}

Flutter

Install the package:

flutter pub add mediasfu_sdk

Mount the default room surface:

import 'package:flutter/material.dart';
import 'package:mediasfu_sdk/mediasfu_sdk.dart';

void main() => runApp(const MediaSFUExampleApp());

class MediaSFUExampleApp extends StatelessWidget {
const MediaSFUExampleApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
home: MediasfuGeneric(
options: MediasfuGenericOptions(
credentials: Credentials(
apiUserName: 'your_username',
apiKey: 'your_api_key',
),
),
),
);
}
}

For ReactJS, Angular, React Native, Expo, and Vue, use the matching SDK page when you need the framework-specific starter because those pages already include their package install and first-render path.

Native capability map

Use this table when the question is not just "how do I start?" but "how far can I take this SDK before I need a different path?"

SDKFastest room pathApp-owned setup or prejoinApp-owned room shellTargeted UI customization pathGo deeper
FlutterPrebuilt MediasfuGeneric roomYes, with noUIPreJoinOptionsCreate or noUIPreJoinOptionsJoinYes, with returnUI: false and customComponentYes, with uiOverridesFlutter SDK and MediaSFU sandbox links from that page
KotlinPrebuilt Compose room wrappersYes, by pairing returnUI = false with your own Compose entry flowYes, through onParametersUpdate and customComponentUse Compose component replacement patterns from the Kotlin SDK guideKotlin SDK
SwiftHosted room controller from SwiftYes, with autoProceed = true and your own setup screen before presenting the controllerUse your own setup flow, then present the hosted controller for the room itselfUse your own app UI around the hosted controller rather than an override mapSwift SDK and the Apple SDK repository linked there
UnityScene-owned client integrationYes. Your app or game owns room setup before JoinRoomAsyncYes. Unity owns the scene, layout, and interaction layer around the client and media backendUse your Unity scene and UI composition rather than an override mapUnity SDK and the Unity SDK API contract linked there

Next step by native intent

  • If you want a Flutter app to keep MediaSFU runtime logic but own the visible workspace, go next to Headless mode, Custom component replacement, and then Flutter SDK.
  • If you want a Kotlin app to keep the Compose-native path but own the room shell, go next to Headless mode, Custom component replacement, and then Kotlin SDK.
  • If you want a Swift app to own the setup screen but still present MediaSFU's hosted room controller, stay on the Swift SDK path and use its autoProceed = true flow.
  • If you want a Unity app or game to keep the whole experience scene-owned, stay on the Unity SDK path and treat the SDK client plus attached media backend as room infrastructure inside your own scene architecture.

Advanced native snippets

These are the higher-control paths already documented on the current native SDK pages.

Flutter headless workspace handoff

MediasfuGeneric(
options: MediasfuGenericOptions(
credentials: credentials,
returnUI: false,
updateSourceParameters: (parameters) {
setState(() => sourceParameters = parameters);
},
),
)

Use this when Flutter should own the visible workspace while MediaSFU still owns room runtime, state, and media helpers.

Kotlin app-owned Compose shell

var parameters by remember { mutableStateOf<MediasfuParameters?>(null) }

MediasfuGeneric(
options = options.copy(returnUI = false),
onParametersUpdate = { parameters = it }
)

Use this when your Compose app should render its own room shell around MediaSFU state and actions.

Swift app-owned setup before room presentation

let bridge = MediaSFUIosHostBridge()
let config = bridge.makeLaunchConfig()

config.action = "join"
config.roomName = "s1234567"
config.userName = "guest1"
config.autoProceed = true

let controller = bridge.makeHostViewController(config: config)
present(controller, animated: true)

Use this when your Apple app owns the setup screen and hands users into the hosted MediaSFU room only after your own app flow is complete.

Native usage examples beyond first render

These are the main public examples already available across the current native SDK pages.

  • Flutter: prebuilt room, local UI/demo mode, headless runtime with MediasfuParameters, direct create/join helpers, uiOverrides, and full customComponent workspace examples.
  • Kotlin: prebuilt Compose room, returnUI = false handoff through onParametersUpdate, and customComponent replacement examples.
  • Swift: hosted controller launch, no-UI create/join entry flow with autoProceed = true, and bridge-triggered audio/video/screen-share actions.
  • Unity: room join flow, explicit media backend attachment, and scene-owned media/runtime integration through the Unity client plus native WebRTC backend.

Deeper native resources

  • Flutter: use the Flutter SDK for headless runtime, direct room helper calls, uiOverrides, customComponent, and sandbox links.
  • Kotlin: use the Kotlin SDK for Compose-first room wiring, app-owned UI handoff, and custom room-surface patterns.
  • Swift: use the Swift SDK, the Apple SDK repository it links to, and the native mediasoup client repository for package-level details and native media bridge context.
  • Unity: use the Unity SDK, its linked SDK repository, and its API contract for scene integration and media backend details.

Native-safe production pattern

Across Flutter, Kotlin, Swift, and Unity, the production rule is the same even when the app wiring differs:

  1. Keep MediaSFU credentials off the client whenever the app is not meant to hold them directly.
  2. Put create and join behind a secure backend proxy when you need production-safe room lifecycle control.
  3. Validate the stock or fastest room flow first.
  4. Only then move into app-owned setup, custom workspaces, or scene-owned integration.

Minimum sequence

  1. Install the package or artifact from the matching SDK page.
  2. Choose cloud or self-hosted backend mode.
  3. Put a secure backend proxy in front of production create/join flows.
  4. Validate the first working path with the prebuilt/default integration.
  5. Only after that, move to headless mode or UI overrides.

Guardrails

  • Do not start with heavy customization before a baseline join flow works.
  • Do not ship frontend-held MediaSFU production credentials.
  • Use the SDK page for package-specific caveats, dependencies, and platform setup.
  • Test real-time features such as translation, whiteboard, screen share, and reconnect behavior in the app environments you plan to support.
  • For native mobile and Unity paths, validate media permissions and capture behavior on real target devices, not only simulators or editor previews.