UniApp RTC SDK method reference
Applies to the akstream-rtc plugin delivered with the matching version. Regular uni-app and uni-app x use the AkRtcUniClient facade. Web targets use createWebAdapter around the Web SDK; native Android/iOS targets use createNativeAdapter and UTS. A native module must be included in a custom base; compiling against a standard base is not a physical-device acceptance test. Start with the UniApp walkthrough.
import { AkRtcUniClient, createNativeAdapter } from '@akstream/rtc-uniapp-sdk'
const adapter = createNativeAdapter(nativeBridge, { serverUrl, onEvent: event => renderEvent(event) })
const rtc = new AkRtcUniClient(adapter, event => renderEvent(event))
await rtc.join({ roomId, accessTicket, microphone: false, camera: false })
Your backend supplies the one-use accessTicket; never bundle a long-lived platform API token. AkRtcUniError carries code and optionally feature/HTTP status. Check getFeatureSupport before showing a feature. configurationRequired means native setup is missing, not that an action succeeded.
Facade, session, and recording
| Method | Input | Return | Edge case |
|---|---|---|---|
new AkRtcUniClient(adapter?, onEvent?) |
Platform adapter and event handler | UI-free client | Hold one active instance per meeting. Native targets need a custom base. |
getFeatureSupport(feature) / getFeatures() |
RtcFeature or none |
supported/unsupported/configurationRequired/notImplemented with reason |
Platform support does not override room, role, or server grants. |
join({roomId,accessTicket,passcode?,microphone?,camera?}) |
Room, one-use ticket, initial capture intent | Join/admission result | Do not capture while Waiting; the ticket cannot be replayed. |
createMeeting(settings, creator) / createDemoMeeting(settings) |
Business creator or demo settings | roomId/accessTicket |
Production creator authenticates users and handles idempotency; demo is test-only. |
leave() / close() |
None | Promise<void> |
Leave this device; close adapter and subscriptions when a page is destroyed. |
startContinuousRecording() / stopContinuousRecording(recordingId) / getContinuousRecording() |
Run ID for stop | Active state or no active run | Host starts/stops; admitted members read status. recordingState drives host UI. |
invoke(feature, operation, payload?) |
Feature, adapter operation, JSON | Actual operation result | Advanced bridge. Check feature support first; unknown operations cannot bypass platform limits. |
Native roomAction first receives a transport ACK, then waits for roomActionResult with the same requestId before settling the Promise. Pending work is cancelled on leave/close. ACK is not server success; preserve 403 for the host. See room control actions for supported names and payloads.
Devices, media, and presentation
| Method | Input | Return | Edge case |
|---|---|---|---|
setMicrophoneEnabled(enabled) / setCameraEnabled(enabled) |
Boolean | Effective operation result | Host revocation, OS denial, or network loss can differ from desired state; follow events. |
getMicrophones() / setMicrophoneDevice(deviceId) |
Device ID | List / switch result | Labels depend on OS permission. IDs are not cross-meeting identities. |
getCameras() / switchCamera(deviceId?) |
Optional camera ID | List / switch result | Front/back switching follows native capture lifecycle. |
getAudioOutputs() / setAudioOutput(deviceId) |
Output ID | List / applied route | Bluetooth, speaker, and WebView support differ; check capability first. |
startScreenShare() / stopScreenShare() |
Start needs platform system consent | Sharing state | Host obtains ReplayKit/MediaProjection consent. Screen is a separate stream. |
getVideoModes() / setVideoQuality(targetParticipantId, quality) |
Member ID; {width,height,frameRate} |
Modes / desired quality result | Desired mode is not actual encoder size; server also checks host right. |
getEndpointInfo() / getPublicationStats() |
None | Device info / publication stats | Troubleshooting data, not hardware-unique IDs or proof of saved recording. |
toggleFullscreen(publicationId?) / exitFullscreen() |
Optional publication ID | Fullscreen result | Presentation only; no subscription or recording change. |
Collaboration, adapters, and archives
| Method | Input | Return | Edge case |
|---|---|---|---|
sendChat(text, targetParticipantId?) |
Text and optional direct target | Message operation result | Direct messages remain visible only to sender and recipient, not public replay. |
sendReaction(reaction) / setHandRaised(raised) |
Reaction / Boolean | Meeting event | Does not grant media or whiteboard rights. |
createWebAdapter(client, views?) |
Web SDK client and optional fullscreen bridge | RtcAdapter |
H5/WebView uses the Web SDK for media. |
createNativeAdapter(bridge, {serverUrl,onEvent?}) |
Native UTS bridge and event handler | RtcAdapter with clientId |
Bind native views by clientId; dispose via disposeRtcClient. |
createUniArchiveClient({baseUrl,accessProvider,request?}) |
HTTPS origin, room/action ticket provider, optional transport | UI-free archive client | Can live after leave; methods match the Web archive SDK. |
RtcNativeBridge.createRtcClient returns a native clientId; invokeRtcClient(id,operation,payloadJson,callback) returns accepted/errorCode/message/payloadJson; getRtcFeatures(id) returns platform support; disposeRtcClient(id) releases it. Do not build WHIP/WHEP URLs in pages or treat an ACK as final success. UniApp x requestRtcArchive actions and ticket rules are in archive methods.
Public RtcFeature categories include join, camera/mic, remote media, camera switching, transforms, audio output, screen share, chat/attachments/whiteboard, moderation/admission, recording/invitations, hand raise/reaction, active speaker, device selection, video quality, stats, and meeting creation. Probe before exposing an action; explain notImplemented instead of pretending success.