nimeet Docs
中文

macOS SDK Guide

Install, join a channel, screen capture and platform notes.

Interface sections generated from the public SDK definitions

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

The macOS platform shares the AgoraRtcEngineKit / AgoraRtcEngineDelegate shape with iOS; the difference is desktop capture: the capture source can be pinned by "display id" or "window id", and it requires the system screen-recording permission plus the matching entitlement.

Prerequisites

  • Xcode 16+, a macOS 12+ deployment target.
  • Add NSCameraUsageDescription and NSMicrophoneUsageDescription to Info.plist; screen sharing must be authorised in "System Settings → Privacy & Security → Screen Recording".
  • If App Sandbox is enabled, you need com.apple.security.device.camera, com.apple.security.device.audio-input and com.apple.security.device.screen-capture.
  • You already have an appId and a token service (see Enable services and get credentials).

Install

ruby
# Podfile (planned coordinate; not published yet)
pod 'NimeetRtc', :path => '../sdk/ios', :subspecs => ['macOS']

Get a token

As on iOS: tokens are issued by the backend and injected by the client through CallbackTokenProvider; on macOS you can cache the token in memory, but do not write it into a plaintext Keychain item.

Join a channel

swift
import NimeetRtc

final class MeetingController: NSObject, AgoraRtcEngineDelegate {
    private var engine: AgoraRtcEngineKit?

    func start(appId: String, token: String, localView: NSView) {
        engine = AgoraRtcEngineKit.sharedEngine(withAppId: appId, delegate: self)
        engine?.setChannelProfile(.liveBroadcasting)
        engine?.enableVideo()
        let canvas = AgoraRtcVideoCanvas()
        canvas.view = localView
        engine?.setupLocalVideo(canvas)
        engine?.startPreview()
        engine?.joinChannel(byToken: token, channelId: "weekly-sync", uid: 10001, mediaOptions: .init()) { channel, uid, elapsed in
            print("joined \(channel) uid=\(uid)")
        }
    }

    func rtcEngine(_ engine: AgoraRtcEngineKit, didJoinedOfUid uid: UInt, elapsed: Int) { }
    func rtcEngine(_ engine: AgoraRtcEngineKit, didOfflineOfUid uid: UInt, reason: AgoraUserOfflineReason) { }
}

Publish and subscribe

The most common desktop scenario is "share one window":

swift
// 1) Enumerate sources
engine?.getScreenCaptureSources(withThumbSize: CGSize(width: 160, height: 90),
                               iconSize: CGSize(width: 32, height: 32),
                               includeScreen: true) { sources in
    // 2) Pick a window source and pin capture to its windowId
    if let window = sources.first(where: { $0.sourceType == .window }) {
        let params = AgoraScreenCaptureParameters()
        params.frameRate = 15
        let region = CGRect.zero
        engine?.startScreenCapture(byWindowId: window.windowId, regionRect: region, captureParams: params)
    }
}

To capture a display, use startScreenCaptureByDisplayId:regionRect:captureParams:; stop with stopScreenCapture.

Events

The same delegate set as iOS: rtcEngine:didJoinedOfUid:elapsed:, rtcEngine:didOfflineOfUid:reason:, rtcEngine:didOccurError:; screen sharing adds source-list and capture-state callbacks.

Error handling

  • Synchronous methods return Int32; 0 means success and a negative value is an Agora error number; unimplemented capabilities return -4.
  • The most common screen-sharing failure is not a wrong version but a missing permission: when the source list is empty, check the system authorisation and the entitlement first.

Troubleshooting

SymptomCauseHandling
The source list is emptyScreen-recording permission was not grantedGrant it in System Settings and restart the app
The shared window is blackA protected or minimised window was selectedSwitch to the whole screen or to a visible window
The capture frame rate is very lowframeRate and resolution are too highDrop to 15fps and 1080p or below
The app crashes under the sandboxA missing entitlementAdd the com.apple.security.device.* entitlements
Local audio and video are fine but remotes hear nothingMicrophone permission was deniedCheck NSMicrophoneUsageDescription and the system privacy settings

Next steps

Platform information

Itemvalue
PlatformmacOS
LanguageSwift / Objective-C
SDK packageNimeetRtc
Interface version4.7.0
Compatible Agora APIAgora macos API

The public interfaces are aligned with the Agora macos 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
enable video and local previewAgoraRtcEngineKitenableVideo1
Join a channelAgoraRtcEngineKitjoinChannelByToken:channelId:info:uid:joinSuccess:1
Leave a channelAgoraRtcEngineKitleaveChannel:1
Create instance / initializeAgoraRtcEngineKitsharedEngineWithAppId:delegate:1
typescript
enableVideo(): int
joinChannelByToken:channelId:info:uid:joinSuccess:(token?: NSString*, channelId: NSString*, info?: NSString*, uid: NSUInteger, joinSuccessBlock?: void(^ )(NSString*channel,NSUInteger uid,NSInteger elapsed)): int
leaveChannel:(leaveChannelBlock?: void(^ )(AgoraChannelStats*stat)): int
sharedEngineWithAppId:delegate:(appId: NSString*, delegate?: id): instancetype

Events and callbacks

This SDK has no event callbacks.

Error codes

Constantvalue
AgoraErrorCodeAdmGeneralError1005
AgoraErrorCodeAdmInitLoopback1022
AgoraErrorCodeAdmInitPlayout1008
AgoraErrorCodeAdmInitRecording1011
AgoraErrorCodeAdmJavaResource1006
AgoraErrorCodeAdmNoPlayoutDevice1360
AgoraErrorCodeAdmNoRecordingDevice1359
AgoraErrorCodeAdmPlayAbnormalFrequency1020
AgoraErrorCodeAdmRecordAbnormalFrequency1021
AgoraErrorCodeAdmRecordAudioFailed1018
AgoraErrorCodeAdmRuntimePlayoutError1015
AgoraErrorCodeAdmRuntimeRecordingError1017
AgoraErrorCodeAdmSampleRate1007
AgoraErrorCodeAdmStartLoopback1023
AgoraErrorCodeAdmStartPlayout1009
AgoraErrorCodeAdmStartRecording1012
AgoraErrorCodeAdmStopPlayout1010
AgoraErrorCodeAdmStopRecording1013
AgoraErrorCodeAlreadyInUse19
AgoraErrorCodeBitrateLimit115
AgoraErrorCodeBufferTooSmall6
AgoraErrorCodeConnectionInterrupted111
AgoraErrorCodeConnectionLost112
AgoraErrorCodeDecryptionFailed120
AgoraErrorCodeEncryptedStreamNotAllowedPublish130
AgoraErrorCodeFailed1
AgoraErrorCodeInitNetEngine21
AgoraErrorCodeInvalidAppId101
AgoraErrorCodeInvalidArgument2
AgoraErrorCodeInvalidChannelId102
AgoraErrorCodeInvalidState8
AgoraErrorCodeInvalidToken110
AgoraErrorCodeInvalidUserAccount134
AgoraErrorCodeJoinChannelRejected17
AgoraErrorCodeLeaveChannelRejected18
AgoraErrorCodeLoadMediaEngine1001
AgoraErrorCodeNoError0
AgoraErrorCodeNoServerResources103
AgoraErrorCodeNotInChannel113
AgoraErrorCodeNotInitialized7
AgoraErrorCodeNotReady3
AgoraErrorCodeNotSupported4
AgoraErrorCodePcmSendBufferOverflow201
AgoraErrorCodePcmSendFormat200
AgoraErrorCodeResourceLimited22
AgoraErrorCodeSizeTooLarge114
AgoraErrorCodeStartCall1002
AgoraErrorCodeStartCamera1003
AgoraErrorCodeStartVideoRender1004
AgoraErrorCodeTimedOut10
AgoraErrorCodeTokenExpired109
AgoraErrorCodeTooManyDataStreams116
AgoraErrorCodeVcmEncoderEncodeError1602
AgoraErrorCodeVcmEncoderInitError1601
AgoraErrorCodeVcmEncoderSetError1603
AgoraErrorCodeVcmUnknownError1600
AgoraErrorCodeVdmCameraNotAuthorized1501
AgoraErrorCodeVideoEffectAssetInvalid1700
AgoraErrorCodeVideoEffectEngineInvalid1702
AgoraErrorCodeVideoEffectInvalidBundlePath1707
AgoraErrorCodeVideoEffectInvalidParam1705
AgoraErrorCodeVideoEffectNodeNotActive1704
AgoraErrorCodeVideoEffectNotSupported1706
AgoraErrorCodeVideoEffectSaveFailed1701
AgoraErrorCodeWatermarkAGRB128
AgoraErrorCodeWatermarkInfo127
AgoraErrorCodeWatermarkParam124
AgoraErrorCodeWatermarkPath125
AgoraErrorCodeWatermarkPng126
AgoraErrorCodeWatermarkRead129

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.