MediaSFU Kotlin Multiplatform
Essential next steps
- API and reference documentation
- Choose standard, hybrid, or fully headless UI
- Headless and hybrid implementation
- Starter projects and showcases
- Framework examples and recipes
- Current release and migration notes
- Troubleshooting and recovery
Build a shared MediaSFU room experience for Android and Apple targets from Kotlin. If you are building an Android-only app, use the Android guide instead; it uses the Android-specific publication from the same SDK source.
For isolated local development, a direct Cloud helper may use a restricted, revocable development credential that is never committed. Before sharing or releasing the app, move reusable Cloud credentials behind the production credential boundary.
Install
Use the shared artifact in commonMain:
commonMain.dependencies {
implementation("com.mediasfu:mediasfu-sdk:1.0.6")
}
The package needs mavenCentral() and targets Android plus iOS. Its Android side uses MediaSFU's mediasoup client as an implementation dependency; you normally do not add that low-level package yourself.
Copy/paste starter
MediasfuGeneric is the configurable Compose room. Choose a focused wrapper when its room shape fits your product:
import com.mediasfu.sdk.ui.mediasfu.MediasfuConference
import com.mediasfu.sdk.ui.mediasfu.MediasfuGenericOptions
@Composable
fun Meeting() {
MediasfuConference(
options = MediasfuGenericOptions(
localLink = "https://your-approved-mediasfu-server.example"
)
)
}
MediasfuConference, MediasfuWebinar, MediasfuBroadcast, and MediasfuChat are Compose wrappers around MediasfuGeneric. They select an event type; they do not replace your room-access policy.
Secure room access before release
The package's direct Cloud create/join option types include account fields. They can shorten isolated local development when used with a restricted test credential. Do not commit or distribute that value. For an external test or release, your app should request permission from its authenticated backend, then start the authorized session it returns.
For a self-hosted deployment, provide only the approved HTTPS endpoint through localLink, as in the example above.
Android requirements
For Android builds, declare and request camera and microphone permissions before enabling them:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
Test camera, microphone, audio route, background/foreground return, and screen capture on every device family you ship. Apple builds also need camera and microphone privacy descriptions.
Choose your level of control
- Use the supplied room UI for the shortest path.
- Pass
customVideoCard,customAudioCard, orcustomMiniCardto change individual rendered media cards. - Set
returnUI = falseand providecustomComponentwhen your app owns the entire workspace while MediaSFU runs the room workflow.
When you need exact generated declarations, open the Kotlin API reference.