livekit-server-sdk 1.1.3 → 1.2.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/.github/banner_dark.png +0 -0
- package/.github/banner_light.png +0 -0
- package/README.md +25 -1
- package/dist/AccessToken.d.ts +56 -0
- package/dist/AccessToken.js +118 -0
- package/dist/AccessToken.js.map +1 -0
- package/dist/AccessToken.test.d.ts +1 -0
- package/dist/AccessToken.test.js +72 -0
- package/dist/AccessToken.test.js.map +1 -0
- package/dist/EgressClient.d.ts +128 -0
- package/dist/EgressClient.js +263 -0
- package/dist/EgressClient.js.map +1 -0
- package/dist/IngressClient.d.ts +84 -0
- package/dist/IngressClient.js +112 -0
- package/dist/IngressClient.js.map +1 -0
- package/dist/RoomServiceClient.d.ts +132 -0
- package/dist/RoomServiceClient.js +189 -0
- package/dist/RoomServiceClient.js.map +1 -0
- package/dist/ServiceBase.d.ts +16 -0
- package/dist/ServiceBase.js +27 -0
- package/dist/ServiceBase.js.map +1 -0
- package/dist/TwirpRPC.d.ts +16 -0
- package/dist/TwirpRPC.js +37 -0
- package/dist/TwirpRPC.js.map +1 -0
- package/dist/WebhookReceiver.d.ts +14 -0
- package/dist/WebhookReceiver.js +40 -0
- package/dist/WebhookReceiver.js.map +1 -0
- package/dist/WebhookReceiver.test.d.ts +1 -0
- package/dist/WebhookReceiver.test.js +39 -0
- package/dist/WebhookReceiver.test.js.map +1 -0
- package/dist/grants.d.ts +53 -0
- package/dist/grants.js +11 -0
- package/dist/grants.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +50 -0
- package/dist/index.js.map +1 -0
- package/dist/proto/google/protobuf/timestamp.d.ts +132 -0
- package/dist/proto/google/protobuf/timestamp.js +92 -0
- package/dist/proto/google/protobuf/timestamp.js.map +1 -0
- package/dist/proto/livekit_egress.d.ts +11266 -0
- package/dist/proto/livekit_egress.js +2869 -0
- package/dist/proto/livekit_egress.js.map +1 -0
- package/dist/proto/livekit_ingress.d.ts +2163 -0
- package/dist/proto/livekit_ingress.js +1264 -0
- package/dist/proto/livekit_ingress.js.map +1 -0
- package/dist/proto/livekit_models.d.ts +1356 -0
- package/dist/proto/livekit_models.js +2893 -0
- package/dist/proto/livekit_models.js.map +1 -0
- package/dist/proto/livekit_room.d.ts +3273 -0
- package/dist/proto/livekit_room.js +1057 -0
- package/dist/proto/livekit_room.js.map +1 -0
- package/dist/proto/livekit_webhook.d.ts +4841 -0
- package/dist/proto/livekit_webhook.js +179 -0
- package/dist/proto/livekit_webhook.js.map +1 -0
- package/package.json +7 -6
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.EgressClient = void 0;
|
|
16
|
+
const livekit_egress_1 = require("./proto/livekit_egress");
|
|
17
|
+
const ServiceBase_1 = __importDefault(require("./ServiceBase"));
|
|
18
|
+
const TwirpRPC_1 = require("./TwirpRPC");
|
|
19
|
+
const svc = 'Egress';
|
|
20
|
+
/**
|
|
21
|
+
* Client to access Egress APIs
|
|
22
|
+
*/
|
|
23
|
+
class EgressClient extends ServiceBase_1.default {
|
|
24
|
+
/**
|
|
25
|
+
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
26
|
+
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
27
|
+
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
28
|
+
*/
|
|
29
|
+
constructor(host, apiKey, secret) {
|
|
30
|
+
super(apiKey, secret);
|
|
31
|
+
this.rpc = new TwirpRPC_1.TwirpRpc(host, TwirpRPC_1.livekitPackage);
|
|
32
|
+
}
|
|
33
|
+
startRoomCompositeEgress(roomName, output, optsOrLayout, options, audioOnly, videoOnly, customBaseUrl) {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
let layout;
|
|
36
|
+
if (optsOrLayout !== undefined) {
|
|
37
|
+
if (typeof optsOrLayout === 'string') {
|
|
38
|
+
layout = optsOrLayout;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const opts = optsOrLayout;
|
|
42
|
+
layout = opts.layout;
|
|
43
|
+
options = opts.encodingOptions;
|
|
44
|
+
audioOnly = opts.audioOnly;
|
|
45
|
+
videoOnly = opts.videoOnly;
|
|
46
|
+
customBaseUrl = opts.customBaseUrl;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
layout !== null && layout !== void 0 ? layout : (layout = '');
|
|
50
|
+
audioOnly !== null && audioOnly !== void 0 ? audioOnly : (audioOnly = false);
|
|
51
|
+
videoOnly !== null && videoOnly !== void 0 ? videoOnly : (videoOnly = false);
|
|
52
|
+
customBaseUrl !== null && customBaseUrl !== void 0 ? customBaseUrl : (customBaseUrl = '');
|
|
53
|
+
const { file, stream, segments, preset, advanced, fileOutputs, streamOutputs, segmentOutputs } = this.getOutputParams(output, options);
|
|
54
|
+
const req = livekit_egress_1.RoomCompositeEgressRequest.toJSON({
|
|
55
|
+
roomName,
|
|
56
|
+
layout,
|
|
57
|
+
audioOnly,
|
|
58
|
+
videoOnly,
|
|
59
|
+
customBaseUrl,
|
|
60
|
+
file,
|
|
61
|
+
stream,
|
|
62
|
+
segments,
|
|
63
|
+
preset,
|
|
64
|
+
advanced,
|
|
65
|
+
fileOutputs,
|
|
66
|
+
streamOutputs,
|
|
67
|
+
segmentOutputs,
|
|
68
|
+
});
|
|
69
|
+
const data = yield this.rpc.request(svc, 'StartRoomCompositeEgress', req, this.authHeader({ roomRecord: true }));
|
|
70
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* @param url url
|
|
75
|
+
* @param output file or stream output
|
|
76
|
+
* @param opts WebOptions
|
|
77
|
+
*/
|
|
78
|
+
startWebEgress(url, output, opts) {
|
|
79
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const audioOnly = (opts === null || opts === void 0 ? void 0 : opts.audioOnly) || false;
|
|
81
|
+
const videoOnly = (opts === null || opts === void 0 ? void 0 : opts.videoOnly) || false;
|
|
82
|
+
const { file, stream, segments, preset, advanced, fileOutputs, streamOutputs, segmentOutputs } = this.getOutputParams(output, opts === null || opts === void 0 ? void 0 : opts.encodingOptions);
|
|
83
|
+
const req = livekit_egress_1.WebEgressRequest.toJSON({
|
|
84
|
+
url,
|
|
85
|
+
audioOnly,
|
|
86
|
+
videoOnly,
|
|
87
|
+
file,
|
|
88
|
+
stream,
|
|
89
|
+
segments,
|
|
90
|
+
preset,
|
|
91
|
+
advanced,
|
|
92
|
+
fileOutputs,
|
|
93
|
+
streamOutputs,
|
|
94
|
+
segmentOutputs,
|
|
95
|
+
});
|
|
96
|
+
const data = yield this.rpc.request(svc, 'StartWebEgress', req, this.authHeader({ roomRecord: true }));
|
|
97
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
startTrackCompositeEgress(roomName, output, optsOrAudioTrackId, videoTrackId, options) {
|
|
101
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
+
let audioTrackId;
|
|
103
|
+
if (optsOrAudioTrackId !== undefined) {
|
|
104
|
+
if (typeof optsOrAudioTrackId === 'string') {
|
|
105
|
+
audioTrackId = optsOrAudioTrackId;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const opts = optsOrAudioTrackId;
|
|
109
|
+
audioTrackId = opts.audioTrackId;
|
|
110
|
+
videoTrackId = opts.videoTrackId;
|
|
111
|
+
options = opts.encodingOptions;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
audioTrackId !== null && audioTrackId !== void 0 ? audioTrackId : (audioTrackId = '');
|
|
115
|
+
videoTrackId !== null && videoTrackId !== void 0 ? videoTrackId : (videoTrackId = '');
|
|
116
|
+
const { file, stream, segments, preset, advanced, fileOutputs, streamOutputs, segmentOutputs } = this.getOutputParams(output, options);
|
|
117
|
+
const req = livekit_egress_1.TrackCompositeEgressRequest.toJSON({
|
|
118
|
+
roomName,
|
|
119
|
+
audioTrackId,
|
|
120
|
+
videoTrackId,
|
|
121
|
+
file,
|
|
122
|
+
stream,
|
|
123
|
+
segments,
|
|
124
|
+
preset,
|
|
125
|
+
advanced,
|
|
126
|
+
fileOutputs,
|
|
127
|
+
streamOutputs,
|
|
128
|
+
segmentOutputs,
|
|
129
|
+
});
|
|
130
|
+
const data = yield this.rpc.request(svc, 'StartTrackCompositeEgress', req, this.authHeader({ roomRecord: true }));
|
|
131
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
isEncodedOutputs(output) {
|
|
135
|
+
return (output.file !== undefined ||
|
|
136
|
+
output.stream !== undefined ||
|
|
137
|
+
output.segments !== undefined);
|
|
138
|
+
}
|
|
139
|
+
isEncodedFileOutput(output) {
|
|
140
|
+
return (output.filepath !== undefined ||
|
|
141
|
+
output.fileType !== undefined);
|
|
142
|
+
}
|
|
143
|
+
isSegmentedFileOutput(output) {
|
|
144
|
+
return (output.filenamePrefix !== undefined ||
|
|
145
|
+
output.playlistName !== undefined ||
|
|
146
|
+
output.filenameSuffix !== undefined);
|
|
147
|
+
}
|
|
148
|
+
isStreamOutput(output) {
|
|
149
|
+
return (output.protocol !== undefined || output.urls !== undefined);
|
|
150
|
+
}
|
|
151
|
+
getOutputParams(output, options) {
|
|
152
|
+
let file;
|
|
153
|
+
let fileOutputs;
|
|
154
|
+
let stream;
|
|
155
|
+
let streamOutputs;
|
|
156
|
+
let segments;
|
|
157
|
+
let segmentOutputs;
|
|
158
|
+
let preset;
|
|
159
|
+
let advanced;
|
|
160
|
+
if (this.isEncodedOutputs(output)) {
|
|
161
|
+
if (output.file !== undefined) {
|
|
162
|
+
fileOutputs = [output.file];
|
|
163
|
+
}
|
|
164
|
+
if (output.stream !== undefined) {
|
|
165
|
+
streamOutputs = [output.stream];
|
|
166
|
+
}
|
|
167
|
+
if (output.segments !== undefined) {
|
|
168
|
+
segmentOutputs = [output.segments];
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
else if (this.isEncodedFileOutput(output)) {
|
|
172
|
+
file = output;
|
|
173
|
+
fileOutputs = [file];
|
|
174
|
+
}
|
|
175
|
+
else if (this.isSegmentedFileOutput(output)) {
|
|
176
|
+
segments = output;
|
|
177
|
+
segmentOutputs = [segments];
|
|
178
|
+
}
|
|
179
|
+
else if (this.isStreamOutput(output)) {
|
|
180
|
+
stream = output;
|
|
181
|
+
streamOutputs = [stream];
|
|
182
|
+
}
|
|
183
|
+
if (options) {
|
|
184
|
+
if (typeof options === 'number') {
|
|
185
|
+
preset = options;
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
advanced = options;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return { file, stream, segments, preset, advanced, fileOutputs, streamOutputs, segmentOutputs };
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* @param roomName room name
|
|
195
|
+
* @param output file or websocket output
|
|
196
|
+
* @param trackId track Id
|
|
197
|
+
*/
|
|
198
|
+
startTrackEgress(roomName, output, trackId) {
|
|
199
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
200
|
+
let file;
|
|
201
|
+
let websocketUrl;
|
|
202
|
+
if (typeof output === 'string') {
|
|
203
|
+
websocketUrl = output;
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
file = output;
|
|
207
|
+
}
|
|
208
|
+
const req = livekit_egress_1.TrackEgressRequest.toJSON({
|
|
209
|
+
roomName,
|
|
210
|
+
trackId,
|
|
211
|
+
file,
|
|
212
|
+
websocketUrl,
|
|
213
|
+
});
|
|
214
|
+
const data = yield this.rpc.request(svc, 'StartTrackEgress', req, this.authHeader({ roomRecord: true }));
|
|
215
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* @param egressId
|
|
220
|
+
* @param layout
|
|
221
|
+
*/
|
|
222
|
+
updateLayout(egressId, layout) {
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
const data = yield this.rpc.request(svc, 'UpdateLayout', livekit_egress_1.UpdateLayoutRequest.toJSON({ egressId, layout }), this.authHeader({ roomRecord: true }));
|
|
225
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* @param egressId
|
|
230
|
+
* @param addOutputUrls
|
|
231
|
+
* @param removeOutputUrls
|
|
232
|
+
*/
|
|
233
|
+
updateStream(egressId, addOutputUrls, removeOutputUrls) {
|
|
234
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
235
|
+
addOutputUrls !== null && addOutputUrls !== void 0 ? addOutputUrls : (addOutputUrls = []);
|
|
236
|
+
removeOutputUrls !== null && removeOutputUrls !== void 0 ? removeOutputUrls : (removeOutputUrls = []);
|
|
237
|
+
const data = yield this.rpc.request(svc, 'UpdateStream', livekit_egress_1.UpdateStreamRequest.toJSON({ egressId, addOutputUrls, removeOutputUrls }), this.authHeader({ roomRecord: true }));
|
|
238
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* @param roomName list egress for one room only
|
|
243
|
+
*/
|
|
244
|
+
listEgress(roomName) {
|
|
245
|
+
var _a;
|
|
246
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
247
|
+
roomName !== null && roomName !== void 0 ? roomName : (roomName = '');
|
|
248
|
+
const data = yield this.rpc.request(svc, 'ListEgress', livekit_egress_1.ListEgressRequest.toJSON({ roomName }), this.authHeader({ roomRecord: true }));
|
|
249
|
+
return (_a = livekit_egress_1.ListEgressResponse.fromJSON(data).items) !== null && _a !== void 0 ? _a : [];
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* @param egressId
|
|
254
|
+
*/
|
|
255
|
+
stopEgress(egressId) {
|
|
256
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
257
|
+
const data = yield this.rpc.request(svc, 'StopEgress', livekit_egress_1.StopEgressRequest.toJSON({ egressId }), this.authHeader({ roomRecord: true }));
|
|
258
|
+
return livekit_egress_1.EgressInfo.fromJSON(data);
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
exports.EgressClient = EgressClient;
|
|
263
|
+
//# sourceMappingURL=EgressClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EgressClient.js","sourceRoot":"","sources":["../src/EgressClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2DAiBgC;AAChC,gEAAwC;AACxC,yCAA2D;AAE3D,MAAM,GAAG,GAAG,QAAQ,CAAC;AAgErB;;GAEG;AACH,MAAa,YAAa,SAAQ,qBAAW;IAG3C;;;;OAIG;IACH,YAAY,IAAY,EAAE,MAAe,EAAE,MAAe;QACxD,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACtB,IAAI,CAAC,GAAG,G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AAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACtC,CAAC;YACF,OAAO,MAAA,mCAAkB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,mCAAI,EAAE,CAAC;;KACtD;IAED;;OAEG;IACG,UAAU,CAAC,QAAgB;;YAC/B,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CACjC,GAAG,EACH,YAAY,EACZ,kCAAiB,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,EACtC,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CACtC,CAAC;YACF,OAAO,2BAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;KAAA;CACF;AA9WD,oCA8WC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { IngressAudioOptions, IngressInfo, IngressInput, IngressVideoOptions } from './proto/livekit_ingress';
|
|
2
|
+
import ServiceBase from './ServiceBase';
|
|
3
|
+
export interface CreateIngressOptions {
|
|
4
|
+
/**
|
|
5
|
+
* ingress name. optional
|
|
6
|
+
*/
|
|
7
|
+
name?: string;
|
|
8
|
+
/**
|
|
9
|
+
* name of the room to send media to. optional
|
|
10
|
+
*/
|
|
11
|
+
roomName?: string;
|
|
12
|
+
/**
|
|
13
|
+
* unique identity of the participant. optional
|
|
14
|
+
*/
|
|
15
|
+
participantIdentity?: string;
|
|
16
|
+
/**
|
|
17
|
+
* participant display name
|
|
18
|
+
*/
|
|
19
|
+
participantName?: string;
|
|
20
|
+
/**
|
|
21
|
+
* custom audio encoding parameters. optional
|
|
22
|
+
*/
|
|
23
|
+
audio?: IngressAudioOptions;
|
|
24
|
+
/**
|
|
25
|
+
* custom video encoding parameters. optional
|
|
26
|
+
*/
|
|
27
|
+
video?: IngressVideoOptions;
|
|
28
|
+
}
|
|
29
|
+
export interface UpdateIngressOptions {
|
|
30
|
+
/**
|
|
31
|
+
* ingress name. optional
|
|
32
|
+
*/
|
|
33
|
+
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* name of the room to send media to. optional
|
|
36
|
+
*/
|
|
37
|
+
roomName?: string;
|
|
38
|
+
/**
|
|
39
|
+
* unique identity of the participant. optional
|
|
40
|
+
*/
|
|
41
|
+
participantIdentity?: string;
|
|
42
|
+
/**
|
|
43
|
+
* participant display name
|
|
44
|
+
*/
|
|
45
|
+
participantName?: string;
|
|
46
|
+
/**
|
|
47
|
+
* custom audio encoding parameters. optional
|
|
48
|
+
*/
|
|
49
|
+
audio?: IngressAudioOptions;
|
|
50
|
+
/**
|
|
51
|
+
* custom video encoding parameters. optional
|
|
52
|
+
*/
|
|
53
|
+
video?: IngressVideoOptions;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Client to access Ingress APIs
|
|
57
|
+
*/
|
|
58
|
+
export declare class IngressClient extends ServiceBase {
|
|
59
|
+
private readonly rpc;
|
|
60
|
+
/**
|
|
61
|
+
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
62
|
+
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
63
|
+
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
64
|
+
*/
|
|
65
|
+
constructor(host: string, apiKey?: string, secret?: string);
|
|
66
|
+
/**
|
|
67
|
+
* @param inputType protocol for the ingress
|
|
68
|
+
* @param opts CreateIngressOptions
|
|
69
|
+
*/
|
|
70
|
+
createIngress(inputType: IngressInput, opts?: CreateIngressOptions): Promise<IngressInfo>;
|
|
71
|
+
/**
|
|
72
|
+
* @param ingressId ID of the ingress to update
|
|
73
|
+
* @param opts UpdateIngressOptions
|
|
74
|
+
*/
|
|
75
|
+
updateIngress(ingressId: string, opts: UpdateIngressOptions): Promise<IngressInfo>;
|
|
76
|
+
/**
|
|
77
|
+
* @param roomName list ingress for one room only
|
|
78
|
+
*/
|
|
79
|
+
listIngress(roomName?: string): Promise<Array<IngressInfo>>;
|
|
80
|
+
/**
|
|
81
|
+
* @param ingressId ingress to delete
|
|
82
|
+
*/
|
|
83
|
+
deleteIngress(ingressId: string): Promise<IngressInfo>;
|
|
84
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.IngressClient = void 0;
|
|
16
|
+
const livekit_ingress_1 = require("./proto/livekit_ingress");
|
|
17
|
+
const ServiceBase_1 = __importDefault(require("./ServiceBase"));
|
|
18
|
+
const TwirpRPC_1 = require("./TwirpRPC");
|
|
19
|
+
const svc = 'Ingress';
|
|
20
|
+
/**
|
|
21
|
+
* Client to access Ingress APIs
|
|
22
|
+
*/
|
|
23
|
+
class IngressClient extends ServiceBase_1.default {
|
|
24
|
+
/**
|
|
25
|
+
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
26
|
+
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
27
|
+
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
28
|
+
*/
|
|
29
|
+
constructor(host, apiKey, secret) {
|
|
30
|
+
super(apiKey, secret);
|
|
31
|
+
this.rpc = new TwirpRPC_1.TwirpRpc(host, TwirpRPC_1.livekitPackage);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @param inputType protocol for the ingress
|
|
35
|
+
* @param opts CreateIngressOptions
|
|
36
|
+
*/
|
|
37
|
+
createIngress(inputType, opts) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
let name = '';
|
|
40
|
+
let roomName = '';
|
|
41
|
+
let participantName = '';
|
|
42
|
+
let participantIdentity = '';
|
|
43
|
+
let audio;
|
|
44
|
+
let video;
|
|
45
|
+
if (opts !== undefined) {
|
|
46
|
+
name = opts.name || '';
|
|
47
|
+
roomName = opts.roomName || '';
|
|
48
|
+
participantName = opts.participantName || '';
|
|
49
|
+
participantIdentity = opts.participantIdentity || '';
|
|
50
|
+
audio = opts.audio;
|
|
51
|
+
video = opts.video;
|
|
52
|
+
}
|
|
53
|
+
const req = livekit_ingress_1.CreateIngressRequest.toJSON({
|
|
54
|
+
inputType,
|
|
55
|
+
name,
|
|
56
|
+
roomName,
|
|
57
|
+
participantIdentity,
|
|
58
|
+
participantName,
|
|
59
|
+
audio,
|
|
60
|
+
video,
|
|
61
|
+
});
|
|
62
|
+
const data = yield this.rpc.request(svc, 'CreateIngress', req, this.authHeader({ ingressAdmin: true }));
|
|
63
|
+
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* @param ingressId ID of the ingress to update
|
|
68
|
+
* @param opts UpdateIngressOptions
|
|
69
|
+
*/
|
|
70
|
+
updateIngress(ingressId, opts) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
const name = opts.name || '';
|
|
73
|
+
const roomName = opts.roomName || '';
|
|
74
|
+
const participantName = opts.participantName || '';
|
|
75
|
+
const participantIdentity = opts.participantIdentity || '';
|
|
76
|
+
const { audio, video } = opts;
|
|
77
|
+
const req = livekit_ingress_1.UpdateIngressRequest.toJSON({
|
|
78
|
+
ingressId,
|
|
79
|
+
name,
|
|
80
|
+
roomName,
|
|
81
|
+
participantIdentity,
|
|
82
|
+
participantName,
|
|
83
|
+
audio,
|
|
84
|
+
video,
|
|
85
|
+
});
|
|
86
|
+
const data = yield this.rpc.request(svc, 'UpdateIngress', req, this.authHeader({ ingressAdmin: true }));
|
|
87
|
+
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @param roomName list ingress for one room only
|
|
92
|
+
*/
|
|
93
|
+
listIngress(roomName) {
|
|
94
|
+
var _a;
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
roomName !== null && roomName !== void 0 ? roomName : (roomName = '');
|
|
97
|
+
const data = yield this.rpc.request(svc, 'ListIngress', livekit_ingress_1.ListIngressRequest.toJSON({ roomName }), this.authHeader({ ingressAdmin: true }));
|
|
98
|
+
return (_a = livekit_ingress_1.ListIngressResponse.fromJSON(data).items) !== null && _a !== void 0 ? _a : [];
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* @param ingressId ingress to delete
|
|
103
|
+
*/
|
|
104
|
+
deleteIngress(ingressId) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const data = yield this.rpc.request(svc, 'DeleteIngress', livekit_ingress_1.DeleteIngressRequest.toJSON({ ingressId }), this.authHeader({ ingressAdmin: true }));
|
|
107
|
+
return livekit_ingress_1.IngressInfo.fromJSON(data);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.IngressClient = IngressClient;
|
|
112
|
+
//# sourceMappingURL=IngressClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IngressClient.js","sourceRoot":"","sources":["../src/IngressClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6DAUiC;AACjC,gEAAwC;AACxC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AC,KAAK,mCAAI,EAAE,CAAC;;KACvD;IAED;;OAEG;IACG,aAAa,CAAC,SAAiB;;YACnC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,CACjC,GAAG,EACH,eAAe,EACf,sCAAoB,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAC1C,IAAI,CAAC,UAAU,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CACxC,CAAC;YACF,OAAO,6BAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,CAAC;KAAA;CACF;AA9GD,sCA8GC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { DataPacket_Kind, ParticipantInfo, ParticipantPermission, Room, TrackInfo } from './proto/livekit_models';
|
|
2
|
+
import { RoomEgress } from './proto/livekit_room';
|
|
3
|
+
import ServiceBase from './ServiceBase';
|
|
4
|
+
/**
|
|
5
|
+
* Options for when creating a room
|
|
6
|
+
*/
|
|
7
|
+
export interface CreateOptions {
|
|
8
|
+
/**
|
|
9
|
+
* name of the room. required
|
|
10
|
+
*/
|
|
11
|
+
name: string;
|
|
12
|
+
/**
|
|
13
|
+
* number of seconds the room should clean up after being empty
|
|
14
|
+
*/
|
|
15
|
+
emptyTimeout?: number;
|
|
16
|
+
/**
|
|
17
|
+
* limit to the number of participants in a room at a time
|
|
18
|
+
*/
|
|
19
|
+
maxParticipants?: number;
|
|
20
|
+
/**
|
|
21
|
+
* initial room metadata
|
|
22
|
+
*/
|
|
23
|
+
metadata?: string;
|
|
24
|
+
/**
|
|
25
|
+
* add egress options
|
|
26
|
+
*/
|
|
27
|
+
egress?: RoomEgress;
|
|
28
|
+
/**
|
|
29
|
+
* override the node room is allocated to, for debugging
|
|
30
|
+
* does not work with Cloud
|
|
31
|
+
*/
|
|
32
|
+
nodeId?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare type SendDataOptions = {
|
|
35
|
+
destinationSids?: string[];
|
|
36
|
+
topic?: string;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Client to access Room APIs
|
|
40
|
+
*/
|
|
41
|
+
export declare class RoomServiceClient extends ServiceBase {
|
|
42
|
+
private readonly rpc;
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param host hostname including protocol. i.e. 'https://cluster.livekit.io'
|
|
46
|
+
* @param apiKey API Key, can be set in env var LIVEKIT_API_KEY
|
|
47
|
+
* @param secret API Secret, can be set in env var LIVEKIT_API_SECRET
|
|
48
|
+
*/
|
|
49
|
+
constructor(host: string, apiKey?: string, secret?: string);
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new room. Explicit room creation is not required, since rooms will
|
|
52
|
+
* be automatically created when the first participant joins. This method can be
|
|
53
|
+
* used to customize room settings.
|
|
54
|
+
* @param options
|
|
55
|
+
*/
|
|
56
|
+
createRoom(options: CreateOptions): Promise<Room>;
|
|
57
|
+
/**
|
|
58
|
+
* List active rooms
|
|
59
|
+
* @param names when undefined or empty, list all rooms.
|
|
60
|
+
* otherwise returns rooms with matching names
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
listRooms(names?: string[]): Promise<Room[]>;
|
|
64
|
+
deleteRoom(room: string): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Update metadata of a room
|
|
67
|
+
* @param room name of the room
|
|
68
|
+
* @param metadata the new metadata for the room
|
|
69
|
+
*/
|
|
70
|
+
updateRoomMetadata(room: string, metadata: string): Promise<Room>;
|
|
71
|
+
/**
|
|
72
|
+
* List participants in a room
|
|
73
|
+
* @param room name of the room
|
|
74
|
+
*/
|
|
75
|
+
listParticipants(room: string): Promise<ParticipantInfo[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Get information on a specific participant, including the tracks that participant
|
|
78
|
+
* has published
|
|
79
|
+
* @param room name of the room
|
|
80
|
+
* @param identity identity of the participant to return
|
|
81
|
+
*/
|
|
82
|
+
getParticipant(room: string, identity: string): Promise<ParticipantInfo>;
|
|
83
|
+
/**
|
|
84
|
+
* Removes a participant in the room. This will disconnect the participant
|
|
85
|
+
* and will emit a Disconnected event for that participant.
|
|
86
|
+
* Even after being removed, the participant can still re-join the room.
|
|
87
|
+
* @param room
|
|
88
|
+
* @param identity
|
|
89
|
+
*/
|
|
90
|
+
removeParticipant(room: string, identity: string): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Mutes a track that the participant has published.
|
|
93
|
+
* @param room
|
|
94
|
+
* @param identity
|
|
95
|
+
* @param trackSid sid of the track to be muted
|
|
96
|
+
* @param muted true to mute, false to unmute
|
|
97
|
+
*/
|
|
98
|
+
mutePublishedTrack(room: string, identity: string, trackSid: string, muted: boolean): Promise<TrackInfo>;
|
|
99
|
+
/**
|
|
100
|
+
* Updates a participant's metadata or permissions
|
|
101
|
+
* @param room
|
|
102
|
+
* @param identity
|
|
103
|
+
* @param metadata optional, metadata to update
|
|
104
|
+
* @param permission optional, new permissions to assign to participant
|
|
105
|
+
* @param name optional, new name for participant
|
|
106
|
+
*/
|
|
107
|
+
updateParticipant(room: string, identity: string, metadata?: string, permission?: ParticipantPermission, name?: string): Promise<ParticipantInfo>;
|
|
108
|
+
/**
|
|
109
|
+
* Updates a participant's subscription to tracks
|
|
110
|
+
* @param room
|
|
111
|
+
* @param identity
|
|
112
|
+
* @param trackSids
|
|
113
|
+
* @param subscribe true to subscribe, false to unsubscribe
|
|
114
|
+
*/
|
|
115
|
+
updateSubscriptions(room: string, identity: string, trackSids: string[], subscribe: boolean): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Sends data message to participants in the room
|
|
118
|
+
* @param room
|
|
119
|
+
* @param data opaque payload to send
|
|
120
|
+
* @param kind delivery reliability
|
|
121
|
+
* @param options optionally specify a topic and destinationSids (when destinationSids is empty, message is sent to everyone)
|
|
122
|
+
*/
|
|
123
|
+
sendData(room: string, data: Uint8Array, kind: DataPacket_Kind, options: SendDataOptions): Promise<void>;
|
|
124
|
+
/**
|
|
125
|
+
* Sends data message to participants in the room
|
|
126
|
+
* @param room
|
|
127
|
+
* @param data opaque payload to send
|
|
128
|
+
* @param kind delivery reliability
|
|
129
|
+
* @param destinationSids optional. when empty, message is sent to everyone
|
|
130
|
+
*/
|
|
131
|
+
sendData(room: string, data: Uint8Array, kind: DataPacket_Kind, destinationSids?: string[]): Promise<void>;
|
|
132
|
+
}
|