@kaltura-sdk/avatars 1.15.0 → 1.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -1
- package/index.esm.js +406 -368
- package/package.json +1 -1
- package/src/lib/avatar-client-manager/avatar-client-manager.d.ts +3 -3
package/README.md
CHANGED
|
@@ -1 +1,47 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @kaltura-sdk/avatars
|
|
2
|
+
|
|
3
|
+
Core implementation of `AvatarClientManager` — the state machine-driven client for Kaltura's conversational avatar. Runs on `xstate` + `@unisphere/core` reactive stores; owns the whole connection lifecycle (RTC session, chat, captions, screen share, tap-to-talk, client tools, Kaltura context).
|
|
4
|
+
|
|
5
|
+
For a framework-free, CDN-loadable build, use [`@kaltura-sdk/avatars-esm`](../avatars-esm) — it re-exports this package.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { AvatarClientManager } from '@kaltura-sdk/avatars';
|
|
11
|
+
|
|
12
|
+
const manager = new AvatarClientManager({
|
|
13
|
+
actions: { showNotification }, // optional, defaults to a noop
|
|
14
|
+
debugMode: true, // optional, default false
|
|
15
|
+
logger, // optional — UnisphereLoggerType, defaults to an internal 'avatar-client' logger
|
|
16
|
+
runtimeSettings, // AvatarRuntimeSettings
|
|
17
|
+
kalturaAnalyticsService, // optional, no-ops if omitted
|
|
18
|
+
pubSubService, // optional, no-ops if omitted
|
|
19
|
+
registerDeveloperTools: (actor) => {}, // optional, e.g. xstate inspector
|
|
20
|
+
videoContainerId: 'avatar-video', // optional — auto-joins STV once castMode is "webrtc"
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
manager.connectionStatus.onChanges((status) => console.log(status));
|
|
24
|
+
manager.connect({ dynamicVariables, kickOffPhrase });
|
|
25
|
+
manager.disconnect();
|
|
26
|
+
manager.stop(); // full teardown, unsubscribes everything
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`connect()`/`disconnect()` are sync (fire-and-forget) — read outcomes off the reactive stores (`connectionStatus`, `castMode`, `disconnectData`, etc).
|
|
30
|
+
|
|
31
|
+
## API surface
|
|
32
|
+
|
|
33
|
+
- **Lifecycle**: `connect()`, `disconnect()`, `reconnect()`, `stop()`, `connectionStatus`, `playerUrl`, `sessionId`, `castMode`, `turnServerURL`, `disconnectData`
|
|
34
|
+
- **Pause/resume**: `pause()`, `resume()`, `pauseAfterSpeaking()`, `isPaused`
|
|
35
|
+
- **Chat & content**: `askViaText()`, `chatLog`, `content`, `setLocalContent()`, `clearContent()`, `agentData`
|
|
36
|
+
- **Screen share**: `startScreenShare()`, `stopScreenShare()`, `screenShareInfo`
|
|
37
|
+
- **Tap-to-talk**: `tapToTalkStart()`, `tapToTalkEnd()`, `toggleTapToTalkMode()`, `tapToTalkInfo`
|
|
38
|
+
- **Captions**: `captions` (state + `toggle`/`setReplacements`/`setFilter`)
|
|
39
|
+
- **Kaltura context**: `kalturaContext`, `toggleKalturaContext()`, `updateDynamicVariables()`
|
|
40
|
+
- **Client tools**: `registerClientTools()`, `unregisterClientTools()`, `registeredClientTools`, `clientToolCallLog`
|
|
41
|
+
- **Session metadata**: `threadId`, `setExternalThreadId()`, `isPreviewMode`, `contextSelectorVisible`, `features`, `agentPreviewUrl`, `agentPreviewImageUrl`, `serverUrl`
|
|
42
|
+
- **RTC/device passthrough**: `audioState`, `audioVolumeLevel`, `devicesList`, `joinSTV()`, `leaveSTV()`, `changeDevice()`, `toggleMuteAudio()`
|
|
43
|
+
- **Player events**: `onPlayerReady()`, `onPlayerError()`
|
|
44
|
+
|
|
45
|
+
All getters return `@unisphere/core` reactive stores (`.consumer`, subscribe via `.onChanges`).
|
|
46
|
+
|
|
47
|
+
`connection` is a deprecated back-compat facade kept only for consumers not yet migrated to the manager's own getters/methods.
|