Skip to main content
srtcNet follows the same call order as C++, just in idiomatic C#: events are events, tracks are returned as strongly typed objects, and the engine/channel implement IDisposable. There are two layers:
  • SrtcEngine—process-wide, one is enough. Creates and leaves channels, enumerates devices, IM, log upload
  • SrtcChannel—one per meeting: member queries, tracks, publishing/subscribing, local recording

Initialize the SDK

EnableLog = 0 (or passing null) turns the SDK file log off. Init returns null on failure; read engine.LastErrorMessage to diagnose.

Register engine-level events

Only callbacks that belong to no channel live here: device changes, default device changes, network probe, IM. Everything else is on SrtcChannel.

Join a channel

Two steps: CreateChannel only creates the object without joining; configure it, then call Join(). As in C++, register the events before Join()—Joined fires synchronously while Join() is still running.
UserStreamAdded only covers tracks published after you joined. For users who were already publishing, walk their stream_tracks in the Joined event’s MembersJson and subscribe explicitly.

Open the camera and publish

Local tracks must be StartCaptured before Publish; the order matters. Publish has a video and an audio overload—pass SrtcAudioPublishOptions to publish audio.

Open the microphone and publish

Play the channel audio mix (hear everyone)

Remote audio is fetched with an empty uid and track id to get the channel-wide mix. After StartPlay you hear everyone, with no explicit subscribe:

Render remote video

For window rendering use the built-in SrtcHwndView(handle). To render into your own surface, derive from SrtcView and override MakeCurrent (GetViewType returns SrtcViewType.CallBack). A SrtcView must be removed from every track (RemovePlayView) before it is disposed, or the render thread may touch a freed object.

Screen sharing

In EnumScreen(), Type == 5 is a monitor and Type == 0 is a window. For window capture set DeviceId to the Hwnd; for monitor capture set the X/Y/Width/Height rectangle.

Leave the channel

After SrtcChannel.Dispose() every track it handed out is immediately invalid (remote and custom tracks are deleted natively). On exit, detach views from tracks (RemovePlayView) first, then dispose the channel, then release the view objects.

Events and threading

  • Except for Joined (raised synchronously on the calling thread inside Join()), all events arrive on SDK internal threads—marshal to your UI thread yourself (e.g. WinForms BeginInvoke)
  • SrtcEngine.Init makes the native side initialize on an STA thread, so calling it from an ordinary .NET thread (MTA by default) also works
  • Common strongly typed event args: SrtcUserStreamEventArgs (Uid / StreamJson), SrtcJoinedEventArgs (ChannelJson / MeJson / MembersJson / OptionsJson), SrtcCustomMessageEventArgs (Action / SenderId / Name / Message)
For a complete runnable example see the WinForms demo (3x3 grid with device pickers, paging, and IM).