@axonkit/client-sdk-js 0.1.0
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/LICENSE +85 -0
- package/README.md +125 -0
- package/dist/Room.d.ts +273 -0
- package/dist/axonkit-client.esm.js +1 -0
- package/dist/axonkit-client.umd.js +1 -0
- package/dist/connectionHelper/ConnectionCheck.d.ts +33 -0
- package/dist/data-stream/DataStreamManager.d.ts +65 -0
- package/dist/events.d.ts +432 -0
- package/dist/index.d.ts +41 -0
- package/dist/participant/LocalParticipant.d.ts +186 -0
- package/dist/participant/LocalTrackPublication.d.ts +28 -0
- package/dist/participant/Participant.d.ts +133 -0
- package/dist/participant/RemoteParticipant.d.ts +30 -0
- package/dist/participant/RemoteTrackPublication.d.ts +63 -0
- package/dist/protocol/errors.d.ts +22 -0
- package/dist/protocol/message.d.ts +30 -0
- package/dist/protocol/types.d.ts +522 -0
- package/dist/room/DefaultReconnectPolicy.d.ts +28 -0
- package/dist/room/options.d.ts +74 -0
- package/dist/rpc.d.ts +28 -0
- package/dist/signal/RPCClient.d.ts +28 -0
- package/dist/signal/SignalClient.d.ts +14 -0
- package/dist/stats/StatsCollector.d.ts +15 -0
- package/dist/track/LocalAudioTrack.d.ts +20 -0
- package/dist/track/LocalTrack.d.ts +108 -0
- package/dist/track/LocalVideoTrack.d.ts +35 -0
- package/dist/track/RemoteAudioTrack.d.ts +7 -0
- package/dist/track/RemoteTrack.d.ts +33 -0
- package/dist/track/RemoteVideoTrack.d.ts +31 -0
- package/dist/track/Track.d.ts +62 -0
- package/dist/track/create.d.ts +30 -0
- package/dist/track/options.d.ts +525 -0
- package/dist/track/processor/types.d.ts +49 -0
- package/dist/track/publishUtils.d.ts +14 -0
- package/dist/transport/TransportManager.d.ts +62 -0
- package/dist/types.d.ts +146 -0
- package/dist/utils/browser.d.ts +113 -0
- package/dist/utils/deviceFailure.d.ts +30 -0
- package/dist/utils/id.d.ts +1 -0
- package/dist/utils/logger.d.ts +39 -0
- package/dist/utils/typedEmitter.d.ts +24 -0
- package/dist/version.d.ts +2 -0
- package/package.json +80 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
AxonKit Client SDK License Agreement
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 axonkit. All rights reserved.
|
|
4
|
+
|
|
5
|
+
1. Definitions
|
|
6
|
+
1.1 "SDK" means this software package and all source code, compiled
|
|
7
|
+
artifacts, type declarations, documentation, and related files
|
|
8
|
+
distributed under this Agreement.
|
|
9
|
+
1.2 "Service" means the AxonKit hosted services, APIs, and backend
|
|
10
|
+
systems operated by axonkit.
|
|
11
|
+
1.3 "You" (or "Licensee") means the individual or legal entity
|
|
12
|
+
exercising rights under this Agreement.
|
|
13
|
+
|
|
14
|
+
2. License Grant
|
|
15
|
+
Subject to Your compliance with this Agreement, axonkit grants You a
|
|
16
|
+
limited, worldwide, non-exclusive, non-transferable, non-sublicensable,
|
|
17
|
+
revocable license to:
|
|
18
|
+
(a) install and use the SDK in source or compiled form solely for
|
|
19
|
+
the purpose of developing, testing, and operating applications
|
|
20
|
+
that connect to and interact with the Service; and
|
|
21
|
+
(b) redistribute the SDK as an integrated, non-separable component
|
|
22
|
+
of Your applications that use the Service, provided that the SDK
|
|
23
|
+
is not made available as a standalone product.
|
|
24
|
+
|
|
25
|
+
3. Restrictions
|
|
26
|
+
You shall not, and shall not permit any third party to:
|
|
27
|
+
(a) use the SDK to connect to, interoperate with, or build any
|
|
28
|
+
service other than the Service;
|
|
29
|
+
(b) reverse engineer, decompile, disassemble, or otherwise attempt
|
|
30
|
+
to derive the source code of the SDK, except to the extent such
|
|
31
|
+
restriction is prohibited by applicable law;
|
|
32
|
+
(c) modify, translate, or create derivative works of the SDK for
|
|
33
|
+
the purpose of distributing them as a standalone library or to
|
|
34
|
+
third parties not using the Service;
|
|
35
|
+
(d) remove, alter, or obscure any copyright, trademark, or other
|
|
36
|
+
proprietary notices contained in the SDK;
|
|
37
|
+
(e) use the SDK to build, train, or develop a competing product or
|
|
38
|
+
service that is substantially similar to the Service; or
|
|
39
|
+
(f) sublicense, sell, rent, lease, lend, or otherwise transfer the
|
|
40
|
+
SDK to any third party except as expressly permitted in
|
|
41
|
+
Section 2(b).
|
|
42
|
+
|
|
43
|
+
4. Ownership
|
|
44
|
+
The SDK is licensed, not sold. axonkit and its licensors retain all
|
|
45
|
+
right, title, and interest in and to the SDK, including all
|
|
46
|
+
intellectual property rights. No rights are granted to You other
|
|
47
|
+
than those expressly set forth in this Agreement.
|
|
48
|
+
|
|
49
|
+
5. Third-Party Components
|
|
50
|
+
The SDK may include or depend on third-party open source software,
|
|
51
|
+
each of which is subject to its own license terms. Such third-party
|
|
52
|
+
licenses are not affected by this Agreement.
|
|
53
|
+
|
|
54
|
+
6. Termination
|
|
55
|
+
This Agreement is effective until terminated. axonkit may terminate
|
|
56
|
+
this Agreement immediately upon notice if You breach any term of this
|
|
57
|
+
Agreement. Upon termination, You must cease all use of the SDK and
|
|
58
|
+
destroy all copies in Your possession or control. Sections 3, 4, 7,
|
|
59
|
+
8, and 9 survive termination.
|
|
60
|
+
|
|
61
|
+
7. Disclaimer of Warranty
|
|
62
|
+
THE SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF
|
|
63
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
|
64
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
|
|
65
|
+
TITLE, AND NON-INFRINGEMENT. axonkit DOES NOT WARRANT THAT THE SDK
|
|
66
|
+
WILL BE ERROR-FREE OR UNINTERRUPTED.
|
|
67
|
+
|
|
68
|
+
8. Limitation of Liability
|
|
69
|
+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL
|
|
70
|
+
axonkit OR ITS AFFILIATES BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
71
|
+
SPECIAL, CONSEQUENTIAL, OR PUNITIVE DAMAGES, OR ANY LOSS OF PROFITS,
|
|
72
|
+
REVENUE, DATA, OR USE, ARISING OUT OF OR IN CONNECTION WITH THIS
|
|
73
|
+
AGREEMENT OR THE SDK, WHETHER IN CONTRACT, TORT, OR OTHERWISE, EVEN
|
|
74
|
+
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
75
|
+
|
|
76
|
+
9. Governing Law
|
|
77
|
+
This Agreement shall be governed by and construed in accordance with
|
|
78
|
+
applicable laws, without regard to its conflict of law provisions.
|
|
79
|
+
|
|
80
|
+
10. Entire Agreement
|
|
81
|
+
This Agreement constitutes the entire agreement between You and
|
|
82
|
+
axonkit regarding the SDK and supersedes all prior or contemporaneous
|
|
83
|
+
understandings.
|
|
84
|
+
|
|
85
|
+
For licensing inquiries, please contact: <jiyeyuran@gmail.com>
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @axonkit/client-sdk-js
|
|
2
|
+
|
|
3
|
+
AxonKit JavaScript/TypeScript Client SDK for real-time communication, built on top of [mediasoup-client](https://github.com/versatica/mediasoup-client).
|
|
4
|
+
|
|
5
|
+
> **License**: This SDK is proprietary software licensed exclusively for use
|
|
6
|
+
> with the AxonKit Service. See [LICENSE](./LICENSE) for the full terms.
|
|
7
|
+
> For commercial inquiries, contact <jiyeyuran@gmail.com>.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @axonkit/client-sdk-js
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Room, RoomState, setLogLevel, LogLevel } from '@axonkit/client-sdk-js';
|
|
19
|
+
|
|
20
|
+
setLogLevel(LogLevel.INFO);
|
|
21
|
+
|
|
22
|
+
const room = new Room({
|
|
23
|
+
autoSubscribe: true,
|
|
24
|
+
dynacast: true,
|
|
25
|
+
adaptiveStream: true,
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// Connect
|
|
29
|
+
await room.connect('https://your-server.com', 'your-jwt-token');
|
|
30
|
+
|
|
31
|
+
// Publish camera and microphone
|
|
32
|
+
await room.localParticipant.setCameraEnabled(true);
|
|
33
|
+
await room.localParticipant.setMicrophoneEnabled(true);
|
|
34
|
+
|
|
35
|
+
// Listen for remote tracks
|
|
36
|
+
room.on('trackSubscribed', (track, publication, participant) => {
|
|
37
|
+
if (track.kind === 'video') {
|
|
38
|
+
const element = track.attach();
|
|
39
|
+
document.getElementById('remote-videos')?.appendChild(element);
|
|
40
|
+
} else {
|
|
41
|
+
const element = track.attach();
|
|
42
|
+
element.play();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Listen for participants
|
|
47
|
+
room.on('participantJoined', (participant) => {
|
|
48
|
+
console.log(`${participant.identity} joined`);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
room.on('participantLeft', (participant) => {
|
|
52
|
+
console.log(`${participant.identity} left`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// Disconnect
|
|
56
|
+
await room.disconnect();
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Features
|
|
60
|
+
|
|
61
|
+
- **WebRTC Transport** — Powered by mediasoup-client for reliable media transport
|
|
62
|
+
- **DataChannel RPC** — Axon Protocol for signaling over DataChannel (after initial HTTP join)
|
|
63
|
+
- **Auto Subscribe** — Automatically subscribe to new tracks
|
|
64
|
+
- **Dynacast** — Dynamic simulcast layer control based on subscriber needs
|
|
65
|
+
- **Adaptive Stream** — Visibility and size-based subscription management
|
|
66
|
+
- **Reconnection** — Automatic reconnect with exponential backoff and state sync
|
|
67
|
+
- **Heartbeat** — Ping/pong keep-alive with RTT measurement
|
|
68
|
+
|
|
69
|
+
## API Reference
|
|
70
|
+
|
|
71
|
+
### Room
|
|
72
|
+
|
|
73
|
+
| Method | Description |
|
|
74
|
+
| --------------------- | ------------------------------------------ |
|
|
75
|
+
| `connect(url, token)` | Connect to a room |
|
|
76
|
+
| `disconnect()` | Disconnect from the room |
|
|
77
|
+
| `startAudio()` | Start audio playback (for autoplay policy) |
|
|
78
|
+
|
|
79
|
+
### LocalParticipant
|
|
80
|
+
|
|
81
|
+
| Method | Description |
|
|
82
|
+
| -------------------------------- | --------------------------- |
|
|
83
|
+
| `setCameraEnabled(enabled)` | Toggle camera |
|
|
84
|
+
| `setMicrophoneEnabled(enabled)` | Toggle microphone |
|
|
85
|
+
| `setScreenShareEnabled(enabled)` | Toggle screen share |
|
|
86
|
+
| `publishTrack(track, options?)` | Publish a local track |
|
|
87
|
+
| `unpublishTrack(track)` | Unpublish a track |
|
|
88
|
+
| `publishData(data, options?)` | Send data via DataChannel |
|
|
89
|
+
| `updateMetadata(metadata)` | Update participant metadata |
|
|
90
|
+
| `updateName(name)` | Update participant name |
|
|
91
|
+
|
|
92
|
+
### Events
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
room.on('connected', () => {});
|
|
96
|
+
room.on('disconnected', (reason) => {});
|
|
97
|
+
room.on('reconnecting', () => {});
|
|
98
|
+
room.on('reconnected', () => {});
|
|
99
|
+
room.on('participantJoined', (participant) => {});
|
|
100
|
+
room.on('participantLeft', (participant) => {});
|
|
101
|
+
room.on('trackSubscribed', (track, publication, participant) => {});
|
|
102
|
+
room.on('trackUnsubscribed', (track, publication, participant) => {});
|
|
103
|
+
room.on('activeSpeakersChanged', (speakers) => {});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Building
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
pnpm install
|
|
110
|
+
pnpm build
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Outputs:
|
|
114
|
+
|
|
115
|
+
- `dist/axonkit-client.esm.js` — ES Module
|
|
116
|
+
- `dist/axonkit-client.umd.js` — UMD (for `<script>` tags)
|
|
117
|
+
- `dist/index.d.ts` — TypeScript declarations
|
|
118
|
+
|
|
119
|
+
## Demo
|
|
120
|
+
|
|
121
|
+
Open `examples/demo/index.html` in a browser after building. Requires a running AxonKit server.
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
MIT
|
package/dist/Room.d.ts
ADDED
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
import { TypedEmitter } from './utils/typedEmitter';
|
|
2
|
+
import { LocalParticipant } from './participant/LocalParticipant';
|
|
3
|
+
import { RemoteParticipant } from './participant/RemoteParticipant';
|
|
4
|
+
import { Participant } from './participant/Participant';
|
|
5
|
+
import { LocalTrackPublication } from './participant/LocalTrackPublication';
|
|
6
|
+
import type { RemoteTrackPublication } from './participant/RemoteTrackPublication';
|
|
7
|
+
import { RoomState, DisconnectReason, StreamState, type RoomInfo, type ServerInfo, type GroupInfo, ConnectionQuality } from './protocol/types';
|
|
8
|
+
import type { RoomOptions, RoomConnectOptions } from './room/options';
|
|
9
|
+
import { Track } from './track/Track';
|
|
10
|
+
import { RoomEvent } from './events';
|
|
11
|
+
import type { Message, RpcInvocationData, TextStreamHandler, ByteStreamHandler } from './types';
|
|
12
|
+
export type RoomEvents = {
|
|
13
|
+
[RoomEvent.Connected]: () => void;
|
|
14
|
+
[RoomEvent.Disconnected]: (reason?: DisconnectReason) => void;
|
|
15
|
+
[RoomEvent.Reconnecting]: () => void;
|
|
16
|
+
[RoomEvent.Reconnected]: () => void;
|
|
17
|
+
[RoomEvent.ConnectionStateChanged]: (state: RoomState) => void;
|
|
18
|
+
[RoomEvent.SignalReconnecting]: () => void;
|
|
19
|
+
[RoomEvent.MediaDevicesChanged]: () => void;
|
|
20
|
+
[RoomEvent.MediaDevicesError]: (error: Error) => void;
|
|
21
|
+
[RoomEvent.ParticipantJoined]: (participant: RemoteParticipant) => void;
|
|
22
|
+
[RoomEvent.ParticipantLeft]: (participant: RemoteParticipant, reason?: string) => void;
|
|
23
|
+
[RoomEvent.ParticipantUpdated]: (participant: RemoteParticipant) => void;
|
|
24
|
+
[RoomEvent.ParticipantMetadataChanged]: (prevMetadata: string | undefined, participant: Participant) => void;
|
|
25
|
+
[RoomEvent.ParticipantNameChanged]: (name: string, participant: Participant) => void;
|
|
26
|
+
[RoomEvent.ParticipantAttributesChanged]: (changed: Record<string, string>, participant: Participant) => void;
|
|
27
|
+
[RoomEvent.TrackPublished]: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
28
|
+
[RoomEvent.TrackUnpublished]: (publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
29
|
+
[RoomEvent.TrackSubscribed]: (track: Track, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
30
|
+
[RoomEvent.TrackSubscriptionFailed]: (trackSid: string, participant: RemoteParticipant) => void;
|
|
31
|
+
[RoomEvent.TrackUnsubscribed]: (track: Track, publication: RemoteTrackPublication, participant: RemoteParticipant) => void;
|
|
32
|
+
[RoomEvent.TrackMuted]: (publication: LocalTrackPublication | RemoteTrackPublication, participant: Participant) => void;
|
|
33
|
+
[RoomEvent.TrackUnmuted]: (publication: LocalTrackPublication | RemoteTrackPublication, participant: Participant) => void;
|
|
34
|
+
[RoomEvent.LocalTrackPublished]: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
|
35
|
+
[RoomEvent.LocalTrackUnpublished]: (publication: LocalTrackPublication, participant: LocalParticipant) => void;
|
|
36
|
+
[RoomEvent.LocalAudioSilenceDetected]: () => void;
|
|
37
|
+
[RoomEvent.ActiveSpeakersChanged]: (speakers: Participant[]) => void;
|
|
38
|
+
[RoomEvent.RoomUpdated]: (room: RoomInfo) => void;
|
|
39
|
+
[RoomEvent.DataReceived]: (data: ArrayBuffer, participant?: RemoteParticipant) => void;
|
|
40
|
+
[RoomEvent.ConnectionQualityChanged]: (quality: ConnectionQuality, participant: Participant) => void;
|
|
41
|
+
[RoomEvent.AudioPlaybackStatusChanged]: (canPlayback: boolean) => void;
|
|
42
|
+
[RoomEvent.VideoPlaybackStatusChanged]: (canPlayback: boolean) => void;
|
|
43
|
+
[RoomEvent.ChatMessage]: (message: Message, participant?: Participant) => void;
|
|
44
|
+
[RoomEvent.MessageDeleted]: (ids: string[], type?: string) => void;
|
|
45
|
+
[RoomEvent.StateUpdated]: (key: string, value: string, participantSid?: string, participantIdentity?: string) => void;
|
|
46
|
+
[RoomEvent.StateDeleted]: (key: string, participantSid?: string, participantIdentity?: string) => void;
|
|
47
|
+
[RoomEvent.TrackStreamStateChanged]: (publication: RemoteTrackPublication, streamState: StreamState, participant: RemoteParticipant) => void;
|
|
48
|
+
[RoomEvent.GroupCreated]: (group: GroupInfo) => void;
|
|
49
|
+
[RoomEvent.GroupUpdated]: (group: GroupInfo) => void;
|
|
50
|
+
[RoomEvent.GroupDeleted]: (groupId: string) => void;
|
|
51
|
+
[RoomEvent.GroupParticipantJoined]: (groupId: string, participant: Participant) => void;
|
|
52
|
+
[RoomEvent.GroupParticipantLeft]: (groupId: string, participant: Participant) => void;
|
|
53
|
+
[RoomEvent.TokenRefreshed]: (token: string) => void;
|
|
54
|
+
};
|
|
55
|
+
export declare class Room extends TypedEmitter<RoomEvents> {
|
|
56
|
+
private _state;
|
|
57
|
+
private _name;
|
|
58
|
+
private _sid;
|
|
59
|
+
private _serverInfo?;
|
|
60
|
+
private _roomInfo?;
|
|
61
|
+
private _options;
|
|
62
|
+
private url;
|
|
63
|
+
private token;
|
|
64
|
+
private _refreshToken;
|
|
65
|
+
private nodeId;
|
|
66
|
+
private participantSid;
|
|
67
|
+
private signalClient;
|
|
68
|
+
private rpcClient;
|
|
69
|
+
private transportManager;
|
|
70
|
+
private _localParticipant;
|
|
71
|
+
private _remoteParticipants;
|
|
72
|
+
private _groups;
|
|
73
|
+
private _sharedState;
|
|
74
|
+
private pingInterval?;
|
|
75
|
+
private pingTimeoutTimer?;
|
|
76
|
+
private pingIntervalSec;
|
|
77
|
+
private pingTimeoutSec;
|
|
78
|
+
private lastRtt;
|
|
79
|
+
private reconnectAttempts;
|
|
80
|
+
private reconnectPolicy;
|
|
81
|
+
private statsCollector?;
|
|
82
|
+
private pageLeaveHandler?;
|
|
83
|
+
private deviceChangeHandler?;
|
|
84
|
+
private _canPlaybackAudio;
|
|
85
|
+
private _canPlaybackVideo;
|
|
86
|
+
private _activeDeviceMap;
|
|
87
|
+
private dataStreamReceiver;
|
|
88
|
+
private _lastMessageTimestamp;
|
|
89
|
+
private _connectOptions;
|
|
90
|
+
constructor(options?: RoomOptions);
|
|
91
|
+
get state(): RoomState;
|
|
92
|
+
get name(): string;
|
|
93
|
+
get sid(): string;
|
|
94
|
+
get serverInfo(): ServerInfo | undefined;
|
|
95
|
+
get localParticipant(): LocalParticipant;
|
|
96
|
+
get remoteParticipants(): Map<string, RemoteParticipant>;
|
|
97
|
+
/**
|
|
98
|
+
* Returns WebRTC stats for the underlying send and receive transports.
|
|
99
|
+
*/
|
|
100
|
+
getTransportStats(): Promise<{
|
|
101
|
+
send?: RTCStatsReport;
|
|
102
|
+
recv?: RTCStatsReport;
|
|
103
|
+
}>;
|
|
104
|
+
/** All active groups (breakout rooms) in this room. */
|
|
105
|
+
get groups(): ReadonlyMap<string, GroupInfo>;
|
|
106
|
+
/** Room-level shared state KV (for collaboration features like whiteboard, shared documents). */
|
|
107
|
+
get sharedState(): ReadonlyMap<string, string>;
|
|
108
|
+
/**
|
|
109
|
+
* Get all participants currently in the specified group.
|
|
110
|
+
* Includes the local participant if they are in the group.
|
|
111
|
+
*/
|
|
112
|
+
getGroupParticipants(groupId: string): Participant[];
|
|
113
|
+
/**
|
|
114
|
+
* Get all participants.
|
|
115
|
+
*/
|
|
116
|
+
getParticipants(): Participant[];
|
|
117
|
+
/** Whether audio can be played back automatically (i.e. no autoplay restriction). */
|
|
118
|
+
get canPlaybackAudio(): boolean;
|
|
119
|
+
/** Whether video can be played back automatically. */
|
|
120
|
+
get canPlaybackVideo(): boolean;
|
|
121
|
+
/** Whether the room is currently being recorded. */
|
|
122
|
+
get isRecording(): boolean;
|
|
123
|
+
/** Room-level metadata (set by the server). */
|
|
124
|
+
get metadata(): string | undefined;
|
|
125
|
+
/** Number of participants currently in the room. */
|
|
126
|
+
get numParticipants(): number;
|
|
127
|
+
/** Number of participants that are actively publishing tracks. */
|
|
128
|
+
get numPublishers(): number;
|
|
129
|
+
/** List of participants currently speaking, ordered by audio level. */
|
|
130
|
+
get activeSpeakers(): Participant[];
|
|
131
|
+
/**
|
|
132
|
+
* Look up a remote participant by their identity.
|
|
133
|
+
*/
|
|
134
|
+
getParticipantByIdentity(identity: string): RemoteParticipant | undefined;
|
|
135
|
+
/** Find any participant (local or remote) by SID. */
|
|
136
|
+
private getParticipantBySid;
|
|
137
|
+
/**
|
|
138
|
+
* Create a new group (breakout room) within this room.
|
|
139
|
+
* Requires `canManageGroups` permission.
|
|
140
|
+
*/
|
|
141
|
+
createGroup(name: string, permissions?: import('./protocol/types').ParticipantPermission): Promise<GroupInfo>;
|
|
142
|
+
/**
|
|
143
|
+
* Delete a group. All participants in the group are returned to the main room
|
|
144
|
+
* and their permissions revert to room-level defaults.
|
|
145
|
+
* Requires `canManageGroups` permission.
|
|
146
|
+
*/
|
|
147
|
+
deleteGroup(groupId: string): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* List all active groups in this room.
|
|
150
|
+
*/
|
|
151
|
+
listGroups(): Promise<GroupInfo[]>;
|
|
152
|
+
/**
|
|
153
|
+
* Pin a remote participant so their media tracks are always received,
|
|
154
|
+
* regardless of active speaker rotation. Pinned participants occupy
|
|
155
|
+
* lastN slots with highest priority.
|
|
156
|
+
*/
|
|
157
|
+
pinParticipant(participantSid: string): Promise<void>;
|
|
158
|
+
/**
|
|
159
|
+
* Unpin a previously pinned participant. Their media subscription will
|
|
160
|
+
* then be subject to active speaker rotation under lastN rules.
|
|
161
|
+
*/
|
|
162
|
+
unpinParticipant(participantSid: string): Promise<void>;
|
|
163
|
+
/**
|
|
164
|
+
* Enumerate available media input/output devices.
|
|
165
|
+
* @param kind - Filter by device kind. If omitted, all devices are returned.
|
|
166
|
+
*/
|
|
167
|
+
static getLocalDevices(kind?: MediaDeviceKind): Promise<MediaDeviceInfo[]>;
|
|
168
|
+
/**
|
|
169
|
+
* Switch the active device for a given kind across all published tracks.
|
|
170
|
+
* @param kind - `videoinput`, `audioinput`, or `audiooutput`.
|
|
171
|
+
* @param deviceId - The device ID to switch to.
|
|
172
|
+
* @param exact - If `true`, sets the `deviceId` constraint to `exact`.
|
|
173
|
+
* Defaults to `true`.
|
|
174
|
+
*/
|
|
175
|
+
switchActiveDevice(kind: MediaDeviceKind, deviceId: string, exact?: boolean): Promise<void>;
|
|
176
|
+
connect(url: string, token?: string, options?: RoomConnectOptions): Promise<void>;
|
|
177
|
+
private performConnect;
|
|
178
|
+
/**
|
|
179
|
+
* Disconnect from the room.
|
|
180
|
+
* @param stopTracks - Whether to stop local tracks after disconnecting.
|
|
181
|
+
* Defaults to `true`.
|
|
182
|
+
*/
|
|
183
|
+
disconnect(stopTracks?: boolean): Promise<void>;
|
|
184
|
+
private attemptReconnect;
|
|
185
|
+
private performReconnect;
|
|
186
|
+
private withTimeout;
|
|
187
|
+
private buildSyncState;
|
|
188
|
+
private setState;
|
|
189
|
+
private startHeartbeat;
|
|
190
|
+
private stopHeartbeat;
|
|
191
|
+
private sendPing;
|
|
192
|
+
get rtt(): number;
|
|
193
|
+
private startStatsCollector;
|
|
194
|
+
private stopStatsCollector;
|
|
195
|
+
/**
|
|
196
|
+
* Attempt to start audio playback on all remote audio tracks.
|
|
197
|
+
* Should be called from a user interaction handler when
|
|
198
|
+
* `canPlaybackAudio` is `false`.
|
|
199
|
+
*/
|
|
200
|
+
startAudio(): Promise<void>;
|
|
201
|
+
/**
|
|
202
|
+
* Attempt to start video playback on all remote video tracks.
|
|
203
|
+
* Should be called from a user interaction handler when
|
|
204
|
+
* `canPlaybackVideo` is `false`.
|
|
205
|
+
*/
|
|
206
|
+
startVideo(): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Returns the device ID currently active for a given kind, if known.
|
|
209
|
+
*/
|
|
210
|
+
getActiveDevice(kind: MediaDeviceKind): string | undefined;
|
|
211
|
+
/**
|
|
212
|
+
* Register an RPC method handler. When a remote participant calls
|
|
213
|
+
* `performRpc` with the given method name, the handler is invoked.
|
|
214
|
+
*
|
|
215
|
+
* @param method - Method name to handle.
|
|
216
|
+
* @param handler - Async function that receives invocation data and returns
|
|
217
|
+
* a string payload.
|
|
218
|
+
*/
|
|
219
|
+
registerRpcMethod(method: string, handler: (data: RpcInvocationData) => Promise<string>): void;
|
|
220
|
+
/**
|
|
221
|
+
* Remove a previously registered RPC method handler.
|
|
222
|
+
*/
|
|
223
|
+
unregisterRpcMethod(method: string): void;
|
|
224
|
+
/**
|
|
225
|
+
* Register a handler for incoming text streams on a specific topic.
|
|
226
|
+
*/
|
|
227
|
+
registerTextStreamHandler(topic: string, handler: TextStreamHandler): void;
|
|
228
|
+
/**
|
|
229
|
+
* Unregister a previously registered text stream handler.
|
|
230
|
+
*/
|
|
231
|
+
unregisterTextStreamHandler(topic: string): void;
|
|
232
|
+
/**
|
|
233
|
+
* Register a handler for incoming byte streams on a specific topic.
|
|
234
|
+
*/
|
|
235
|
+
registerByteStreamHandler(topic: string, handler: ByteStreamHandler): void;
|
|
236
|
+
/**
|
|
237
|
+
* Unregister a previously registered byte stream handler.
|
|
238
|
+
*/
|
|
239
|
+
unregisterByteStreamHandler(topic: string): void;
|
|
240
|
+
private applyJoinResponse;
|
|
241
|
+
private registerRPCHandlers;
|
|
242
|
+
private registerNotificationHandlers;
|
|
243
|
+
private applyReadySnapshot;
|
|
244
|
+
private replaceRemoteParticipants;
|
|
245
|
+
private replaceGroups;
|
|
246
|
+
private replaceSharedState;
|
|
247
|
+
private upsertRemoteParticipant;
|
|
248
|
+
private scheduleReadySnapshotReplay;
|
|
249
|
+
private handleParticipantJoined;
|
|
250
|
+
private handleParticipantLeft;
|
|
251
|
+
private handleParticipantUpdated;
|
|
252
|
+
private handleTrackPublished;
|
|
253
|
+
private handleTrackUnpublished;
|
|
254
|
+
private handleDataTrackPublished;
|
|
255
|
+
private handleDataTrackUnpublished;
|
|
256
|
+
private handleTrackMuted;
|
|
257
|
+
/** Video dynacast: per-layer quality change + producer pause/resume. */
|
|
258
|
+
private handleSubscribedQualityChanged;
|
|
259
|
+
private handleActiveSpeakersChanged;
|
|
260
|
+
private handleMessage;
|
|
261
|
+
private handleRoomUpdated;
|
|
262
|
+
private handleDisconnect;
|
|
263
|
+
private handleSubscriptionCreate;
|
|
264
|
+
private handleDataSubscriptionCreate;
|
|
265
|
+
private handleSubscriptionClosed;
|
|
266
|
+
private handleDataSubscriptionClosed;
|
|
267
|
+
private wireRemoteParticipantEvents;
|
|
268
|
+
private wireLocalParticipantEvents;
|
|
269
|
+
private setupDeviceChangeListener;
|
|
270
|
+
private cleanup;
|
|
271
|
+
private wireTransportEvents;
|
|
272
|
+
private setupPageLeaveHandler;
|
|
273
|
+
}
|