@honeybbq/teamspeak 1.0.0-beta.15 → 1.0.0-beta.16
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 +51 -9
- package/dist/stream/errors.d.ts +0 -8
- package/dist/stream/errors.d.ts.map +1 -1
- package/dist/stream/errors.js +0 -8
- package/dist/stream/errors.js.map +1 -1
- package/dist/stream/index.d.ts +4 -5
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +3 -4
- package/dist/stream/index.js.map +1 -1
- package/dist/stream/peer.d.ts +7 -1
- package/dist/stream/peer.d.ts.map +1 -1
- package/dist/stream/peer.js +16 -1
- package/dist/stream/peer.js.map +1 -1
- package/dist/stream/published.d.ts +3 -1
- package/dist/stream/published.d.ts.map +1 -1
- package/dist/stream/published.js +15 -5
- package/dist/stream/published.js.map +1 -1
- package/dist/stream/streams.d.ts +2 -4
- package/dist/stream/streams.d.ts.map +1 -1
- package/dist/stream/streams.js +6 -7
- package/dist/stream/streams.js.map +1 -1
- package/dist/stream/types.d.ts +53 -50
- package/dist/stream/types.d.ts.map +1 -1
- package/dist/stream/wire.d.ts +2 -0
- package/dist/stream/wire.d.ts.map +1 -1
- package/dist/stream/wire.js +4 -0
- package/dist/stream/wire.js.map +1 -1
- package/package.json +1 -1
- package/src/stream/errors.ts +0 -8
- package/src/stream/index.ts +8 -4
- package/src/stream/peer.ts +27 -1
- package/src/stream/published.ts +23 -4
- package/src/stream/streams.ts +6 -7
- package/src/stream/types.ts +61 -50
- package/src/stream/wire.ts +5 -0
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ Upgrading from 0.x? The package was renamed; see the [migration guide](https://g
|
|
|
32
32
|
- **Identity management** — Generate, import/export, and upgrade security level of identities
|
|
33
33
|
- **Full command set** — 111 typed functions covering every command the voice protocol answers
|
|
34
34
|
- **Reconnection** — Opt-in retry with backoff, tuned for TeamSpeak's antiflood ban
|
|
35
|
-
- **Streams** — TeamSpeak 6 screen share signalling: find, publish and watch streams, with SDP and ICE as strings for any WebRTC stack
|
|
35
|
+
- **Streams** — TeamSpeak 6 screen share signalling: find, publish and watch streams, with SDP and ICE as strings for any WebRTC stack
|
|
36
36
|
- **Server capabilities** — Reports the server version and the uid hash it uses (SHA-1 on TS3, SHA-256 on TS6), and the server's name, icon, banner and welcome message
|
|
37
37
|
- **Custom transports** — Supply your own socket, for proxies, tunnels or tests
|
|
38
38
|
- **ESM with types** — Ships ES modules with full TypeScript declarations
|
|
@@ -549,7 +549,7 @@ The uid hash matters because TS3 hashes a client's public key with SHA-1 and TS6
|
|
|
549
549
|
with SHA-256 — a client that assumes either one computes an identifier the other
|
|
550
550
|
server never sends.
|
|
551
551
|
|
|
552
|
-
### Streams
|
|
552
|
+
### Streams
|
|
553
553
|
|
|
554
554
|
TeamSpeak 6 clients can share a screen, a window or a camera. `@honeybbq/teamspeak/stream`
|
|
555
555
|
does the signalling of that: it finds the streams of the clients in view, publishes one,
|
|
@@ -558,9 +558,9 @@ WebRTC, which is yours: `Streams` hands you the SDP and the ICE candidates as st
|
|
|
558
558
|
takes them back, so any WebRTC stack plugs in, in a browser, in Electron or in Node. The
|
|
559
559
|
package has no WebRTC dependency.
|
|
560
560
|
|
|
561
|
-
TeamSpeak does not document this protocol. It was
|
|
562
|
-
and
|
|
563
|
-
|
|
561
|
+
TeamSpeak does not document this protocol. It was verified against the TeamSpeak 6 server
|
|
562
|
+
6.0.0-beta13.1 and the TeamSpeak 6 client 6.0.0-beta5 (macOS), and a TeamSpeak update may
|
|
563
|
+
break it. A TeamSpeak 3 server does not answer the stream
|
|
564
564
|
commands at all, so `publish` and `watch` throw a `StreamsUnsupportedError` before sending
|
|
565
565
|
anything.
|
|
566
566
|
|
|
@@ -603,6 +603,10 @@ stream.on("request", async (request) => {
|
|
|
603
603
|
|
|
604
604
|
const pc = new RTCPeerConnection({ iceServers });
|
|
605
605
|
for (const track of capture.getTracks()) pc.addTrack(track, capture);
|
|
606
|
+
// Always offer audio, even with no track to send (see the interop notes below).
|
|
607
|
+
if (!pc.getTransceivers().some((t) => t.receiver.track.kind === "audio")) {
|
|
608
|
+
pc.addTransceiver("audio", { direction: "sendonly" });
|
|
609
|
+
}
|
|
606
610
|
await pc.setLocalDescription(await pc.createOffer());
|
|
607
611
|
|
|
608
612
|
const viewer = await request.accept(pc.localDescription!.sdp);
|
|
@@ -617,6 +621,45 @@ stream.on("request", async (request) => {
|
|
|
617
621
|
await stream.stop();
|
|
618
622
|
```
|
|
619
623
|
|
|
624
|
+
A request that nobody has answered can end: the viewer withdraws it or goes out of view, or
|
|
625
|
+
the stream ends. `request.on("closed", ({ cause }) => …)` fires then, with `"withdrawn"` or
|
|
626
|
+
`"ended"`, so a UI can drop the request without polling `request.state`; `accept` and `deny`
|
|
627
|
+
then throw. It is not emitted for a request that was accepted or denied.
|
|
628
|
+
|
|
629
|
+
#### Interop with the TeamSpeak 6 client
|
|
630
|
+
|
|
631
|
+
What follows was observed with the TeamSpeak 6 client 6.0.0-beta5 (macOS) against a
|
|
632
|
+
TeamSpeak 6 server 6.0.0-beta13.1.
|
|
633
|
+
|
|
634
|
+
- **Offer audio, always.** When you publish, the client answers an offer only if it has an
|
|
635
|
+
`m=audio` section. For a video-only offer it never answers: it shows a fallback picture and
|
|
636
|
+
keeps the "Join" button, which then does nothing, because the server already counts the
|
|
637
|
+
viewer as joined. Add a send-only audio transceiver even when there is no audio track; an
|
|
638
|
+
audio section before the video section was accepted. `accept` and `ViewerPeer.sendOffer`
|
|
639
|
+
send an offer without audio unchanged, and emit a `"warning"` event on `Streams` with the
|
|
640
|
+
code `"offer-without-audio"`.
|
|
641
|
+
- **Trim the codecs.** The client's own offers carry one video and one audio section, about
|
|
642
|
+
3.9 KB. A browser's offer with every codec is about 6 KB with audio and video, and about
|
|
643
|
+
4.8 KB for video alone, against a limit of about 9.2 KB for a command line. Narrowing the
|
|
644
|
+
codecs keeps room for the candidates and the message:
|
|
645
|
+
|
|
646
|
+
```ts
|
|
647
|
+
const video = pc.addTransceiver(track, { direction: "sendonly" });
|
|
648
|
+
const codecs = RTCRtpSender.getCapabilities("video")!.codecs;
|
|
649
|
+
video.setCodecPreferences(codecs.filter((c) => /^video\/(VP8|H264)$/.test(c.mimeType)));
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
- **Accept every request.** A viewer in the client shows "waiting" until the publisher
|
|
653
|
+
answers. When it withdraws and asks again, that is a new request, with a new `JoinRequest`.
|
|
654
|
+
- **A channel switch ends the viewing, not the stream.** The client leaves a stream it
|
|
655
|
+
watches when it changes channel, so the publisher sees that viewer leave. The server does not end a stream when its publisher or a viewer changes channel.
|
|
656
|
+
- Denying, stopping, leaving, disconnecting and several viewers at once, some of them the
|
|
657
|
+
client and some the SDK, behaved as they do between SDK clients.
|
|
658
|
+
|
|
659
|
+
```ts
|
|
660
|
+
streams.on("warning", (w) => console.warn(`${w.code}: ${w.message}`));
|
|
661
|
+
```
|
|
662
|
+
|
|
620
663
|
Things to know:
|
|
621
664
|
|
|
622
665
|
- A client may run several streams, so every stream is known by its id. `list()` is what
|
|
@@ -826,9 +869,8 @@ From 1.0 the package follows semver, as described under
|
|
|
826
869
|
event map may gain members in a minor release; give a `switch` over them a
|
|
827
870
|
default case.
|
|
828
871
|
|
|
829
|
-
An API that may still change in a minor release is marked `@experimental`
|
|
830
|
-
|
|
831
|
-
show. Today that is the whole `@honeybbq/teamspeak/stream` entry point, and the whole
|
|
872
|
+
An API that may still change in a minor release is marked `@experimental` in its TSDoc,
|
|
873
|
+
which editors and the API reference show. Today that is the whole
|
|
832
874
|
`@honeybbq/teamspeak/query` entry point, the server view (`client.view` and the
|
|
833
875
|
view events), the `previous` field of the client-left and channel-deleted
|
|
834
876
|
events, and `getServerVariables`.
|
|
@@ -1043,7 +1085,7 @@ with the same semantics, apart from what the languages make differ:
|
|
|
1043
1085
|
| `@honeybbq/teamspeak` | What every TeamSpeak connection shares: the command language, ids, errors, the typed commands, the event types and the status and reconnection types |
|
|
1044
1086
|
| `@honeybbq/teamspeak/client` | The voice client, identities, file transfers, diagnostics and its retry policy |
|
|
1045
1087
|
| `@honeybbq/teamspeak/versions` | Client versions a server accepts, for the client's `version` option; data only, one export each |
|
|
1046
|
-
| `@honeybbq/teamspeak/stream` | TeamSpeak 6 streams, the screen share: finding, publishing and watching them; signalling only, no WebRTC code
|
|
1088
|
+
| `@honeybbq/teamspeak/stream` | TeamSpeak 6 streams, the screen share: finding, publishing and watching them; signalling only, no WebRTC code |
|
|
1047
1089
|
| `@honeybbq/teamspeak/query` | The ServerQuery client, running the same typed commands over raw TCP, SSH or WebQuery; `@experimental` |
|
|
1048
1090
|
|
|
1049
1091
|
Each entry exports only its own symbols. The client entry does not re-export
|
package/dist/stream/errors.d.ts
CHANGED
|
@@ -5,8 +5,6 @@ import type { ServerFamily } from "@honeybbq/teamspeak";
|
|
|
5
5
|
* TeamSpeak 3 server answers none of the stream commands, not even with an
|
|
6
6
|
* error, so `publish` and `watch` refuse before sending rather than wait out
|
|
7
7
|
* a timeout.
|
|
8
|
-
*
|
|
9
|
-
* @beta
|
|
10
8
|
*/
|
|
11
9
|
export declare class StreamsUnsupportedError extends TeamspeakError {
|
|
12
10
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -23,8 +21,6 @@ export declare class StreamsUnsupportedError extends TeamspeakError {
|
|
|
23
21
|
* The server remembers no decision, so a client can ask again, and every ask
|
|
24
22
|
* is relayed to the publisher. A publisher that means to refuse for good can
|
|
25
23
|
* set `rememberDenied`, or leave the request unanswered.
|
|
26
|
-
*
|
|
27
|
-
* @beta
|
|
28
24
|
*/
|
|
29
25
|
export declare class StreamJoinDeniedError extends TeamspeakError {
|
|
30
26
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -40,8 +36,6 @@ export declare class StreamJoinDeniedError extends TeamspeakError {
|
|
|
40
36
|
* line of about 9.2 KB, escaped, without an answer, so the call fails before
|
|
41
37
|
* sending instead of timing out; `MAX_COMMAND_LINE_BYTES` has the exact
|
|
42
38
|
* figure. An SDP offer of a few kilobytes is far under it.
|
|
43
|
-
*
|
|
44
|
-
* @beta
|
|
45
39
|
*/
|
|
46
40
|
export declare class StreamPayloadTooLargeError extends TeamspeakError {
|
|
47
41
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -60,8 +54,6 @@ export declare class StreamPayloadTooLargeError extends TeamspeakError {
|
|
|
60
54
|
* of, and when the stream ends before its owner answers; a signalling call
|
|
61
55
|
* does when the stream ended under it. The server's
|
|
62
56
|
* own refusal, when there was one, is the `cause`.
|
|
63
|
-
*
|
|
64
|
-
* @beta
|
|
65
57
|
*/
|
|
66
58
|
export declare class StreamEndedError extends TeamspeakError {
|
|
67
59
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/stream/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/stream/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD;;;;;GAKG;AACH,qBAAa,uBAAwB,SAAQ,cAAc;IACzD,4DAA4D;IAC5D,gBAAyB,IAAI,EAAE,MAAM,CAA6B;IAYlE,6DAA6D;IAC7D,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,0FAA0F;IAC1F,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,YAAY,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAQhD;CACF;AAED;;;;;;GAMG;AACH,qBAAa,qBAAsB,SAAQ,cAAc;IACvD,4DAA4D;IAC5D,gBAAyB,IAAI,EAAE,MAAM,CAA2B;IAYhE,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mEAAmE;IACnE,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAE/B,YAAY,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAM5C;CACF;AAED;;;;;GAKG;AACH,qBAAa,0BAA2B,SAAQ,cAAc;IAC5D,4DAA4D;IAC5D,gBAAyB,IAAI,EAAE,MAAM,CAAgC;IAYrE,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,2DAA2D;IAC3D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,YAAY,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAKvD;CACF;AAED;;;;;;GAMG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,4DAA4D;IAC5D,gBAAyB,IAAI,EAAE,MAAM,CAAsB;IAY3D,6BAA6B;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE1B,YAAY,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAGnD;CACF"}
|
package/dist/stream/errors.js
CHANGED
|
@@ -4,8 +4,6 @@ import { TeamspeakError } from "@honeybbq/teamspeak";
|
|
|
4
4
|
* TeamSpeak 3 server answers none of the stream commands, not even with an
|
|
5
5
|
* error, so `publish` and `watch` refuse before sending rather than wait out
|
|
6
6
|
* a timeout.
|
|
7
|
-
*
|
|
8
|
-
* @beta
|
|
9
7
|
*/
|
|
10
8
|
export class StreamsUnsupportedError extends TeamspeakError {
|
|
11
9
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -36,8 +34,6 @@ export class StreamsUnsupportedError extends TeamspeakError {
|
|
|
36
34
|
* The server remembers no decision, so a client can ask again, and every ask
|
|
37
35
|
* is relayed to the publisher. A publisher that means to refuse for good can
|
|
38
36
|
* set `rememberDenied`, or leave the request unanswered.
|
|
39
|
-
*
|
|
40
|
-
* @beta
|
|
41
37
|
*/
|
|
42
38
|
export class StreamJoinDeniedError extends TeamspeakError {
|
|
43
39
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -67,8 +63,6 @@ export class StreamJoinDeniedError extends TeamspeakError {
|
|
|
67
63
|
* line of about 9.2 KB, escaped, without an answer, so the call fails before
|
|
68
64
|
* sending instead of timing out; `MAX_COMMAND_LINE_BYTES` has the exact
|
|
69
65
|
* figure. An SDP offer of a few kilobytes is far under it.
|
|
70
|
-
*
|
|
71
|
-
* @beta
|
|
72
66
|
*/
|
|
73
67
|
export class StreamPayloadTooLargeError extends TeamspeakError {
|
|
74
68
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -102,8 +96,6 @@ export class StreamPayloadTooLargeError extends TeamspeakError {
|
|
|
102
96
|
* of, and when the stream ends before its owner answers; a signalling call
|
|
103
97
|
* does when the stream ended under it. The server's
|
|
104
98
|
* own refusal, when there was one, is the `cause`.
|
|
105
|
-
*
|
|
106
|
-
* @beta
|
|
107
99
|
*/
|
|
108
100
|
export class StreamEndedError extends TeamspeakError {
|
|
109
101
|
/** {@inheritDoc @honeybbq/teamspeak!TeamspeakError.kind} */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/stream/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/stream/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,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AClB,CAAC,CAAC;IACL,CAAC;IAED,6BAA6B;IACpB,QAAQ,CAAS;IAE1B,YAAY,QAAgB,EAAE,OAAsB;QAClD,KAAK,CAAC,UAAU,QAAQ,6BAA6B,EAAE,OAAO,CAAC,CAAC;QAChE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF"}
|
package/dist/stream/index.d.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* TeamSpeak 6 streams, the screen share: finding the streams of the clients in
|
|
3
3
|
* view, publishing one, and watching one.
|
|
4
4
|
*
|
|
5
|
-
* TeamSpeak does not document the protocol
|
|
6
|
-
* TeamSpeak 6 6.0.0-beta13.1 and
|
|
7
|
-
*
|
|
5
|
+
* TeamSpeak does not document the protocol. It was verified against the
|
|
6
|
+
* TeamSpeak 6 server 6.0.0-beta13.1 and the TeamSpeak 6 client 6.0.0-beta5, and
|
|
7
|
+
* a TeamSpeak update may break it.
|
|
8
8
|
*
|
|
9
9
|
* Only the signalling is in this package. The video itself travels over WebRTC
|
|
10
10
|
* between the publisher and each viewer, which the application brings: SDP and
|
|
@@ -19,9 +19,8 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* @module @honeybbq/teamspeak/stream
|
|
22
|
-
* @beta
|
|
23
22
|
*/
|
|
24
23
|
export { Streams } from "./streams.js";
|
|
25
24
|
export { StreamEndedError, StreamJoinDeniedError, StreamPayloadTooLargeError, StreamsUnsupportedError, } from "./errors.js";
|
|
26
|
-
export type { IceCandidate, JoinRequest, JoinRequestState, Peer, PeerClosed, PeerCloseCause, PeerEvents, PublishedStream, PublishedStreamEvents, PublishOptions, RawSignal, StreamAccessibility, StreamEnded, StreamEndCause, StreamInfo, StreamsClient, StreamsEventMap, StreamsOptions, StreamSource, StreamStoppedEvent, StreamView, StreamViewerEvent, ViewerIdentity, ViewerPeer, WatchOptions, } from "./types.js";
|
|
25
|
+
export type { IceCandidate, JoinRequest, JoinRequestCloseCause, JoinRequestClosed, JoinRequestEvents, JoinRequestState, Peer, PeerClosed, PeerCloseCause, PeerEvents, PublishedStream, PublishedStreamEvents, PublishOptions, RawSignal, StreamAccessibility, StreamEnded, StreamEndCause, StreamInfo, StreamsClient, StreamsEventMap, StreamsOptions, StreamSource, StreamStoppedEvent, StreamView, StreamWarning, StreamWarningCode, StreamViewerEvent, ViewerIdentity, ViewerPeer, WatchOptions, } from "./types.js";
|
|
27
26
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stream/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACV,cAAc,EACd,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,cAAc,EACd,SAAS,EACT,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,UAAU,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/dist/stream/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* TeamSpeak 6 streams, the screen share: finding the streams of the clients in
|
|
3
3
|
* view, publishing one, and watching one.
|
|
4
4
|
*
|
|
5
|
-
* TeamSpeak does not document the protocol
|
|
6
|
-
* TeamSpeak 6 6.0.0-beta13.1 and
|
|
7
|
-
*
|
|
5
|
+
* TeamSpeak does not document the protocol. It was verified against the
|
|
6
|
+
* TeamSpeak 6 server 6.0.0-beta13.1 and the TeamSpeak 6 client 6.0.0-beta5, and
|
|
7
|
+
* a TeamSpeak update may break it.
|
|
8
8
|
*
|
|
9
9
|
* Only the signalling is in this package. The video itself travels over WebRTC
|
|
10
10
|
* between the publisher and each viewer, which the application brings: SDP and
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
* ```
|
|
20
20
|
*
|
|
21
21
|
* @module @honeybbq/teamspeak/stream
|
|
22
|
-
* @beta
|
|
23
22
|
*/
|
|
24
23
|
export { Streams } from "./streams.js";
|
|
25
24
|
export { StreamEndedError, StreamJoinDeniedError, StreamPayloadTooLargeError, StreamsUnsupportedError, } from "./errors.js";
|
package/dist/stream/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stream/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stream/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,0BAA0B,EAC1B,uBAAuB,GACxB,MAAM,aAAa,CAAC"}
|
package/dist/stream/peer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClientID, Unsubscribe } from "@honeybbq/teamspeak";
|
|
2
|
-
import type { IceCandidate, Peer, PeerClosed, PeerEvents, StreamView, ViewerPeer } from "./types.js";
|
|
2
|
+
import type { IceCandidate, Peer, PeerClosed, PeerEvents, StreamView, StreamWarning, ViewerPeer } from "./types.js";
|
|
3
3
|
/** What a peer needs of the `Streams` that made it. */
|
|
4
4
|
export interface PeerLink {
|
|
5
5
|
/** Send a signalling JSON to the other end. */
|
|
@@ -10,7 +10,11 @@ export interface PeerLink {
|
|
|
10
10
|
closed(peer: PeerImpl): void;
|
|
11
11
|
/** Something happened that nobody awaits, such as an event dropped for want of a listener. */
|
|
12
12
|
report(error: Error): void;
|
|
13
|
+
/** Something noticed that is let through; absent where nothing is checked. */
|
|
14
|
+
warn?(warning: StreamWarning): void;
|
|
13
15
|
}
|
|
16
|
+
/** The warning for an offer with no audio section. */
|
|
17
|
+
export declare function noAudioWarning(streamId: string, clientId: ClientID): StreamWarning;
|
|
14
18
|
/** One end of a stream's signalling with one other client. */
|
|
15
19
|
export declare class PeerImpl implements Peer {
|
|
16
20
|
#private;
|
|
@@ -22,6 +26,8 @@ export declare class PeerImpl implements Peer {
|
|
|
22
26
|
sendCandidate(candidate: IceCandidate): Promise<void>;
|
|
23
27
|
sendSignal(cmd: string, args: unknown): Promise<void>;
|
|
24
28
|
close(): Promise<void>;
|
|
29
|
+
/** Warn that an offer for this peer has no audio section. */
|
|
30
|
+
protected warnWithoutAudio(): void;
|
|
25
31
|
/** Send a message of the subclasses'. */
|
|
26
32
|
protected send(json: string): Promise<void>;
|
|
27
33
|
/** A signalling JSON from the other end. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/stream/peer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,YAAY,EACZ,IAAI,EACJ,UAAU,EACV,UAAU,EACV,UAAU,EACV,UAAU,EACX,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"peer.d.ts","sourceRoot":"","sources":["../../src/stream/peer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,KAAK,EACV,YAAY,EACZ,IAAI,EACJ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AC,CAI3B;IAED,6DAA6D;IAC7D,SAAS,CAAC,gBAAgB,IAAI,IAAI,CAEjC;IAED,yCAAyC;IACzC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1C;IAOD,4CAA4C;IAC5C,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAiB1B;IAED,8CAA8C;IAC9C,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAK5B;CACF;AAED,mDAAmD;AACnD,qBAAa,cAAe,SAAQ,QAAS,YAAW,UAAU;IAChE,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGpC;CACF;AAED,oDAAoD;AACpD,qBAAa,cAAe,SAAQ,QAAS,YAAW,UAAU;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,YAAY,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAG9E;IAED,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAEjC;IAED,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAErB;CACF"}
|
package/dist/stream/peer.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { TeamspeakError } from "@honeybbq/teamspeak";
|
|
2
2
|
import { Emitter, MAX_KEPT } from "./emitter.js";
|
|
3
|
-
import { answerJson, candidateJson, encodeSignal, offerJson, parseSignal } from "./wire.js";
|
|
3
|
+
import { answerJson, candidateJson, encodeSignal, hasAudioSection, offerJson, parseSignal, } from "./wire.js";
|
|
4
|
+
/** The warning for an offer with no audio section. */
|
|
5
|
+
export function noAudioWarning(streamId, clientId) {
|
|
6
|
+
return {
|
|
7
|
+
code: "offer-without-audio",
|
|
8
|
+
streamId,
|
|
9
|
+
clientId,
|
|
10
|
+
message: `the offer for client ${clientId} has no m=audio section: the TeamSpeak 6 client does not answer an offer without audio, and its Join button then does nothing`,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
4
13
|
/** One end of a stream's signalling with one other client. */
|
|
5
14
|
export class PeerImpl {
|
|
6
15
|
streamId;
|
|
@@ -39,6 +48,10 @@ export class PeerImpl {
|
|
|
39
48
|
this.end({ cause: "closed" });
|
|
40
49
|
await this.#link.leave?.();
|
|
41
50
|
}
|
|
51
|
+
/** Warn that an offer for this peer has no audio section. */
|
|
52
|
+
warnWithoutAudio() {
|
|
53
|
+
this.#link.warn?.(noAudioWarning(this.streamId, this.clientId));
|
|
54
|
+
}
|
|
42
55
|
/** Send a message of the subclasses'. */
|
|
43
56
|
send(json) {
|
|
44
57
|
return this.#send(() => json);
|
|
@@ -80,6 +93,8 @@ export class PeerImpl {
|
|
|
80
93
|
/** The publisher's end for one accepted viewer. */
|
|
81
94
|
export class ViewerPeerImpl extends PeerImpl {
|
|
82
95
|
sendOffer(sdp) {
|
|
96
|
+
if (!hasAudioSection(sdp))
|
|
97
|
+
this.warnWithoutAudio();
|
|
83
98
|
return this.send(offerJson(sdp));
|
|
84
99
|
}
|
|
85
100
|
}
|
package/dist/stream/peer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../src/stream/peer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"peer.js","sourceRoot":"","sources":["../../src/stream/peer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAUjD,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,eAAe,EACf,SAAS,EACT,WA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AK;QACH,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ClientID, CommandRequest, Unsubscribe } from "@honeybbq/teamspeak";
|
|
2
2
|
import { ViewerPeerImpl } from "./peer.js";
|
|
3
|
-
import type { PublishedStream, PublishedStreamEvents, StreamEnded, StreamInfo, ViewerIdentity, ViewerPeer } from "./types.js";
|
|
3
|
+
import type { PublishedStream, PublishedStreamEvents, StreamEnded, StreamInfo, StreamWarning, ViewerIdentity, ViewerPeer } from "./types.js";
|
|
4
4
|
/** What a published stream needs of the `Streams` that made it. */
|
|
5
5
|
export interface PublishHost {
|
|
6
6
|
/**
|
|
@@ -14,6 +14,8 @@ export interface PublishHost {
|
|
|
14
14
|
isDenied(identity: ViewerIdentity): boolean;
|
|
15
15
|
/** Note that a viewer was denied. */
|
|
16
16
|
remember(identity: ViewerIdentity): void;
|
|
17
|
+
/** Pass on something noticed that is let through. */
|
|
18
|
+
warn(warning: StreamWarning): void;
|
|
17
19
|
/** Send a stream command; a stream the server does not know is a StreamEndedError. */
|
|
18
20
|
send(request: CommandRequest, streamId: string): Promise<void>;
|
|
19
21
|
/** Send `stopstream` for a stream of this client's; a stream already gone is not an error. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published.d.ts","sourceRoot":"","sources":["../../src/stream/published.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"published.d.ts","sourceRoot":"","sources":["../../src/stream/published.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEjF,OAAO,EAAE,cAAc,EAAkB,MAAM,WAAW,CAAC;AAE3D,OAAO,KAAK,EAKV,eAAe,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qB,EACtC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAAK,IAAI,GACpD,WAAW,CAEb;IAED,OAAO,IAAI,SAAS,UAAU,EAAE,CAE/B;IAEK,IAAI,CAAC,MAAM,SAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAOpC;IAED,gDAAgD;IAChD,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAkB7C;IAED,+BAA+B;IAC/B,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAwBjD;IAED,2GAA2G;IAC3G,WAAW,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIpC;IAED,0DAA0D;IAC1D,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAGnC;IAED;;;;OAIG;IACH,MAAM,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAKhD;IAED,mEAAmE;IACnE,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAW/B;CACF"}
|
package/dist/stream/published.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { TeamspeakError } from "@honeybbq/teamspeak";
|
|
2
2
|
import { Emitter, MAX_KEPT } from "./emitter.js";
|
|
3
|
-
import { ViewerPeerImpl } from "./peer.js";
|
|
4
|
-
import { assertFits, respondRequest, signalRequest } from "./wire.js";
|
|
3
|
+
import { ViewerPeerImpl, noAudioWarning } from "./peer.js";
|
|
4
|
+
import { assertFits, hasAudioSection, respondRequest, signalRequest } from "./wire.js";
|
|
5
5
|
class JoinRequestImpl {
|
|
6
6
|
streamId;
|
|
7
7
|
viewer;
|
|
8
8
|
message;
|
|
9
9
|
#state = "pending";
|
|
10
10
|
#stream;
|
|
11
|
+
#emitter = new Emitter(["closed"]);
|
|
11
12
|
constructor(stream, viewer, message) {
|
|
12
13
|
this.#stream = stream;
|
|
13
14
|
this.streamId = stream.id;
|
|
@@ -17,10 +18,15 @@ class JoinRequestImpl {
|
|
|
17
18
|
get state() {
|
|
18
19
|
return this.#state;
|
|
19
20
|
}
|
|
21
|
+
on(event, listener) {
|
|
22
|
+
return this.#emitter.on(event, listener);
|
|
23
|
+
}
|
|
20
24
|
/** The request will not be answered: the viewer withdrew it, or the stream ended. */
|
|
21
|
-
close(
|
|
22
|
-
if (this.#state
|
|
23
|
-
|
|
25
|
+
close(cause) {
|
|
26
|
+
if (this.#state !== "pending")
|
|
27
|
+
return;
|
|
28
|
+
this.#state = cause;
|
|
29
|
+
this.#emitter.emit("closed", { cause });
|
|
24
30
|
}
|
|
25
31
|
#assertPending() {
|
|
26
32
|
if (this.#state !== "pending") {
|
|
@@ -35,6 +41,9 @@ class JoinRequestImpl {
|
|
|
35
41
|
const request = respondRequest(this.streamId, this.viewer.clientId, message, offer, true);
|
|
36
42
|
// Before the request is used up: a too long offer may be shortened and tried again.
|
|
37
43
|
assertFits(request);
|
|
44
|
+
if (!hasAudioSection(offer)) {
|
|
45
|
+
this.#stream.host.warn(noAudioWarning(this.streamId, this.viewer.clientId));
|
|
46
|
+
}
|
|
38
47
|
this.#state = "accepted";
|
|
39
48
|
// Made before the offer goes out: the viewer answers, and the publisher's
|
|
40
49
|
// side starts sending candidates, as soon as it has the offer, and what
|
|
@@ -129,6 +138,7 @@ export class PublishedImpl {
|
|
|
129
138
|
}
|
|
130
139
|
},
|
|
131
140
|
report: (error) => this.host.report(error),
|
|
141
|
+
warn: (warning) => this.host.warn(warning),
|
|
132
142
|
});
|
|
133
143
|
this.#closedViewers.delete(clientId);
|
|
134
144
|
this.#peers.set(clientId, peer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"published.js","sourceRoot":"","sources":["../../src/stream/published.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE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AC,QAAQ,CAAC,MAAM,EAAE;YAAE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,KAAK,GACT,KAAK,CAAC,KAAK,KAAK,cAAc,IAAI,KAAK,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;QACzF,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;YACxC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QAChF,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC;CACF"}
|
package/dist/stream/streams.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ import type { PublishedStream, PublishOptions, StreamInfo, StreamsClient, Stream
|
|
|
8
8
|
* and each viewer over WebRTC, which is the application's: this gives it the
|
|
9
9
|
* SDP and ICE messages as strings, and takes them back, and any WebRTC stack
|
|
10
10
|
* can be plugged in. TeamSpeak does not document the protocol and it was
|
|
11
|
-
* measured on TeamSpeak 6 6.0.0-beta13.1
|
|
12
|
-
*
|
|
11
|
+
* measured on TeamSpeak 6 6.0.0-beta13.1 and tried with the TeamSpeak 6 client
|
|
12
|
+
* 6.0.0-beta5.
|
|
13
13
|
*
|
|
14
14
|
* `Streams` attaches to a voice client, before or after it connects, and finds
|
|
15
15
|
* the streams of the clients it sees: a client with `client_is_streaming` set
|
|
@@ -24,8 +24,6 @@ import type { PublishedStream, PublishOptions, StreamInfo, StreamsClient, Stream
|
|
|
24
24
|
* const view = await streams.watch(info);
|
|
25
25
|
* // hand view.offer to an RTCPeerConnection, send its answer with view.answer()
|
|
26
26
|
* ```
|
|
27
|
-
*
|
|
28
|
-
* @beta
|
|
29
27
|
*/
|
|
30
28
|
export declare class Streams {
|
|
31
29
|
#private;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/stream/streams.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAKV,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,UAAU,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EAEV,YAAY,EACb,MAAM,YAAY,CAAC;AA+DpB
|
|
1
|
+
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/stream/streams.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAKV,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAS7B,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEd,UAAU,EACV,aAAa,EACb,eAAe,EACf,cAAc,EACd,UAAU,EAEV,YAAY,EACb,MAAM,YAAY,CAAC;AA+DpB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,OAAO;;IAyBlB;;;OAGG;IACH,YAAY,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE,cAAmB,EAiC9D;IAED,yEAAyE;IACzE,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,6DAA6D;IAC7D,IAAI,IAAI,SAAS,UAAU,EAAE,CAE5B;IAED,yCAAyC;IACzC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAEtC;IAED,yEAAyE;IACzE,EAAE,CAAC,CAAC,SAAS,MAAM,eAAe,EAChC,KAAK,EAAE,CAAC,EACR,QAAQ,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAC9C,WAAW,CAEb;IAED;;;;;;;;;;;OAWG;IACH,OAAO,IAAI,IAAI,CAKd;IAID;;;;;;;;;;;;;;;;;OAiBG;IACG,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC,CA6B/D;IAqFD;;;;;;;;;;;;OAYG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,UAAU,CAAC,CA2CxF;CA0VF"}
|
package/dist/stream/streams.js
CHANGED
|
@@ -39,8 +39,8 @@ function signalOption(signal) {
|
|
|
39
39
|
* and each viewer over WebRTC, which is the application's: this gives it the
|
|
40
40
|
* SDP and ICE messages as strings, and takes them back, and any WebRTC stack
|
|
41
41
|
* can be plugged in. TeamSpeak does not document the protocol and it was
|
|
42
|
-
* measured on TeamSpeak 6 6.0.0-beta13.1
|
|
43
|
-
*
|
|
42
|
+
* measured on TeamSpeak 6 6.0.0-beta13.1 and tried with the TeamSpeak 6 client
|
|
43
|
+
* 6.0.0-beta5.
|
|
44
44
|
*
|
|
45
45
|
* `Streams` attaches to a voice client, before or after it connects, and finds
|
|
46
46
|
* the streams of the clients it sees: a client with `client_is_streaming` set
|
|
@@ -55,15 +55,13 @@ function signalOption(signal) {
|
|
|
55
55
|
* const view = await streams.watch(info);
|
|
56
56
|
* // hand view.offer to an RTCPeerConnection, send its answer with view.answer()
|
|
57
57
|
* ```
|
|
58
|
-
*
|
|
59
|
-
* @beta
|
|
60
58
|
*/
|
|
61
59
|
export class Streams {
|
|
62
60
|
#client;
|
|
63
61
|
#rememberDenied;
|
|
64
|
-
// Errors nobody listens for wait for the first listener, as other
|
|
65
|
-
// events do; past the bound the oldest is dropped, with no report of its own.
|
|
66
|
-
#emitter = new Emitter(["error"]);
|
|
62
|
+
// Errors and warnings nobody listens for wait for the first listener, as other
|
|
63
|
+
// early events do; past the bound the oldest is dropped, with no report of its own.
|
|
64
|
+
#emitter = new Emitter(["error", "warning"]);
|
|
67
65
|
#infos = new Map();
|
|
68
66
|
/** The clients whose streams were asked for, until the flag clears or they go. */
|
|
69
67
|
#asked = new Set();
|
|
@@ -375,6 +373,7 @@ export class Streams {
|
|
|
375
373
|
return getClientUIDInfoByID(this.#client, clientId).then((info) => ({ clientId, uid: info.uid, nickname: info.nickname }), () => ({ clientId, uid: undefined, nickname: undefined }));
|
|
376
374
|
},
|
|
377
375
|
report: (error) => this.#report(error),
|
|
376
|
+
warn: (warning) => this.#emitter.emit("warning", warning),
|
|
378
377
|
isDenied: (identity) => this.#rememberDenied && identity.uid !== undefined && this.#denied.has(identity.uid),
|
|
379
378
|
remember: (identity) => {
|
|
380
379
|
if (!this.#rememberDenied || identity.uid === undefined)
|