@honeybbq/teamspeak 1.0.0-beta.21 → 1.0.0-beta.23
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 +2 -1
- package/dist/client/crypto/identity.d.ts +15 -4
- package/dist/client/crypto/identity.d.ts.map +1 -1
- package/dist/client/crypto/identity.js +19 -1
- package/dist/client/crypto/identity.js.map +1 -1
- package/dist/client/crypto/index.d.ts +1 -1
- package/dist/client/crypto/index.d.ts.map +1 -1
- package/dist/client/crypto/index.js +1 -0
- package/dist/client/crypto/index.js.map +1 -1
- package/dist/client/discovery/resolver.d.ts +35 -2
- package/dist/client/discovery/resolver.d.ts.map +1 -1
- package/dist/client/discovery/resolver.js +129 -45
- package/dist/client/discovery/resolver.js.map +1 -1
- package/dist/client/handshake/license.js +1 -0
- package/dist/client/handshake/license.js.map +1 -1
- package/dist/client/index.d.ts +8 -5
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +5 -2
- package/dist/client/index.js.map +1 -1
- package/dist/client/trace.d.ts +4 -1
- package/dist/client/trace.d.ts.map +1 -1
- package/dist/client/transfer.d.ts +10 -1
- package/dist/client/transfer.d.ts.map +1 -1
- package/dist/client/transfer.js +10 -0
- package/dist/client/transfer.js.map +1 -1
- package/dist/client/transport/handler.d.ts.map +1 -1
- package/dist/client/transport/handler.js +3 -3
- package/dist/client/transport/handler.js.map +1 -1
- package/dist/client/transport/packet.d.ts +5 -0
- package/dist/client/transport/packet.d.ts.map +1 -1
- package/dist/client/transport/packet.js +9 -1
- package/dist/client/transport/packet.js.map +1 -1
- package/dist/client/types.d.ts +28 -1
- package/dist/client/types.d.ts.map +1 -1
- package/dist/client/types.js +21 -0
- package/dist/client/types.js.map +1 -1
- package/dist/client/view.d.ts +24 -8
- package/dist/client/view.d.ts.map +1 -1
- package/dist/client/view.js +24 -1
- package/dist/client/view.js.map +1 -1
- package/dist/core/api/channels.d.ts +3 -3
- package/dist/core/api/channels.d.ts.map +1 -1
- package/dist/core/api/clients.d.ts +13 -1
- package/dist/core/api/clients.d.ts.map +1 -1
- package/dist/core/api/clients.js +12 -0
- package/dist/core/api/clients.js.map +1 -1
- package/dist/core/api/command.d.ts +11 -3
- package/dist/core/api/command.d.ts.map +1 -1
- package/dist/core/api/command.js +8 -2
- package/dist/core/api/command.js.map +1 -1
- package/dist/core/api/groups.d.ts +2 -1
- package/dist/core/api/groups.d.ts.map +1 -1
- package/dist/core/api/groups.js.map +1 -1
- package/dist/core/api/instance.d.ts +5 -3
- package/dist/core/api/instance.d.ts.map +1 -1
- package/dist/core/api/instance.js.map +1 -1
- package/dist/core/api/server.d.ts +40 -10
- package/dist/core/api/server.d.ts.map +1 -1
- package/dist/core/api/server.js +2 -2
- package/dist/core/api/server.js.map +1 -1
- package/dist/core/command-name.d.ts +6 -0
- package/dist/core/command-name.d.ts.map +1 -1
- package/dist/core/command-name.js +6 -0
- package/dist/core/command-name.js.map +1 -1
- package/dist/core/enums.d.ts +94 -4
- package/dist/core/enums.d.ts.map +1 -1
- package/dist/core/enums.js +91 -4
- package/dist/core/enums.js.map +1 -1
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/property-name.d.ts +3 -3
- package/dist/core/property-name.d.ts.map +1 -1
- package/dist/core/property-name.js +3 -3
- package/dist/core/property-name.js.map +1 -1
- package/dist/core/types.d.ts +14 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +16 -4
- package/dist/core/types.js.map +1 -1
- package/dist/query/client.d.ts +55 -1
- package/dist/query/client.d.ts.map +1 -1
- package/dist/query/client.js +53 -0
- package/dist/query/client.js.map +1 -1
- package/dist/query/index.d.ts +2 -2
- package/dist/query/index.d.ts.map +1 -1
- package/dist/query/index.js +1 -1
- package/dist/query/index.js.map +1 -1
- package/dist/query/options.d.ts +21 -1
- package/dist/query/options.d.ts.map +1 -1
- package/dist/query/options.js +34 -5
- package/dist/query/options.js.map +1 -1
- package/dist/stream/index.d.ts +2 -1
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +1 -0
- package/dist/stream/index.js.map +1 -1
- package/dist/stream/types.d.ts +243 -25
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/stream/types.js +235 -1
- package/dist/stream/types.js.map +1 -1
- package/package.json +12 -10
- package/src/client/crypto/identity.ts +16 -5
- package/src/client/crypto/index.ts +1 -1
- package/src/client/discovery/resolver.ts +161 -53
- package/src/client/handshake/license.ts +1 -0
- package/src/client/index.ts +13 -5
- package/src/client/trace.ts +4 -1
- package/src/client/transfer.ts +11 -1
- package/src/client/transport/handler.ts +3 -2
- package/src/client/transport/packet.ts +10 -1
- package/src/client/types.ts +30 -1
- package/src/client/view.ts +24 -9
- package/src/core/api/channels.ts +3 -3
- package/src/core/api/clients.ts +14 -1
- package/src/core/api/command.ts +16 -5
- package/src/core/api/groups.ts +2 -1
- package/src/core/api/instance.ts +5 -3
- package/src/core/api/server.ts +39 -10
- package/src/core/command-name.ts +6 -0
- package/src/core/enums.ts +111 -4
- package/src/core/index.ts +12 -2
- package/src/core/property-name.ts +3 -3
- package/src/core/types.ts +19 -8
- package/src/query/client.ts +68 -6
- package/src/query/index.ts +1 -2
- package/src/query/options.ts +26 -13
- package/src/stream/index.ts +14 -8
- package/src/stream/types.ts +321 -27
package/src/query/options.ts
CHANGED
|
@@ -70,6 +70,23 @@ export type QueryTransportOptions =
|
|
|
70
70
|
readonly open: (signal?: AbortSignal) => Promise<QueryTransport>;
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
+
/** The values of the table below, before freezing. */
|
|
74
|
+
const queryEventCategoryValues = {
|
|
75
|
+
/** Server-wide events, such as clients joining and leaving. */
|
|
76
|
+
Server: "server",
|
|
77
|
+
/** Events of the channels, such as one being created or edited. */
|
|
78
|
+
Channel: "channel",
|
|
79
|
+
/** Text messages to the server. */
|
|
80
|
+
TextServer: "textserver",
|
|
81
|
+
/** Text messages to a channel. */
|
|
82
|
+
TextChannel: "textchannel",
|
|
83
|
+
/** Private text messages to this client. */
|
|
84
|
+
TextPrivate: "textprivate",
|
|
85
|
+
/** Ban list changes. */
|
|
86
|
+
Bans: "bans",
|
|
87
|
+
/** A privilege key being used. */
|
|
88
|
+
TokenUsed: "tokenused",
|
|
89
|
+
} as const;
|
|
73
90
|
/**
|
|
74
91
|
* One category of notifications to register for: the `event` parameter of
|
|
75
92
|
* `servernotifyregister`.
|
|
@@ -80,14 +97,10 @@ export type QueryTransportOptions =
|
|
|
80
97
|
* then send `notifytokenused`, which carries a privilege key and has no typed
|
|
81
98
|
* event, so it reaches `notification` only.
|
|
82
99
|
*/
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
| "textchannel"
|
|
88
|
-
| "textprivate"
|
|
89
|
-
| "bans"
|
|
90
|
-
| "tokenused";
|
|
100
|
+
export const QueryEventCategory: typeof queryEventCategoryValues =
|
|
101
|
+
/* @__PURE__ */ Object.freeze(queryEventCategoryValues);
|
|
102
|
+
/** One of {@link QueryEventCategory}. */
|
|
103
|
+
export type QueryEventCategory = (typeof QueryEventCategory)[keyof typeof QueryEventCategory];
|
|
91
104
|
|
|
92
105
|
/**
|
|
93
106
|
* Which notification categories to register for.
|
|
@@ -184,11 +197,11 @@ export interface QueryClientOptions {
|
|
|
184
197
|
|
|
185
198
|
/** The five categories both raw TCP on TS3 and SSH on TS6 accept. */
|
|
186
199
|
export const DEFAULT_EVENT_CATEGORIES: readonly QueryEventCategory[] = Object.freeze([
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
200
|
+
QueryEventCategory.Server,
|
|
201
|
+
QueryEventCategory.Channel,
|
|
202
|
+
QueryEventCategory.TextServer,
|
|
203
|
+
QueryEventCategory.TextChannel,
|
|
204
|
+
QueryEventCategory.TextPrivate,
|
|
192
205
|
]);
|
|
193
206
|
|
|
194
207
|
const CATEGORIES: ReadonlySet<string> = new Set([
|
package/src/stream/index.ts
CHANGED
|
@@ -32,33 +32,39 @@ export {
|
|
|
32
32
|
export type {
|
|
33
33
|
IceCandidate,
|
|
34
34
|
JoinRequest,
|
|
35
|
-
JoinRequestCloseCause,
|
|
36
35
|
JoinRequestClosed,
|
|
37
36
|
JoinRequestEvents,
|
|
38
|
-
JoinRequestState,
|
|
39
37
|
Peer,
|
|
40
38
|
PeerClosed,
|
|
41
|
-
PeerCloseCause,
|
|
42
39
|
PeerEvents,
|
|
43
40
|
PublishedStream,
|
|
44
41
|
PublishedStreamEvents,
|
|
45
42
|
PublishOptions,
|
|
46
43
|
RawSignal,
|
|
47
|
-
StreamAccessibility,
|
|
48
44
|
StreamEnded,
|
|
49
|
-
StreamEndCause,
|
|
50
45
|
StreamInfo,
|
|
51
46
|
StreamsClient,
|
|
52
47
|
StreamsEventMap,
|
|
53
48
|
StreamsOptions,
|
|
54
|
-
StreamSource,
|
|
55
49
|
StreamStoppedEvent,
|
|
56
|
-
StreamTransport,
|
|
57
50
|
StreamView,
|
|
58
51
|
StreamWarning,
|
|
59
|
-
StreamWarningCode,
|
|
60
52
|
StreamViewerEvent,
|
|
61
53
|
ViewerIdentity,
|
|
62
54
|
ViewerPeer,
|
|
63
55
|
WatchOptions,
|
|
64
56
|
} from "./types.js";
|
|
57
|
+
export {
|
|
58
|
+
JoinRequestCloseCause,
|
|
59
|
+
JoinRequestEventName,
|
|
60
|
+
JoinRequestState,
|
|
61
|
+
PeerCloseCause,
|
|
62
|
+
PeerEventName,
|
|
63
|
+
PublishedStreamEventName,
|
|
64
|
+
StreamAccessibility,
|
|
65
|
+
StreamEndCause,
|
|
66
|
+
StreamsEventName,
|
|
67
|
+
StreamSource,
|
|
68
|
+
StreamTransport,
|
|
69
|
+
StreamWarningCode,
|
|
70
|
+
} from "./types.js";
|
package/src/stream/types.ts
CHANGED
|
@@ -52,25 +52,72 @@ export interface StreamsClient extends CommandExecutor {
|
|
|
52
52
|
|
|
53
53
|
// ---- Values -----------------------------------------------------------------
|
|
54
54
|
|
|
55
|
+
/** The values of the table below, before freezing. */
|
|
56
|
+
const streamSourceValues = {
|
|
57
|
+
/** `0` on the wire: no source named. */
|
|
58
|
+
None: "none",
|
|
59
|
+
/** `1` on the wire: a camera. */
|
|
60
|
+
Camera: "camera",
|
|
61
|
+
/** `2` on the wire: a screen. */
|
|
62
|
+
Screen: "screen",
|
|
63
|
+
/** `3` on the wire: a window. */
|
|
64
|
+
Window: "window",
|
|
65
|
+
/** `4` on the wire. */
|
|
66
|
+
Session: "session",
|
|
67
|
+
} as const;
|
|
55
68
|
/**
|
|
56
69
|
* What a stream shows. The server stores any number, so a stream from a client
|
|
57
70
|
* that sends another value reports it as the number.
|
|
58
71
|
*/
|
|
59
|
-
export
|
|
60
|
-
|
|
72
|
+
export const StreamSource: typeof streamSourceValues =
|
|
73
|
+
/* @__PURE__ */ Object.freeze(streamSourceValues);
|
|
74
|
+
/**
|
|
75
|
+
* One of {@link StreamSource}. May gain members in a minor release: a
|
|
76
|
+
* `switch` over it needs a default case.
|
|
77
|
+
*/
|
|
78
|
+
export type StreamSource = (typeof StreamSource)[keyof typeof StreamSource];
|
|
79
|
+
|
|
80
|
+
/** The values of the table below, before freezing. */
|
|
81
|
+
const streamAccessibilityValues = {
|
|
82
|
+
/** `0` on the wire. */
|
|
83
|
+
None: "none",
|
|
84
|
+
/** `1` on the wire: anyone. What `publish` sends unless told otherwise. */
|
|
85
|
+
Public: "public",
|
|
86
|
+
/** `2` on the wire: the publisher's contacts. */
|
|
87
|
+
Contacts: "contacts",
|
|
88
|
+
/** `3` on the wire. */
|
|
89
|
+
Private: "private",
|
|
90
|
+
} as const;
|
|
61
91
|
/**
|
|
62
92
|
* Who a stream says may watch it. Only the publisher enforces it: the server
|
|
63
93
|
* relays every request. A value outside the four is reported as the number.
|
|
64
94
|
*/
|
|
65
|
-
export
|
|
95
|
+
export const StreamAccessibility: typeof streamAccessibilityValues =
|
|
96
|
+
/* @__PURE__ */ Object.freeze(streamAccessibilityValues);
|
|
97
|
+
/**
|
|
98
|
+
* One of {@link StreamAccessibility}. May gain members in a minor release: a
|
|
99
|
+
* `switch` over it needs a default case.
|
|
100
|
+
*/
|
|
101
|
+
export type StreamAccessibility = (typeof StreamAccessibility)[keyof typeof StreamAccessibility];
|
|
66
102
|
|
|
103
|
+
/** The values of the table below, before freezing. */
|
|
104
|
+
const streamTransportValues = {
|
|
105
|
+
/** From the publisher to each viewer directly. */
|
|
106
|
+
P2P: "p2p",
|
|
107
|
+
} as const;
|
|
67
108
|
/**
|
|
68
109
|
* How a stream's media travels: `"p2p"`, from the publisher to each viewer
|
|
69
110
|
* directly, is the one mode this SDK publishes and watches. A server may
|
|
70
111
|
* announce a stream in another mode; it is reported as the number, and
|
|
71
112
|
* `watch` refuses it.
|
|
72
113
|
*/
|
|
73
|
-
export
|
|
114
|
+
export const StreamTransport: typeof streamTransportValues =
|
|
115
|
+
/* @__PURE__ */ Object.freeze(streamTransportValues);
|
|
116
|
+
/**
|
|
117
|
+
* One of {@link StreamTransport}. May gain members in a minor release: a
|
|
118
|
+
* `switch` over it needs a default case.
|
|
119
|
+
*/
|
|
120
|
+
export type StreamTransport = (typeof StreamTransport)[keyof typeof StreamTransport];
|
|
74
121
|
|
|
75
122
|
/**
|
|
76
123
|
* A stream, as the server describes it.
|
|
@@ -140,12 +187,29 @@ export interface RawSignal {
|
|
|
140
187
|
|
|
141
188
|
// ---- Peers ------------------------------------------------------------------
|
|
142
189
|
|
|
190
|
+
/** The values of the table below, before freezing. */
|
|
191
|
+
const peerCloseCauseValues = {
|
|
192
|
+
/** Its own `close()`. */
|
|
193
|
+
Closed: "closed",
|
|
194
|
+
/** The other end leaving. */
|
|
195
|
+
Left: "left",
|
|
196
|
+
/** The stream ending. */
|
|
197
|
+
Stopped: "stopped",
|
|
198
|
+
/** The client's connection ending. */
|
|
199
|
+
Disconnected: "disconnected",
|
|
200
|
+
/** `Streams.dispose()`. */
|
|
201
|
+
Disposed: "disposed",
|
|
202
|
+
} as const;
|
|
143
203
|
/**
|
|
144
|
-
* Why a peer closed
|
|
145
|
-
* end leaving, `"stopped"` for the stream ending, `"disconnected"` for the
|
|
146
|
-
* client's connection ending and `"disposed"` for `Streams.dispose()`.
|
|
204
|
+
* Why a peer closed.
|
|
147
205
|
*/
|
|
148
|
-
export
|
|
206
|
+
export const PeerCloseCause: typeof peerCloseCauseValues =
|
|
207
|
+
/* @__PURE__ */ Object.freeze(peerCloseCauseValues);
|
|
208
|
+
/**
|
|
209
|
+
* One of {@link PeerCloseCause}. May gain members in a minor release: a
|
|
210
|
+
* `switch` over it needs a default case.
|
|
211
|
+
*/
|
|
212
|
+
export type PeerCloseCause = (typeof PeerCloseCause)[keyof typeof PeerCloseCause];
|
|
149
213
|
|
|
150
214
|
/**
|
|
151
215
|
* A peer closing.
|
|
@@ -175,6 +239,44 @@ export interface PeerEvents {
|
|
|
175
239
|
closed: PeerClosed;
|
|
176
240
|
}
|
|
177
241
|
|
|
242
|
+
/** The values of the table below, before freezing. */
|
|
243
|
+
const peerEventNameValues = {
|
|
244
|
+
/** A renegotiation offer from the publisher: an SDP. */
|
|
245
|
+
Offer: "offer",
|
|
246
|
+
/** The viewer's SDP answer. */
|
|
247
|
+
Answer: "answer",
|
|
248
|
+
/** An ICE candidate from the other end. */
|
|
249
|
+
Candidate: "candidate",
|
|
250
|
+
/** A signalling message that is none of the above. */
|
|
251
|
+
Signal: "signal",
|
|
252
|
+
/** The peer closing. */
|
|
253
|
+
Closed: "closed",
|
|
254
|
+
} as const;
|
|
255
|
+
/**
|
|
256
|
+
* The names of the events `Peer.on()` takes, as constants.
|
|
257
|
+
* `on(PeerEventName.Offer, ...)` and `on("offer", ...)` are the same call,
|
|
258
|
+
* and both give the listener the same payload type.
|
|
259
|
+
*/
|
|
260
|
+
export const PeerEventName: typeof peerEventNameValues =
|
|
261
|
+
/* @__PURE__ */ Object.freeze(peerEventNameValues);
|
|
262
|
+
/**
|
|
263
|
+
* One of {@link PeerEventName}, and so a key of {@link PeerEvents}.
|
|
264
|
+
* May gain members in a minor release: a `switch` over it needs a default
|
|
265
|
+
* case.
|
|
266
|
+
*/
|
|
267
|
+
export type PeerEventName = (typeof PeerEventName)[keyof typeof PeerEventName];
|
|
268
|
+
|
|
269
|
+
// Each direction fails to compile when `PeerEvents` and `PeerEventName`
|
|
270
|
+
// drift: an event without a name, and a name that is not an event.
|
|
271
|
+
const peerEventNameCoverEvents: [Exclude<keyof PeerEvents, PeerEventName>] extends [never]
|
|
272
|
+
? true
|
|
273
|
+
: never = true;
|
|
274
|
+
const peerEventNameNamesAreEvents: [Exclude<PeerEventName, keyof PeerEvents>] extends [never]
|
|
275
|
+
? true
|
|
276
|
+
: never = true;
|
|
277
|
+
void peerEventNameCoverEvents;
|
|
278
|
+
void peerEventNameNamesAreEvents;
|
|
279
|
+
|
|
178
280
|
/**
|
|
179
281
|
* One end of a stream's signalling with one other client. SDP and ICE are
|
|
180
282
|
* opaque strings here: any WebRTC stack can be plugged in.
|
|
@@ -244,18 +346,50 @@ export interface ViewerIdentity {
|
|
|
244
346
|
readonly nickname: string | undefined;
|
|
245
347
|
}
|
|
246
348
|
|
|
349
|
+
/** The values of the table below, before freezing. */
|
|
350
|
+
const joinRequestStateValues = {
|
|
351
|
+
/** Not yet accepted or denied. */
|
|
352
|
+
Pending: "pending",
|
|
353
|
+
/** Accepted. */
|
|
354
|
+
Accepted: "accepted",
|
|
355
|
+
/** Denied. */
|
|
356
|
+
Denied: "denied",
|
|
357
|
+
/** The answer did not reach the server. */
|
|
358
|
+
Failed: "failed",
|
|
359
|
+
/** The viewer left first. */
|
|
360
|
+
Withdrawn: "withdrawn",
|
|
361
|
+
/** The stream stopped. */
|
|
362
|
+
Ended: "ended",
|
|
363
|
+
} as const;
|
|
247
364
|
/**
|
|
248
|
-
* Where a join request stands
|
|
249
|
-
* `"failed"` when the answer did not reach the server, `"withdrawn"` when the
|
|
250
|
-
* viewer left first and `"ended"` when the stream stopped.
|
|
365
|
+
* Where a join request stands.
|
|
251
366
|
*/
|
|
252
|
-
export
|
|
253
|
-
|
|
367
|
+
export const JoinRequestState: typeof joinRequestStateValues =
|
|
368
|
+
/* @__PURE__ */ Object.freeze(joinRequestStateValues);
|
|
369
|
+
/**
|
|
370
|
+
* One of {@link JoinRequestState}. May gain members in a minor release: a
|
|
371
|
+
* `switch` over it needs a default case.
|
|
372
|
+
*/
|
|
373
|
+
export type JoinRequestState = (typeof JoinRequestState)[keyof typeof JoinRequestState];
|
|
374
|
+
|
|
375
|
+
/** The values of the table below, before freezing. */
|
|
376
|
+
const joinRequestCloseCauseValues = {
|
|
377
|
+
/** The viewer took it back or left view. */
|
|
378
|
+
Withdrawn: "withdrawn",
|
|
379
|
+
/** The stream ended first. */
|
|
380
|
+
Ended: "ended",
|
|
381
|
+
} as const;
|
|
254
382
|
/**
|
|
255
|
-
* Why a request stopped waiting for an answer
|
|
256
|
-
* took it back or left view, `"ended"` when the stream ended first.
|
|
383
|
+
* Why a request stopped waiting for an answer.
|
|
257
384
|
*/
|
|
258
|
-
export
|
|
385
|
+
export const JoinRequestCloseCause: typeof joinRequestCloseCauseValues =
|
|
386
|
+
/* @__PURE__ */ Object.freeze(joinRequestCloseCauseValues);
|
|
387
|
+
/**
|
|
388
|
+
* One of {@link JoinRequestCloseCause}. May gain members in a minor release: a
|
|
389
|
+
* `switch` over it needs a default case.
|
|
390
|
+
*/
|
|
391
|
+
export type JoinRequestCloseCause =
|
|
392
|
+
(typeof JoinRequestCloseCause)[keyof typeof JoinRequestCloseCause];
|
|
259
393
|
|
|
260
394
|
/**
|
|
261
395
|
* A pending join request closing without an answer.
|
|
@@ -279,6 +413,43 @@ export interface JoinRequestEvents {
|
|
|
279
413
|
closed: JoinRequestClosed;
|
|
280
414
|
}
|
|
281
415
|
|
|
416
|
+
/** The values of the table below, before freezing. */
|
|
417
|
+
const joinRequestEventNameValues = {
|
|
418
|
+
/**
|
|
419
|
+
* A request nobody had answered closing: the viewer withdrew it or left
|
|
420
|
+
* view, or the stream ended.
|
|
421
|
+
*/
|
|
422
|
+
Closed: "closed",
|
|
423
|
+
} as const;
|
|
424
|
+
/**
|
|
425
|
+
* The names of the events `JoinRequest.on()` takes, as constants.
|
|
426
|
+
* `on(JoinRequestEventName.Closed, ...)` and `on("closed", ...)` are the same call,
|
|
427
|
+
* and both give the listener the same payload type.
|
|
428
|
+
*/
|
|
429
|
+
export const JoinRequestEventName: typeof joinRequestEventNameValues =
|
|
430
|
+
/* @__PURE__ */ Object.freeze(joinRequestEventNameValues);
|
|
431
|
+
/**
|
|
432
|
+
* One of {@link JoinRequestEventName}, and so a key of {@link JoinRequestEvents}.
|
|
433
|
+
* May gain members in a minor release: a `switch` over it needs a default
|
|
434
|
+
* case.
|
|
435
|
+
*/
|
|
436
|
+
export type JoinRequestEventName = (typeof JoinRequestEventName)[keyof typeof JoinRequestEventName];
|
|
437
|
+
|
|
438
|
+
// Each direction fails to compile when `JoinRequestEvents` and `JoinRequestEventName`
|
|
439
|
+
// drift: an event without a name, and a name that is not an event.
|
|
440
|
+
const joinRequestEventNameCoverEvents: [
|
|
441
|
+
Exclude<keyof JoinRequestEvents, JoinRequestEventName>,
|
|
442
|
+
] extends [never]
|
|
443
|
+
? true
|
|
444
|
+
: never = true;
|
|
445
|
+
const joinRequestEventNameNamesAreEvents: [
|
|
446
|
+
Exclude<JoinRequestEventName, keyof JoinRequestEvents>,
|
|
447
|
+
] extends [never]
|
|
448
|
+
? true
|
|
449
|
+
: never = true;
|
|
450
|
+
void joinRequestEventNameCoverEvents;
|
|
451
|
+
void joinRequestEventNameNamesAreEvents;
|
|
452
|
+
|
|
282
453
|
/**
|
|
283
454
|
* A client asking to watch a stream this client publishes. The server relays
|
|
284
455
|
* every request, from any channel, and enforces neither `viewerLimit` nor
|
|
@@ -317,14 +488,32 @@ export interface JoinRequest {
|
|
|
317
488
|
deny(reason?: string): Promise<void>;
|
|
318
489
|
}
|
|
319
490
|
|
|
491
|
+
/** The values of the table below, before freezing. */
|
|
492
|
+
const streamEndCauseValues = {
|
|
493
|
+
/** `stop()`. */
|
|
494
|
+
Stopped: "stopped",
|
|
495
|
+
/** The server's `notifystreamstopped`. */
|
|
496
|
+
Server: "server",
|
|
497
|
+
/**
|
|
498
|
+
* The server said its publisher no longer streams (`client_is_streaming`
|
|
499
|
+
* cleared) and no stop followed within two seconds.
|
|
500
|
+
*/
|
|
501
|
+
Gone: "gone",
|
|
502
|
+
/** The client's connection ending. */
|
|
503
|
+
Disconnected: "disconnected",
|
|
504
|
+
/** `Streams.dispose()`. */
|
|
505
|
+
Disposed: "disposed",
|
|
506
|
+
} as const;
|
|
507
|
+
/**
|
|
508
|
+
* Why a published stream ended.
|
|
509
|
+
*/
|
|
510
|
+
export const StreamEndCause: typeof streamEndCauseValues =
|
|
511
|
+
/* @__PURE__ */ Object.freeze(streamEndCauseValues);
|
|
320
512
|
/**
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
* no longer streams (`client_is_streaming` cleared) and no stop followed within
|
|
324
|
-
* two seconds, and
|
|
325
|
-
* `"disconnected"` and `"disposed"` as for a peer.
|
|
513
|
+
* One of {@link StreamEndCause}. May gain members in a minor release: a
|
|
514
|
+
* `switch` over it needs a default case.
|
|
326
515
|
*/
|
|
327
|
-
export type StreamEndCause =
|
|
516
|
+
export type StreamEndCause = (typeof StreamEndCause)[keyof typeof StreamEndCause];
|
|
328
517
|
|
|
329
518
|
/**
|
|
330
519
|
* A published stream ending.
|
|
@@ -351,6 +540,43 @@ export interface PublishedStreamEvents {
|
|
|
351
540
|
ended: StreamEnded;
|
|
352
541
|
}
|
|
353
542
|
|
|
543
|
+
/** The values of the table below, before freezing. */
|
|
544
|
+
const publishedStreamEventNameValues = {
|
|
545
|
+
/** A client asking to watch. */
|
|
546
|
+
Request: "request",
|
|
547
|
+
/** The stream ending. */
|
|
548
|
+
Ended: "ended",
|
|
549
|
+
} as const;
|
|
550
|
+
/**
|
|
551
|
+
* The names of the events `PublishedStream.on()` takes, as constants.
|
|
552
|
+
* `on(PublishedStreamEventName.Request, ...)` and `on("request", ...)` are the same call,
|
|
553
|
+
* and both give the listener the same payload type.
|
|
554
|
+
*/
|
|
555
|
+
export const PublishedStreamEventName: typeof publishedStreamEventNameValues =
|
|
556
|
+
/* @__PURE__ */ Object.freeze(publishedStreamEventNameValues);
|
|
557
|
+
/**
|
|
558
|
+
* One of {@link PublishedStreamEventName}, and so a key of {@link PublishedStreamEvents}.
|
|
559
|
+
* May gain members in a minor release: a `switch` over it needs a default
|
|
560
|
+
* case.
|
|
561
|
+
*/
|
|
562
|
+
export type PublishedStreamEventName =
|
|
563
|
+
(typeof PublishedStreamEventName)[keyof typeof PublishedStreamEventName];
|
|
564
|
+
|
|
565
|
+
// Each direction fails to compile when `PublishedStreamEvents` and `PublishedStreamEventName`
|
|
566
|
+
// drift: an event without a name, and a name that is not an event.
|
|
567
|
+
const publishedStreamEventNameCoverEvents: [
|
|
568
|
+
Exclude<keyof PublishedStreamEvents, PublishedStreamEventName>,
|
|
569
|
+
] extends [never]
|
|
570
|
+
? true
|
|
571
|
+
: never = true;
|
|
572
|
+
const publishedStreamEventNameNamesAreEvents: [
|
|
573
|
+
Exclude<PublishedStreamEventName, keyof PublishedStreamEvents>,
|
|
574
|
+
] extends [never]
|
|
575
|
+
? true
|
|
576
|
+
: never = true;
|
|
577
|
+
void publishedStreamEventNameCoverEvents;
|
|
578
|
+
void publishedStreamEventNameNamesAreEvents;
|
|
579
|
+
|
|
354
580
|
/**
|
|
355
581
|
* A stream this client publishes.
|
|
356
582
|
*/
|
|
@@ -445,7 +671,10 @@ export interface StreamStoppedEvent {
|
|
|
445
671
|
* `client_is_streaming` cleared or the publisher came into view not
|
|
446
672
|
* streaming, without a stop reaching this client.
|
|
447
673
|
*/
|
|
448
|
-
readonly cause:
|
|
674
|
+
readonly cause:
|
|
675
|
+
| typeof StreamEndCause.Server
|
|
676
|
+
| typeof StreamEndCause.Stopped
|
|
677
|
+
| typeof StreamEndCause.Gone;
|
|
449
678
|
/** The stop reason the server reported; 0 unless the stopper gave one, and for `"gone"`. */
|
|
450
679
|
readonly reason: number;
|
|
451
680
|
}
|
|
@@ -461,11 +690,21 @@ export interface StreamViewerEvent {
|
|
|
461
690
|
readonly clientId: ClientID;
|
|
462
691
|
}
|
|
463
692
|
|
|
693
|
+
/** The values of the table below, before freezing. */
|
|
694
|
+
const streamWarningCodeValues = {
|
|
695
|
+
/** An SDP offer with no `m=audio` section. */
|
|
696
|
+
OfferWithoutAudio: "offer-without-audio",
|
|
697
|
+
} as const;
|
|
464
698
|
/**
|
|
465
|
-
* Why `Streams` warns
|
|
466
|
-
* `m=audio` section.
|
|
699
|
+
* Why `Streams` warns.
|
|
467
700
|
*/
|
|
468
|
-
export
|
|
701
|
+
export const StreamWarningCode: typeof streamWarningCodeValues =
|
|
702
|
+
/* @__PURE__ */ Object.freeze(streamWarningCodeValues);
|
|
703
|
+
/**
|
|
704
|
+
* One of {@link StreamWarningCode}. May gain members in a minor release: a
|
|
705
|
+
* `switch` over it needs a default case.
|
|
706
|
+
*/
|
|
707
|
+
export type StreamWarningCode = (typeof StreamWarningCode)[keyof typeof StreamWarningCode];
|
|
469
708
|
|
|
470
709
|
/**
|
|
471
710
|
* Something the SDK noticed and did not stop: the offer or message goes out
|
|
@@ -486,7 +725,10 @@ export interface StreamWarning {
|
|
|
486
725
|
* The events of `Streams`.
|
|
487
726
|
*/
|
|
488
727
|
export interface StreamsEventMap {
|
|
489
|
-
/**
|
|
728
|
+
/**
|
|
729
|
+
* A stream becoming known: it started while this client could see it, or
|
|
730
|
+
* discovery found it.
|
|
731
|
+
*/
|
|
490
732
|
started: StreamInfo;
|
|
491
733
|
/** What is known of a stream changing. */
|
|
492
734
|
updated: StreamInfo;
|
|
@@ -504,3 +746,55 @@ export interface StreamsEventMap {
|
|
|
504
746
|
*/
|
|
505
747
|
warning: StreamWarning;
|
|
506
748
|
}
|
|
749
|
+
|
|
750
|
+
/** The values of the table below, before freezing. */
|
|
751
|
+
const streamsEventNameValues = {
|
|
752
|
+
/**
|
|
753
|
+
* A stream becoming known: it started while this client could see it, or
|
|
754
|
+
* discovery found it.
|
|
755
|
+
*/
|
|
756
|
+
Started: "started",
|
|
757
|
+
/** What is known of a stream changing. */
|
|
758
|
+
Updated: "updated",
|
|
759
|
+
/** A stream ending. */
|
|
760
|
+
Stopped: "stopped",
|
|
761
|
+
/** A viewer being accepted into a stream. */
|
|
762
|
+
ViewerJoined: "viewerJoined",
|
|
763
|
+
/** A viewer leaving a stream. */
|
|
764
|
+
ViewerLeft: "viewerLeft",
|
|
765
|
+
/** A failure nobody awaits, such as a discovery request the server refused. */
|
|
766
|
+
Error: "error",
|
|
767
|
+
/**
|
|
768
|
+
* Something the SDK noticed and let through, such as an offer the
|
|
769
|
+
* TeamSpeak 6 client will not answer.
|
|
770
|
+
*/
|
|
771
|
+
Warning: "warning",
|
|
772
|
+
} as const;
|
|
773
|
+
/**
|
|
774
|
+
* The names of the events `Streams.on()` takes, as constants.
|
|
775
|
+
* `on(StreamsEventName.Started, ...)` and `on("started", ...)` are the same call,
|
|
776
|
+
* and both give the listener the same payload type.
|
|
777
|
+
*/
|
|
778
|
+
export const StreamsEventName: typeof streamsEventNameValues =
|
|
779
|
+
/* @__PURE__ */ Object.freeze(streamsEventNameValues);
|
|
780
|
+
/**
|
|
781
|
+
* One of {@link StreamsEventName}, and so a key of {@link StreamsEventMap}.
|
|
782
|
+
* May gain members in a minor release: a `switch` over it needs a default
|
|
783
|
+
* case.
|
|
784
|
+
*/
|
|
785
|
+
export type StreamsEventName = (typeof StreamsEventName)[keyof typeof StreamsEventName];
|
|
786
|
+
|
|
787
|
+
// Each direction fails to compile when `StreamsEventMap` and `StreamsEventName`
|
|
788
|
+
// drift: an event without a name, and a name that is not an event.
|
|
789
|
+
const streamsEventNameCoverEvents: [Exclude<keyof StreamsEventMap, StreamsEventName>] extends [
|
|
790
|
+
never,
|
|
791
|
+
]
|
|
792
|
+
? true
|
|
793
|
+
: never = true;
|
|
794
|
+
const streamsEventNameNamesAreEvents: [Exclude<StreamsEventName, keyof StreamsEventMap>] extends [
|
|
795
|
+
never,
|
|
796
|
+
]
|
|
797
|
+
? true
|
|
798
|
+
: never = true;
|
|
799
|
+
void streamsEventNameCoverEvents;
|
|
800
|
+
void streamsEventNameNamesAreEvents;
|