@livekit/rtc-node 0.12.2 → 0.13.1
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/dist/audio_frame.cjs +2 -2
- package/dist/audio_frame.cjs.map +1 -1
- package/dist/audio_frame.d.cts +2 -3
- package/dist/audio_frame.d.ts +2 -3
- package/dist/audio_frame.d.ts.map +1 -1
- package/dist/audio_frame.js +3 -3
- package/dist/audio_frame.js.map +1 -1
- package/dist/audio_resampler.cjs +10 -7
- package/dist/audio_resampler.cjs.map +1 -1
- package/dist/audio_resampler.d.cts +2 -3
- package/dist/audio_resampler.d.ts +2 -3
- package/dist/audio_resampler.d.ts.map +1 -1
- package/dist/audio_resampler.js +13 -10
- package/dist/audio_resampler.js.map +1 -1
- package/dist/audio_source.cjs +6 -4
- package/dist/audio_source.cjs.map +1 -1
- package/dist/audio_source.d.cts +3 -3
- package/dist/audio_source.d.ts +3 -3
- package/dist/audio_source.d.ts.map +1 -1
- package/dist/audio_source.js +9 -7
- package/dist/audio_source.js.map +1 -1
- package/dist/audio_stream.cjs +1 -2
- package/dist/audio_stream.cjs.map +1 -1
- package/dist/audio_stream.d.cts +2 -3
- package/dist/audio_stream.d.ts +2 -3
- package/dist/audio_stream.d.ts.map +1 -1
- package/dist/audio_stream.js +2 -3
- package/dist/audio_stream.js.map +1 -1
- package/dist/e2ee.cjs +19 -20
- package/dist/e2ee.cjs.map +1 -1
- package/dist/e2ee.d.cts +5 -6
- package/dist/e2ee.d.ts +5 -6
- package/dist/e2ee.d.ts.map +1 -1
- package/dist/e2ee.js +29 -30
- package/dist/e2ee.js.map +1 -1
- package/dist/ffi_client.cjs +6 -5
- package/dist/ffi_client.cjs.map +1 -1
- package/dist/ffi_client.d.cts +10 -10
- package/dist/ffi_client.d.ts +10 -10
- package/dist/ffi_client.d.ts.map +1 -1
- package/dist/ffi_client.js +6 -10
- package/dist/ffi_client.js.map +1 -1
- package/dist/index.cjs +16 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -35
- package/dist/index.d.ts +6 -35
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -46
- package/dist/index.js.map +1 -1
- package/dist/napi/native.d.cjs.map +1 -1
- package/dist/napi/native.d.ts +5 -5
- package/dist/native.d.ts +5 -5
- package/dist/participant.cjs +60 -36
- package/dist/participant.cjs.map +1 -1
- package/dist/participant.d.cts +11 -11
- package/dist/participant.d.ts +11 -11
- package/dist/participant.d.ts.map +1 -1
- package/dist/participant.js +78 -52
- package/dist/participant.js.map +1 -1
- package/dist/proto/audio_frame_pb.cjs +977 -125
- package/dist/proto/audio_frame_pb.cjs.map +1 -1
- package/dist/proto/audio_frame_pb.d.cts +502 -417
- package/dist/proto/audio_frame_pb.d.ts +502 -417
- package/dist/proto/audio_frame_pb.d.ts.map +1 -1
- package/dist/proto/audio_frame_pb.js +943 -85
- package/dist/proto/audio_frame_pb.js.map +1 -1
- package/dist/proto/e2ee_pb.cjs +700 -85
- package/dist/proto/e2ee_pb.cjs.map +1 -1
- package/dist/proto/e2ee_pb.d.cts +331 -263
- package/dist/proto/e2ee_pb.d.ts +331 -263
- package/dist/proto/e2ee_pb.d.ts.map +1 -1
- package/dist/proto/e2ee_pb.js +675 -57
- package/dist/proto/e2ee_pb.js.map +1 -1
- package/dist/proto/ffi_pb.cjs +369 -36
- package/dist/proto/ffi_pb.cjs.map +1 -1
- package/dist/proto/ffi_pb.d.cts +156 -109
- package/dist/proto/ffi_pb.d.ts +156 -109
- package/dist/proto/ffi_pb.d.ts.map +1 -1
- package/dist/proto/ffi_pb.js +364 -29
- package/dist/proto/ffi_pb.js.map +1 -1
- package/dist/proto/handle_pb.cjs +27 -7
- package/dist/proto/handle_pb.cjs.map +1 -1
- package/dist/proto/handle_pb.d.cts +13 -15
- package/dist/proto/handle_pb.d.ts +13 -15
- package/dist/proto/handle_pb.d.ts.map +1 -1
- package/dist/proto/handle_pb.js +26 -5
- package/dist/proto/handle_pb.js.map +1 -1
- package/dist/proto/participant_pb.cjs +112 -15
- package/dist/proto/participant_pb.cjs.map +1 -1
- package/dist/proto/participant_pb.d.cts +140 -52
- package/dist/proto/participant_pb.d.ts +140 -52
- package/dist/proto/participant_pb.d.ts.map +1 -1
- package/dist/proto/participant_pb.js +109 -11
- package/dist/proto/participant_pb.js.map +1 -1
- package/dist/proto/room_pb.cjs +2693 -302
- package/dist/proto/room_pb.cjs.map +1 -1
- package/dist/proto/room_pb.d.cts +1265 -862
- package/dist/proto/room_pb.d.ts +1265 -862
- package/dist/proto/room_pb.d.ts.map +1 -1
- package/dist/proto/room_pb.js +2603 -210
- package/dist/proto/room_pb.js.map +1 -1
- package/dist/proto/rpc_pb.cjs +302 -37
- package/dist/proto/rpc_pb.cjs.map +1 -1
- package/dist/proto/rpc_pb.d.cts +138 -108
- package/dist/proto/rpc_pb.d.ts +138 -108
- package/dist/proto/rpc_pb.d.ts.map +1 -1
- package/dist/proto/rpc_pb.js +291 -25
- package/dist/proto/rpc_pb.js.map +1 -1
- package/dist/proto/stats_pb.cjs +1253 -139
- package/dist/proto/stats_pb.cjs.map +1 -1
- package/dist/proto/stats_pb.d.cts +803 -692
- package/dist/proto/stats_pb.d.ts +803 -692
- package/dist/proto/stats_pb.d.ts.map +1 -1
- package/dist/proto/stats_pb.js +1216 -93
- package/dist/proto/stats_pb.js.map +1 -1
- package/dist/proto/track_pb.cjs +462 -64
- package/dist/proto/track_pb.cjs.map +1 -1
- package/dist/proto/track_pb.d.cts +250 -218
- package/dist/proto/track_pb.d.ts +250 -218
- package/dist/proto/track_pb.d.ts.map +1 -1
- package/dist/proto/track_pb.js +447 -45
- package/dist/proto/track_pb.js.map +1 -1
- package/dist/proto/track_publication_pb.cjs +130 -0
- package/dist/proto/track_publication_pb.cjs.map +1 -0
- package/dist/proto/track_publication_pb.d.cts +80 -0
- package/dist/proto/track_publication_pb.d.ts +80 -0
- package/dist/proto/track_publication_pb.d.ts.map +1 -0
- package/dist/proto/track_publication_pb.js +103 -0
- package/dist/proto/track_publication_pb.js.map +1 -0
- package/dist/proto/video_frame_pb.cjs +648 -88
- package/dist/proto/video_frame_pb.cjs.map +1 -1
- package/dist/proto/video_frame_pb.d.cts +371 -328
- package/dist/proto/video_frame_pb.d.ts +371 -328
- package/dist/proto/video_frame_pb.d.ts.map +1 -1
- package/dist/proto/video_frame_pb.js +626 -60
- package/dist/proto/video_frame_pb.js.map +1 -1
- package/dist/room.cjs +85 -125
- package/dist/room.cjs.map +1 -1
- package/dist/room.d.cts +6 -17
- package/dist/room.d.ts +6 -17
- package/dist/room.d.ts.map +1 -1
- package/dist/room.js +85 -123
- package/dist/room.js.map +1 -1
- package/dist/rpc.cjs.map +1 -1
- package/dist/rpc.d.cts +0 -1
- package/dist/rpc.d.ts +0 -1
- package/dist/rpc.js.map +1 -1
- package/dist/track.cjs +12 -8
- package/dist/track.cjs.map +1 -1
- package/dist/track.d.cts +8 -9
- package/dist/track.d.ts +8 -9
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +13 -9
- package/dist/track.js.map +1 -1
- package/dist/track_publication.cjs +21 -12
- package/dist/track_publication.cjs.map +1 -1
- package/dist/track_publication.d.cts +12 -13
- package/dist/track_publication.d.ts +12 -13
- package/dist/track_publication.d.ts.map +1 -1
- package/dist/track_publication.js +22 -13
- package/dist/track_publication.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/video_frame.cjs +26 -45
- package/dist/video_frame.cjs.map +1 -1
- package/dist/video_frame.d.cts +2 -3
- package/dist/video_frame.d.ts +2 -3
- package/dist/video_frame.d.ts.map +1 -1
- package/dist/video_frame.js +29 -48
- package/dist/video_frame.js.map +1 -1
- package/dist/video_source.cjs +7 -4
- package/dist/video_source.cjs.map +1 -1
- package/dist/video_source.d.cts +4 -4
- package/dist/video_source.d.ts +4 -4
- package/dist/video_source.d.ts.map +1 -1
- package/dist/video_source.js +9 -6
- package/dist/video_source.js.map +1 -1
- package/dist/video_stream.cjs +16 -5
- package/dist/video_stream.cjs.map +1 -1
- package/dist/video_stream.d.cts +3 -4
- package/dist/video_stream.d.ts +3 -4
- package/dist/video_stream.d.ts.map +1 -1
- package/dist/video_stream.js +17 -6
- package/dist/video_stream.js.map +1 -1
- package/package.json +9 -9
- package/src/audio_frame.ts +10 -10
- package/src/audio_resampler.ts +15 -13
- package/src/audio_source.ts +11 -8
- package/src/audio_stream.ts +3 -4
- package/src/e2ee.ts +41 -42
- package/src/ffi_client.ts +8 -16
- package/src/index.ts +5 -68
- package/src/napi/native.d.ts +5 -5
- package/src/participant.ts +102 -73
- package/src/proto/audio_frame_pb.ts +1220 -496
- package/src/proto/e2ee_pb.ts +858 -337
- package/src/proto/ffi_pb.ts +442 -135
- package/src/proto/handle_pb.ts +33 -19
- package/src/proto/participant_pb.ts +225 -60
- package/src/proto/room_pb.ts +3149 -1013
- package/src/proto/rpc_pb.ts +358 -129
- package/src/proto/stats_pb.ts +1891 -877
- package/src/proto/track_pb.ts +587 -253
- package/src/proto/track_publication_pb.ts +180 -0
- package/src/proto/video_frame_pb.ts +861 -394
- package/src/room.ts +137 -189
- package/src/rpc.ts +1 -1
- package/src/track.ts +16 -17
- package/src/track_publication.ts +25 -26
- package/src/version.ts +1 -1
- package/src/video_frame.ts +48 -72
- package/src/video_source.ts +11 -8
- package/src/video_stream.ts +18 -8
package/src/participant.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
|
|
2
2
|
//
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
import { create } from '@bufbuild/protobuf';
|
|
5
4
|
import { FfiClient, FfiHandle } from './ffi_client.js';
|
|
6
|
-
import
|
|
5
|
+
import {
|
|
6
|
+
DisconnectReason,
|
|
7
|
+
type OwnedParticipant,
|
|
8
|
+
type ParticipantInfo,
|
|
9
|
+
type ParticipantKind,
|
|
10
|
+
} from './proto/participant_pb.js';
|
|
7
11
|
import type {
|
|
8
12
|
PublishDataCallback,
|
|
9
13
|
PublishDataResponse,
|
|
@@ -25,26 +29,20 @@ import type {
|
|
|
25
29
|
UnpublishTrackCallback,
|
|
26
30
|
UnpublishTrackResponse,
|
|
27
31
|
} from './proto/room_pb.js';
|
|
32
|
+
import { ChatMessage as ChatMessageModel } from './proto/room_pb.js';
|
|
28
33
|
import {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
EditChatMessageRequest,
|
|
35
|
+
TranscriptionSegment as ProtoTranscriptionSegment,
|
|
36
|
+
PublishDataRequest,
|
|
37
|
+
PublishSipDtmfRequest,
|
|
38
|
+
PublishTrackRequest,
|
|
39
|
+
PublishTranscriptionRequest,
|
|
40
|
+
SendChatMessageRequest,
|
|
41
|
+
SetLocalAttributesRequest,
|
|
42
|
+
SetLocalMetadataRequest,
|
|
43
|
+
SetLocalNameRequest,
|
|
44
|
+
UnpublishTrackRequest,
|
|
40
45
|
} from './proto/room_pb.js';
|
|
41
|
-
import { TranscriptionSegmentSchema } from './proto/room_pb.js';
|
|
42
|
-
import {
|
|
43
|
-
PerformRpcRequestSchema,
|
|
44
|
-
RegisterRpcMethodRequestSchema,
|
|
45
|
-
RpcMethodInvocationResponseRequestSchema,
|
|
46
|
-
UnregisterRpcMethodRequestSchema,
|
|
47
|
-
} from './proto/rpc_pb.js';
|
|
48
46
|
import type {
|
|
49
47
|
PerformRpcCallback,
|
|
50
48
|
PerformRpcResponse,
|
|
@@ -52,6 +50,12 @@ import type {
|
|
|
52
50
|
RpcMethodInvocationResponseResponse,
|
|
53
51
|
UnregisterRpcMethodResponse,
|
|
54
52
|
} from './proto/rpc_pb.js';
|
|
53
|
+
import {
|
|
54
|
+
PerformRpcRequest,
|
|
55
|
+
RegisterRpcMethodRequest,
|
|
56
|
+
RpcMethodInvocationResponseRequest,
|
|
57
|
+
UnregisterRpcMethodRequest,
|
|
58
|
+
} from './proto/rpc_pb.js';
|
|
55
59
|
import { type PerformRpcParams, RpcError, type RpcInvocationData } from './rpc.js';
|
|
56
60
|
import type { LocalTrack } from './track.js';
|
|
57
61
|
import type { RemoteTrackPublication, TrackPublication } from './track_publication.js';
|
|
@@ -69,33 +73,40 @@ export abstract class Participant {
|
|
|
69
73
|
trackPublications = new Map<string, TrackPublication>();
|
|
70
74
|
|
|
71
75
|
constructor(owned_info: OwnedParticipant) {
|
|
72
|
-
this.info = owned_info
|
|
73
|
-
this.ffi_handle = new FfiHandle(owned_info.handle!.id);
|
|
76
|
+
this.info = owned_info!.info!;
|
|
77
|
+
this.ffi_handle = new FfiHandle(owned_info.handle!.id!);
|
|
74
78
|
}
|
|
75
79
|
|
|
76
|
-
get sid(): string {
|
|
80
|
+
get sid(): string | undefined {
|
|
77
81
|
return this.info.sid;
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
get name(): string {
|
|
84
|
+
get name(): string | undefined {
|
|
81
85
|
return this.info.name;
|
|
82
86
|
}
|
|
83
87
|
|
|
84
|
-
get identity(): string {
|
|
88
|
+
get identity(): string | undefined {
|
|
85
89
|
return this.info.identity;
|
|
86
90
|
}
|
|
87
91
|
|
|
88
|
-
get metadata(): string {
|
|
92
|
+
get metadata(): string | undefined {
|
|
89
93
|
return this.info.metadata;
|
|
90
94
|
}
|
|
91
95
|
|
|
92
|
-
get attributes(): Record<string, string> {
|
|
96
|
+
get attributes(): Record<string, string> | undefined {
|
|
93
97
|
return this.info.attributes;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
get kind(): ParticipantKind {
|
|
100
|
+
get kind(): ParticipantKind | undefined {
|
|
97
101
|
return this.info.kind;
|
|
98
102
|
}
|
|
103
|
+
|
|
104
|
+
get disconnectReason(): DisconnectReason | undefined {
|
|
105
|
+
if (this.info.disconnectReason === DisconnectReason.UNKNOWN_REASON) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
return this.info.disconnectReason;
|
|
109
|
+
}
|
|
99
110
|
}
|
|
100
111
|
|
|
101
112
|
export type DataPublishOptions = {
|
|
@@ -120,7 +131,7 @@ export class LocalParticipant extends Participant {
|
|
|
120
131
|
trackPublications: Map<string, LocalTrackPublication> = new Map();
|
|
121
132
|
|
|
122
133
|
async publishData(data: Uint8Array, options: DataPublishOptions) {
|
|
123
|
-
const req =
|
|
134
|
+
const req = new PublishDataRequest({
|
|
124
135
|
localParticipantHandle: this.ffi_handle.handle,
|
|
125
136
|
dataPtr: FfiClient.instance.retrievePtr(data),
|
|
126
137
|
dataLen: BigInt(data.byteLength),
|
|
@@ -143,7 +154,7 @@ export class LocalParticipant extends Participant {
|
|
|
143
154
|
}
|
|
144
155
|
|
|
145
156
|
async publishDtmf(code: number, digit: string) {
|
|
146
|
-
const req =
|
|
157
|
+
const req = new PublishSipDtmfRequest({
|
|
147
158
|
localParticipantHandle: this.ffi_handle.handle,
|
|
148
159
|
code,
|
|
149
160
|
digit,
|
|
@@ -163,18 +174,19 @@ export class LocalParticipant extends Participant {
|
|
|
163
174
|
}
|
|
164
175
|
|
|
165
176
|
async publishTranscription(transcription: Transcription) {
|
|
166
|
-
const req =
|
|
177
|
+
const req = new PublishTranscriptionRequest({
|
|
167
178
|
localParticipantHandle: this.ffi_handle.handle,
|
|
168
179
|
participantIdentity: transcription.participantIdentity,
|
|
169
|
-
segments: transcription.segments.map(
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
180
|
+
segments: transcription.segments.map(
|
|
181
|
+
(s) =>
|
|
182
|
+
new ProtoTranscriptionSegment({
|
|
183
|
+
id: s.id,
|
|
184
|
+
text: s.text,
|
|
185
|
+
startTime: s.startTime,
|
|
186
|
+
endTime: s.endTime,
|
|
187
|
+
final: s.final,
|
|
188
|
+
language: s.language,
|
|
189
|
+
}),
|
|
178
190
|
),
|
|
179
191
|
trackId: transcription.trackSid,
|
|
180
192
|
});
|
|
@@ -193,7 +205,7 @@ export class LocalParticipant extends Participant {
|
|
|
193
205
|
}
|
|
194
206
|
|
|
195
207
|
async updateMetadata(metadata: string) {
|
|
196
|
-
const req =
|
|
208
|
+
const req = new SetLocalMetadataRequest({
|
|
197
209
|
localParticipantHandle: this.ffi_handle.handle,
|
|
198
210
|
metadata: metadata,
|
|
199
211
|
});
|
|
@@ -220,7 +232,7 @@ export class LocalParticipant extends Participant {
|
|
|
220
232
|
destinationIdentities?: Array<string>,
|
|
221
233
|
senderIdentity?: string,
|
|
222
234
|
): Promise<ChatMessage> {
|
|
223
|
-
const req =
|
|
235
|
+
const req = new SendChatMessageRequest({
|
|
224
236
|
localParticipantHandle: this.ffi_handle.handle,
|
|
225
237
|
message: text,
|
|
226
238
|
destinationIdentities,
|
|
@@ -235,11 +247,19 @@ export class LocalParticipant extends Participant {
|
|
|
235
247
|
return ev.message.case == 'chatMessage' && ev.message.value.asyncId == res.asyncId;
|
|
236
248
|
});
|
|
237
249
|
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
switch (cb.message.case) {
|
|
251
|
+
case 'chatMessage':
|
|
252
|
+
const { id, timestamp, editTimestamp, message } = cb.message.value!;
|
|
253
|
+
return {
|
|
254
|
+
id: id!,
|
|
255
|
+
timestamp: Number(timestamp),
|
|
256
|
+
editTimestamp: Number(editTimestamp),
|
|
257
|
+
message: message!,
|
|
258
|
+
};
|
|
259
|
+
case 'error':
|
|
260
|
+
default:
|
|
261
|
+
throw new Error(cb.message.value);
|
|
240
262
|
}
|
|
241
|
-
const { id, timestamp, editTimestamp, message } = cb.message.value;
|
|
242
|
-
return { id, timestamp: Number(timestamp), editTimestamp: Number(editTimestamp), message };
|
|
243
263
|
}
|
|
244
264
|
|
|
245
265
|
/**
|
|
@@ -251,10 +271,10 @@ export class LocalParticipant extends Participant {
|
|
|
251
271
|
destinationIdentities?: Array<string>,
|
|
252
272
|
senderIdentity?: string,
|
|
253
273
|
): Promise<ChatMessage> {
|
|
254
|
-
const req =
|
|
274
|
+
const req = new EditChatMessageRequest({
|
|
255
275
|
localParticipantHandle: this.ffi_handle.handle,
|
|
256
276
|
editText,
|
|
257
|
-
originalMessage:
|
|
277
|
+
originalMessage: new ChatMessageModel({
|
|
258
278
|
...originalMessage,
|
|
259
279
|
timestamp: BigInt(originalMessage.timestamp),
|
|
260
280
|
editTimestamp: originalMessage.editTimestamp
|
|
@@ -273,15 +293,23 @@ export class LocalParticipant extends Participant {
|
|
|
273
293
|
return ev.message.case == 'chatMessage' && ev.message.value.asyncId == res.asyncId;
|
|
274
294
|
});
|
|
275
295
|
|
|
276
|
-
|
|
277
|
-
|
|
296
|
+
switch (cb.message.case) {
|
|
297
|
+
case 'chatMessage':
|
|
298
|
+
const { id, timestamp, editTimestamp, message } = cb.message.value!;
|
|
299
|
+
return {
|
|
300
|
+
id: id!,
|
|
301
|
+
timestamp: Number(timestamp),
|
|
302
|
+
editTimestamp: Number(editTimestamp),
|
|
303
|
+
message: message!,
|
|
304
|
+
};
|
|
305
|
+
case 'error':
|
|
306
|
+
default:
|
|
307
|
+
throw new Error(cb.message.value);
|
|
278
308
|
}
|
|
279
|
-
const { id, timestamp, editTimestamp, message } = cb.message.value;
|
|
280
|
-
return { id, timestamp: Number(timestamp), editTimestamp: Number(editTimestamp), message };
|
|
281
309
|
}
|
|
282
310
|
|
|
283
311
|
async updateName(name: string) {
|
|
284
|
-
const req =
|
|
312
|
+
const req = new SetLocalNameRequest({
|
|
285
313
|
localParticipantHandle: this.ffi_handle.handle,
|
|
286
314
|
name: name,
|
|
287
315
|
});
|
|
@@ -296,11 +324,9 @@ export class LocalParticipant extends Participant {
|
|
|
296
324
|
}
|
|
297
325
|
|
|
298
326
|
async setAttributes(attributes: Record<string, string>) {
|
|
299
|
-
const req =
|
|
327
|
+
const req = new SetLocalAttributesRequest({
|
|
300
328
|
localParticipantHandle: this.ffi_handle.handle,
|
|
301
|
-
attributes:
|
|
302
|
-
return { key, value };
|
|
303
|
-
}),
|
|
329
|
+
attributes: Object.entries(attributes).map(([key, value]) => ({ key, value })),
|
|
304
330
|
});
|
|
305
331
|
|
|
306
332
|
const res = FfiClient.instance.request<SetLocalAttributesResponse>({
|
|
@@ -316,7 +342,7 @@ export class LocalParticipant extends Participant {
|
|
|
316
342
|
track: LocalTrack,
|
|
317
343
|
options: TrackPublishOptions,
|
|
318
344
|
): Promise<LocalTrackPublication> {
|
|
319
|
-
const req =
|
|
345
|
+
const req = new PublishTrackRequest({
|
|
320
346
|
localParticipantHandle: this.ffi_handle.handle,
|
|
321
347
|
trackHandle: track.ffi_handle.handle,
|
|
322
348
|
options: options,
|
|
@@ -330,21 +356,24 @@ export class LocalParticipant extends Participant {
|
|
|
330
356
|
return ev.message.case == 'publishTrack' && ev.message.value.asyncId == res.asyncId;
|
|
331
357
|
});
|
|
332
358
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
track_publication.track = track;
|
|
339
|
-
this.trackPublications.set(track_publication.sid, track_publication);
|
|
359
|
+
switch (cb.message.case) {
|
|
360
|
+
case 'publication':
|
|
361
|
+
const track_publication = new LocalTrackPublication(cb.message.value!);
|
|
362
|
+
track_publication.track = track;
|
|
363
|
+
this.trackPublications.set(track_publication.sid!, track_publication);
|
|
340
364
|
|
|
341
|
-
|
|
365
|
+
return track_publication;
|
|
366
|
+
case 'error':
|
|
367
|
+
default:
|
|
368
|
+
throw new Error(cb.message.value);
|
|
369
|
+
}
|
|
342
370
|
}
|
|
343
371
|
|
|
344
|
-
async unpublishTrack(trackSid: string) {
|
|
345
|
-
const req =
|
|
372
|
+
async unpublishTrack(trackSid: string, stopOnUnpublish?: boolean) {
|
|
373
|
+
const req = new UnpublishTrackRequest({
|
|
346
374
|
localParticipantHandle: this.ffi_handle.handle,
|
|
347
375
|
trackSid: trackSid,
|
|
376
|
+
stopOnUnpublish: stopOnUnpublish ?? true,
|
|
348
377
|
});
|
|
349
378
|
|
|
350
379
|
const res = FfiClient.instance.request<UnpublishTrackResponse>({
|
|
@@ -378,7 +407,7 @@ export class LocalParticipant extends Participant {
|
|
|
378
407
|
payload,
|
|
379
408
|
responseTimeout,
|
|
380
409
|
}: PerformRpcParams): Promise<string> {
|
|
381
|
-
const req =
|
|
410
|
+
const req = new PerformRpcRequest({
|
|
382
411
|
localParticipantHandle: this.ffi_handle.handle,
|
|
383
412
|
destinationIdentity,
|
|
384
413
|
method,
|
|
@@ -398,7 +427,7 @@ export class LocalParticipant extends Participant {
|
|
|
398
427
|
throw RpcError.fromProto(cb.error);
|
|
399
428
|
}
|
|
400
429
|
|
|
401
|
-
return cb.payload
|
|
430
|
+
return cb.payload!;
|
|
402
431
|
}
|
|
403
432
|
|
|
404
433
|
/**
|
|
@@ -432,7 +461,7 @@ export class LocalParticipant extends Participant {
|
|
|
432
461
|
registerRpcMethod(method: string, handler: (data: RpcInvocationData) => Promise<string>) {
|
|
433
462
|
this.rpcHandlers.set(method, handler);
|
|
434
463
|
|
|
435
|
-
const req =
|
|
464
|
+
const req = new RegisterRpcMethodRequest({
|
|
436
465
|
localParticipantHandle: this.ffi_handle.handle,
|
|
437
466
|
method,
|
|
438
467
|
});
|
|
@@ -450,7 +479,7 @@ export class LocalParticipant extends Participant {
|
|
|
450
479
|
unregisterRpcMethod(method: string) {
|
|
451
480
|
this.rpcHandlers.delete(method);
|
|
452
481
|
|
|
453
|
-
const req =
|
|
482
|
+
const req = new UnregisterRpcMethodRequest({
|
|
454
483
|
localParticipantHandle: this.ffi_handle.handle,
|
|
455
484
|
method,
|
|
456
485
|
});
|
|
@@ -492,7 +521,7 @@ export class LocalParticipant extends Participant {
|
|
|
492
521
|
}
|
|
493
522
|
}
|
|
494
523
|
|
|
495
|
-
const req =
|
|
524
|
+
const req = new RpcMethodInvocationResponseRequest({
|
|
496
525
|
localParticipantHandle: this.ffi_handle.handle,
|
|
497
526
|
invocationId,
|
|
498
527
|
error: responseError ? responseError.toProto() : undefined,
|