nimeet Docs
中文

Windows SDK Guide

Windows C++ SDK install, join, render and platform notes.

Interface sections generated from the public SDK definitions

Version v1.1.0 · Updated 2026-10-26 · revision 1

Windows (C++) has the IRtcEngine + IRtcEngineEventHandler shape: initialize → joinChannel → callbacks drive everything. Desktop capture supports three modes: by window id, by screen region and by display id.

Prerequisites

  • Visual Studio 2022 (MSVC v143), CMake 3.25+, Windows 10 1809+.
  • Camera/microphone permission at runtime (in Windows, "Privacy & security → Camera / Microphone").
  • You already have an appId and a token service (see Enable services and get credentials).

Install

text
# planned vcpkg port (not published yet)
vcpkg install nimeet-rtc:x64-windows
# or add sdk/windows directly as a subdirectory CMake project
add_subdirectory(sdk/windows)
target_link_libraries(your_app PRIVATE nimeet::rtc)

Get a token

The client must not hold customerSecret. In production the host program runs a backend service that issues tokens, and the C++ side only receives a string; during development you can keep the token in an environment variable, but do not compile it into the binary.

Join a channel

cpp
#include "nimeet/rtc/IRtcEngine.h"

class Handler : public IRtcEngineEventHandler {
 public:
  void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) override {
    // Join succeeded
  }
  void onUserJoined(uid_t uid, int elapsed) override { /* allocate the remote video */ }
  void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) override { /* release the video */ }
  void onTokenPrivilegeWillExpire(const char* token) override { /* call renewToken after refreshing the token */ }
  void onError(int err, const char* msg) override { /* route by error number */ }
};

Handler handler;
IRtcEngine* engine = createAgoraRtcEngine();
RtcEngineContext context;
context.appId = app_id;
context.eventHandler = &handler;
engine->initialize(context);

engine->setChannelProfile(CHANNEL_PROFILE_LIVE_BROADCASTING);
engine->enableVideo();

VideoCanvas canvas;
canvas.view = local_hwnd;
engine->setupLocalVideo(canvas);
engine->startPreview();

engine->joinChannel(token, "weekly-sync", "", 10001);

joinChannel also has an overload taking ChannelMediaOptions& (to specify the role, subscription scope and publish source); for the complete signatures see the API reference for this platform.

Publish and subscribe

cpp
engine->muteLocalAudioStream(true);   // mute the microphone
engine->muteLocalVideoStream(true);   // turn off the local video
engine->enableLocalVideo(false);      // stop capture
engine->updateChannelMediaOptions(options);

Screen sharing:

cpp
IScreenCaptureSourceList* sources = engine->getScreenCaptureSources({160, 90}, {32, 32}, true);
// share by window
Rectangle region{0, 0, 0, 0};
ScreenCaptureParameters params;
params.frameRate = 15;
engine->startScreenCaptureByWindowId(window_id, region, params);

Events

IRtcEngineEventHandler has 88 callbacks. The most commonly used: onJoinChannelSuccess, onUserJoined, onUserOffline, onFirstRemoteVideoDecoded, onTokenPrivilegeWillExpire, onError, onConnectionStateChanged.

Error handling

  • Synchronous methods return int: 0 means success, and a negative value is an Agora error number.
  • onError(int err, const char* msg) provides a readable message; log both.
  • Unimplemented capabilities return -4 (ERR_NOT_SUPPORTED).

Troubleshooting

SymptomCauseHandling
initialize returns a non-zero valueInvalid App ID, or already initializedInitialize only once; check the appId
Joining returns -2Invalid channel name or uidChannel name [A-Za-z0-9_-], uid a positive number
The local preview is blackThe canvas.view handle is invalidWait until the window has been created before setupLocalVideo
A crash on the callback threadCross-thread UI accessMarshal back to the main thread
Capture failsThe system camera privacy switch is offTurn it on in System Settings and restart the process

Next steps

Platform information

Itemvalue
PlatformWindows(C++)
LanguageC++
SDK packagenimeet_rtc_win
Interface version4.7.0
Compatible Agora APIAgora windows API

The public interfaces are aligned with the Agora windows API; installation and runtime requirements are listed under Prerequisites above.

Availability

This platform's SDK: Generally available. The examples use the public API; runtime capability follows the published SDK package.

join-channel flow

The method names, parameter types and return values match the API reference for the same platform. Where a method has several overloads, the most common one is shown here; see the API reference for all overloads.

StepInterfaceMethodOverload count
Create instance / initializeILocalSpatialAudioEngineinitialize1
subscribe to remote mediaILocalSpatialAudioEnginemuteRemoteAudioStream1
Renew the TokenIMusicContentCenterrenewToken1
enable video and local previewIRtcEngineenableVideo1
Join a channelIRtcEnginejoinChannel2
Leave a channelIRtcEngineleaveChannel2
Channel scenariosIRtcEnginesetChannelProfile1
switch rolesIRtcEnginesetClientRole2
bind the local videoIRtcEnginesetupLocalVideo1
typescript
initialize(config: const LocalSpatialAudioConfig&): int
muteRemoteAudioStream(uid: uid_t, mute: bool): int
renewToken(token: const char*): int
enableVideo(): int
joinChannel(token: const char*, channelId: const char*, info: const char*, uid: uid_t): int
leaveChannel(): int
setChannelProfile(profile: CHANNEL_PROFILE_TYPE): int
setClientRole(role: CLIENT_ROLE_TYPE): int
setupLocalVideo(canvas: const VideoCanvas&): int

Events and callbacks

Callbacks are registered on IRtcEngineEventHandler; naming differs by platform, and the full list is in the API reference for the same platform.

CallbacksSignaturePurpose
onConnectionStateChangedonConnectionStateChanged(state: CONNECTION_STATE_TYPE, reason: CONNECTION_CHANGED_REASON_TYPE): voidjoin result / connection-state changes:update the UI accordingly and decide whether to reconnect.
onUserJoinedonUserJoined(uid: uid_t, elapsed: int): voidRemote user joined:allocate the frame container.
onFirstRemoteVideoDecodedonFirstRemoteVideoDecoded(uid: uid_t, width: int, height: int, elapsed: int): voidRemote video status:it can render once the first frame is decoded.
onUserOfflineonUserOffline(uid: uid_t, reason: USER_OFFLINE_REASON_TYPE): voidRemote user left:release the container and subscription.
onRequestTokenonRequestToken(): voidToken expiring soon:call the server to renew, then `renewToken`.
onErroronError(err: int, msg: const char*): voidRuntime errors:`err` is an Agora error number, route by the error-code table.
onNetworkQualityonNetworkQuality(uid: uid_t, txQuality: int, rxQuality: int): voidNetwork quality:report to Analytics or prompt the user.

Error codes

Constantvalue
ERR_ABORTED20
ERR_ADM_GENERAL_ERROR1005
ERR_ADM_INIT_PLAYOUT1008
ERR_ADM_INIT_RECORDING1011
ERR_ADM_START_PLAYOUT1009
ERR_ADM_START_RECORDING1012
ERR_ADM_STOP_PLAYOUT1010
ERR_ADM_STOP_RECORDING1013
ERR_ALREADY_IN_USE19
ERR_BIND_SOCKET13
ERR_BITRATE_LIMIT115
ERR_BUFFER_TOO_SMALL6
ERR_CANCELED11
ERR_CLIENT_IS_BANNED_BY_SERVER123
ERR_CONNECTION_INTERRUPTED111
ERR_CONNECTION_LOST112
ERR_DATASTREAM_DECRYPTION_FAILED122
ERR_DECRYPTION_FAILED120
ERR_ENCRYPTED_STREAM_NOT_ALLOWED_PUBLISH130
ERR_FAILED1
ERR_INIT_NET_ENGINE21
ERR_INVALID_ARGUMENT2
ERR_INVALID_CHANNEL_NAME102
ERR_INVALID_STATE8
ERR_INVALID_TOKEN110
ERR_INVALID_USER_ID121
ERR_JOIN_CHANNEL_REJECTED17
ERR_LEAVE_CHANNEL_REJECTED18
ERR_LOAD_MEDIA_ENGINE1001
ERR_NET_DOWN14
ERR_NOT_INITIALIZED7
ERR_NOT_IN_CHANNEL113
ERR_NOT_READY3
ERR_NOT_SUPPORTED4
ERR_NO_PERMISSION9
ERR_NO_SERVER_RESOURCES103
ERR_OK0
ERR_PCMSEND_BUFFEROVERFLOW201
ERR_PCMSEND_FORMAT200
ERR_REFUSED5
ERR_RESOURCE_LIMITED22
ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED119
ERR_SIZE_TOO_LARGE114
ERR_STREAM_MESSAGE_TIMEOUT117
ERR_TIMEDOUT10
ERR_TOKEN_EXPIRED109
ERR_TOO_MANY_DATA_STREAMS116
ERR_TOO_OFTEN12
ERR_VDM_CAMERA_NOT_AUTHORIZED1501

the platform REST layer uses REST error codes;the SDK layer maps connection/authentication failures to Agora error numbers, for the mapping table see SDK error identifiers per platform。

Generated by the documentation build pipeline · 2026-10-31 01:24:02 UTC · Documentation center v1.1.0.

Content follows the public API definitions.

ni-meet is a self-hosted RTC PaaS with a LiveKit-based media plane (Apache-2.0) and an Agora-compatible API.