npm.io
4.24.10 • Published 3d ago

agora-rtc-sdk-ng

Licence
MIT
Version
4.24.10
Deps
11
Size
11.6 MB
Vulns
0
Weekly
0
Stars
29

AgoraRTC SDK (Version 4.x)

English | 简体中文

Getting Started

Install

Use npm, pnpm or yarn

# with npm
npm i agora-rtc-sdk-ng
# or with pnpm
pnpm add agora-rtc-sdk-ng
# or with yarn
yarn add agora-rtc-sdk-ng

CDN is also provided. The SDK exports a global AgoraRTC object.

<!-- default UMD, no AI QoS -->
<script src="https://download.agora.io/sdk/release/AgoraRTC_N-4.24.8.js"></script>

To use AI QoS from CDN, load the full UMD instead. AI is already registered; only this one script is needed:

<script src="https://download.agora.io/sdk/release/AgoraRTC_N-4.24.8-full.js"></script>
<script>
  const client = AgoraRTC.createClient({ mode: "live", codec: "vp8", aiClientMode: true });
  await client.join(appId, channel, token, uid);
</script>

npm UMD is the same split. Default has no AI QoS; agora-rtc-sdk-ng/full is the complete build:

import AgoraRTC from "agora-rtc-sdk-ng/full";

const client = AgoraRTC.createClient({ mode: "live", codec: "vp8", aiClientMode: true });
await client.join(appId, channel, token, uid);

For the basic RTC build, use agora-rtc-sdk-ng/min. It uses the same public TypeScript declarations as the default package:

import AgoraRTC from "agora-rtc-sdk-ng/min";

const client = AgoraRTC.createClient({ mode: "rtc", codec: "vp8" });

ESM is unchanged: import the main ESM, then the optional service:

import AgoraRTC from "agora-rtc-sdk-ng/esm";
import { AiAudioModeService } from "agora-rtc-sdk-ng/services/ai-audio-mode";

AgoraRTC.use(AiAudioModeService);
const client = AgoraRTC.createClient({ mode: "live", codec: "vp8", aiClientMode: true });
await client.join(appId, channel, token, uid);
Quick start

React, Vue, Svelte quick start demo are provided, please check at Quick Start Demo. We also have More Demos.

Please follow the documentation at api-ref.agora.io.

Changelogs

Please check the changelogs at Release Notes.

Keywords