MediaSFU Unity SDK

June 8, 2026 ยท View on GitHub

MediaSFU Unity SDK is the Unity 2022.3+ C# SDK for building MediaSFU-powered video conferencing, live streaming, webinars, broadcast, screen sharing, chat, recording, whiteboard, and interactive 3D room experiences with MediaSFU Cloud or a self-hosted MediaSFU Open server.


MediaSFU Logo

Website Community Forum GitHub

License: MIT Unity 2022.3+ mediasoup WebRTC


MediaSFU Unity is the Unity SDK for creating, joining, and managing MediaSFU rooms from C# while keeping the scene, camera, UI, and rendering experience inside your Unity project.

Use this package when you want MediaSFU room orchestration in a Unity app, game, simulator, training tool, virtual event surface, or interactive 3D experience. The SDK handles room creation, room join flow, Socket.IO signaling, room state, moderation, recording controls, and transport orchestration.

Real audio, video, screen capture, encoding, decoding, and playback come from the companion com.mediasfu.mediasoup-client-unity package.

Package roles

  • com.mediasfu.unity: room orchestration, session state, and Unity-facing workflow.
  • com.mediasfu.mediasoup-client-unity: mediasoup/WebRTC bridge and native plugin integration.

Install

Install the packages through Unity Package Manager with Git URLs:

https://github.com/MediaSFU/mediasfu-mediasoup-client-unity.git
https://github.com/MediaSFU/mediasfu-unity-sdk.git

Then:

  1. Add com.mediasfu.mediasoup-client-unity.
  2. Add com.mediasfu.unity.
  3. Use MediaSfuClientOptions.BaseUrl only when you are targeting a self-hosted or custom backend.

When you develop from source, add each package from disk and open its package.json.

Cloud mode uses https://mediasfu.com/v1/rooms by default.

Quick start

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 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);
}

Media bridge

To enable microphone, camera, screen share, and remote playback, attach the companion media bridge with MediaSfuNativePluginWebRtcEngine.TryCreateWebRtcDevice(...) or provide your own IMediaSfuWebRtcEngine implementation.

Unity is a custom-scene integration path rather than a prebuilt meeting UI kit. Start with the sample flow to prove room connection and media, then build the in-scene controls and presentation that fit your product.

Documentation

Repository layout

  • Runtime/: C# contracts and SDK facade
  • Documentation~/: public API and native plugin contracts
  • Samples~/: starter guidance for the first room flow