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 uploadSrtcChannel—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
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
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. AfterStartPlay 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
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
Events and threading
- Except for
Joined(raised synchronously on the calling thread insideJoin()), all events arrive on SDK internal threads—marshal to your UI thread yourself (e.g. WinFormsBeginInvoke) SrtcEngine.Initmakes 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)