werift 0.19.9 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/common/src/event.d.ts +45 -0
- package/lib/common/src/event.js +232 -0
- package/lib/common/src/event.js.map +1 -0
- package/lib/common/src/index.d.ts +1 -0
- package/lib/common/src/index.js +1 -0
- package/lib/common/src/index.js.map +1 -1
- package/lib/dtls/src/flight/client/flight5.js +6 -1
- package/lib/dtls/src/flight/client/flight5.js.map +1 -1
- package/lib/dtls/src/imports/common.d.ts +1 -0
- package/lib/dtls/src/imports/common.js +18 -0
- package/lib/dtls/src/imports/common.js.map +1 -0
- package/lib/dtls/src/socket.d.ts +1 -1
- package/lib/dtls/src/socket.js +5 -5
- package/lib/dtls/src/socket.js.map +1 -1
- package/lib/ice/src/candidate.d.ts +1 -1
- package/lib/ice/src/candidate.js +2 -1
- package/lib/ice/src/candidate.js.map +1 -1
- package/lib/ice/src/helper.js +2 -2
- package/lib/ice/src/helper.js.map +1 -1
- package/lib/ice/src/ice.d.ts +10 -5
- package/lib/ice/src/ice.js +46 -16
- package/lib/ice/src/ice.js.map +1 -1
- package/lib/ice/src/imports/common.d.ts +1 -0
- package/lib/ice/src/imports/common.js +18 -0
- package/lib/ice/src/imports/common.js.map +1 -0
- package/lib/ice/src/index.d.ts +4 -0
- package/lib/ice/src/index.js +4 -0
- package/lib/ice/src/index.js.map +1 -1
- package/lib/ice/src/stun/message.d.ts +1 -0
- package/lib/ice/src/stun/message.js +16 -6
- package/lib/ice/src/stun/message.js.map +1 -1
- package/lib/ice/src/stun/protocol.d.ts +3 -2
- package/lib/ice/src/stun/protocol.js +13 -7
- package/lib/ice/src/stun/protocol.js.map +1 -1
- package/lib/ice/src/stun/transaction.js +4 -3
- package/lib/ice/src/stun/transaction.js.map +1 -1
- package/lib/ice/src/transport.d.ts +21 -4
- package/lib/ice/src/transport.js +115 -7
- package/lib/ice/src/transport.js.map +1 -1
- package/lib/ice/src/turn/protocol.d.ts +52 -36
- package/lib/ice/src/turn/protocol.js +183 -76
- package/lib/ice/src/turn/protocol.js.map +1 -1
- package/lib/ice/src/types/model.d.ts +5 -5
- package/lib/ice/src/types/model.js.map +1 -1
- package/lib/ice/src/utils.d.ts +1 -0
- package/lib/ice/src/utils.js +15 -16
- package/lib/ice/src/utils.js.map +1 -1
- package/lib/rtp/src/extra/container/mp4/container.d.ts +1 -1
- package/lib/rtp/src/extra/container/mp4/container.js +2 -5
- package/lib/rtp/src/extra/container/mp4/container.js.map +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.d.ts +1 -1
- package/lib/rtp/src/extra/processor/depacketizer.js +2 -2
- package/lib/rtp/src/extra/processor/depacketizer.js.map +1 -1
- package/lib/rtp/src/extra/processor/mp4.d.ts +1 -1
- package/lib/rtp/src/extra/processor/mp4.js +2 -5
- package/lib/rtp/src/extra/processor/mp4.js.map +1 -1
- package/lib/rtp/src/extra/processor/nack.d.ts +1 -1
- package/lib/rtp/src/extra/processor/nack.js +3 -3
- package/lib/rtp/src/extra/processor/nack.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtcpCallback.js +2 -5
- package/lib/rtp/src/extra/processor/rtcpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.d.ts +1 -1
- package/lib/rtp/src/extra/processor/rtpCallback.js +2 -5
- package/lib/rtp/src/extra/processor/rtpCallback.js.map +1 -1
- package/lib/rtp/src/extra/processor/webm.d.ts +1 -1
- package/lib/rtp/src/extra/processor/webm.js +2 -5
- package/lib/rtp/src/extra/processor/webm.js.map +1 -1
- package/lib/rtp/src/imports/common.d.ts +1 -0
- package/lib/rtp/src/imports/common.js +18 -0
- package/lib/rtp/src/imports/common.js.map +1 -0
- package/lib/sctp/src/helper.js +2 -5
- package/lib/sctp/src/helper.js.map +1 -1
- package/lib/sctp/src/imports/common.d.ts +1 -0
- package/lib/sctp/src/imports/common.js +18 -0
- package/lib/sctp/src/imports/common.js.map +1 -0
- package/lib/sctp/src/sctp.d.ts +1 -1
- package/lib/sctp/src/sctp.js +3 -3
- package/lib/sctp/src/sctp.js.map +1 -1
- package/lib/webrtc/src/dataChannel.d.ts +1 -1
- package/lib/webrtc/src/dataChannel.js +5 -5
- package/lib/webrtc/src/dataChannel.js.map +1 -1
- package/lib/webrtc/src/imports/common.d.ts +1 -0
- package/lib/webrtc/src/imports/common.js +18 -0
- package/lib/webrtc/src/imports/common.js.map +1 -0
- package/lib/webrtc/src/media/receiver/nack.d.ts +1 -1
- package/lib/webrtc/src/media/receiver/nack.js +2 -2
- package/lib/webrtc/src/media/receiver/nack.js.map +1 -1
- package/lib/webrtc/src/media/rtpReceiver.d.ts +2 -2
- package/lib/webrtc/src/media/rtpReceiver.js +2 -5
- package/lib/webrtc/src/media/rtpReceiver.js.map +1 -1
- package/lib/webrtc/src/media/rtpSender.d.ts +1 -1
- package/lib/webrtc/src/media/rtpSender.js +5 -5
- package/lib/webrtc/src/media/rtpSender.js.map +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.d.ts +1 -1
- package/lib/webrtc/src/media/rtpTransceiver.js +2 -5
- package/lib/webrtc/src/media/rtpTransceiver.js.map +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.d.ts +1 -1
- package/lib/webrtc/src/media/sender/senderBWE.js +4 -7
- package/lib/webrtc/src/media/sender/senderBWE.js.map +1 -1
- package/lib/webrtc/src/media/track.d.ts +1 -1
- package/lib/webrtc/src/media/track.js +4 -7
- package/lib/webrtc/src/media/track.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/index.d.ts +2 -1
- package/lib/webrtc/src/nonstandard/recorder/index.js +2 -5
- package/lib/webrtc/src/nonstandard/recorder/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/index.js.map +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.d.ts +1 -1
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js +2 -2
- package/lib/webrtc/src/nonstandard/recorder/writer/webm.js.map +1 -1
- package/lib/webrtc/src/peerConnection.d.ts +9 -6
- package/lib/webrtc/src/peerConnection.js +31 -18
- package/lib/webrtc/src/peerConnection.js.map +1 -1
- package/lib/webrtc/src/transport/dtls.d.ts +1 -1
- package/lib/webrtc/src/transport/dtls.js +12 -8
- package/lib/webrtc/src/transport/dtls.js.map +1 -1
- package/lib/webrtc/src/transport/ice.d.ts +3 -3
- package/lib/webrtc/src/transport/ice.js +14 -8
- package/lib/webrtc/src/transport/ice.js.map +1 -1
- package/lib/webrtc/src/transport/sctp.d.ts +1 -1
- package/lib/webrtc/src/transport/sctp.js +2 -2
- package/lib/webrtc/src/transport/sctp.js.map +1 -1
- package/package.json +1 -1
- package/src/dataChannel.ts +1 -1
- package/src/imports/common.ts +1 -0
- package/src/media/receiver/nack.ts +1 -1
- package/src/media/rtpReceiver.ts +1 -1
- package/src/media/rtpSender.ts +1 -1
- package/src/media/rtpTransceiver.ts +1 -1
- package/src/media/sender/senderBWE.ts +1 -1
- package/src/media/track.ts +1 -1
- package/src/nonstandard/recorder/index.ts +3 -1
- package/src/nonstandard/recorder/writer/index.ts +1 -1
- package/src/nonstandard/recorder/writer/webm.ts +1 -1
- package/src/peerConnection.ts +30 -15
- package/src/transport/dtls.ts +11 -5
- package/src/transport/ice.ts +14 -8
- package/src/transport/sctp.ts +1 -1
package/src/transport/dtls.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Certificate, PrivateKey } from "@fidm/x509";
|
|
2
2
|
import debug from "debug";
|
|
3
|
-
import Event from "rx.mini";
|
|
4
3
|
import { setTimeout } from "timers/promises";
|
|
5
4
|
import { v4 } from "uuid";
|
|
5
|
+
import { Event } from "../imports/common";
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
DtlsClient,
|
|
@@ -106,8 +106,12 @@ export class RTCDtlsTransport {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
async start() {
|
|
109
|
-
if (this.state !== "new")
|
|
110
|
-
|
|
109
|
+
if (this.state !== "new") {
|
|
110
|
+
throw new Error("state must be new");
|
|
111
|
+
}
|
|
112
|
+
if (this.remoteParameters?.fingerprints.length === 0) {
|
|
113
|
+
throw new Error("remote fingerprint not exist");
|
|
114
|
+
}
|
|
111
115
|
|
|
112
116
|
if (this.role === "auto") {
|
|
113
117
|
if (this.iceTransport.role === "controlling") {
|
|
@@ -119,7 +123,7 @@ export class RTCDtlsTransport {
|
|
|
119
123
|
|
|
120
124
|
this.setState("connecting");
|
|
121
125
|
|
|
122
|
-
await new Promise<void>(async (r) => {
|
|
126
|
+
await new Promise<void>(async (r, f) => {
|
|
123
127
|
if (this.role === "server") {
|
|
124
128
|
this.dtls = new DtlsServer({
|
|
125
129
|
cert: this.localCertificate?.certPem,
|
|
@@ -153,9 +157,10 @@ export class RTCDtlsTransport {
|
|
|
153
157
|
this.setState("closed");
|
|
154
158
|
});
|
|
155
159
|
this.dtls.onConnect.once(r);
|
|
156
|
-
this.dtls.onError.
|
|
160
|
+
this.dtls.onError.once((error) => {
|
|
157
161
|
this.setState("failed");
|
|
158
162
|
log("dtls failed", error);
|
|
163
|
+
f(error);
|
|
159
164
|
});
|
|
160
165
|
|
|
161
166
|
if (this.dtls instanceof DtlsClient) {
|
|
@@ -163,6 +168,7 @@ export class RTCDtlsTransport {
|
|
|
163
168
|
this.dtls.connect().catch((error) => {
|
|
164
169
|
this.setState("failed");
|
|
165
170
|
log("dtls connect failed", error);
|
|
171
|
+
f(error);
|
|
166
172
|
});
|
|
167
173
|
}
|
|
168
174
|
});
|
package/src/transport/ice.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
|
-
import Event from "rx.mini";
|
|
3
2
|
import { v4 } from "uuid";
|
|
3
|
+
import { Event } from "../imports/common";
|
|
4
4
|
|
|
5
5
|
import { Candidate, Connection, type IceOptions } from "../../../ice/src";
|
|
6
6
|
import { candidateFromSdp, candidateToSdp } from "../sdp";
|
|
@@ -71,11 +71,16 @@ export class RTCIceTransport {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
async start() {
|
|
74
|
-
if (this.state === "closed")
|
|
75
|
-
|
|
74
|
+
if (this.state === "closed") {
|
|
75
|
+
throw new Error("RTCIceTransport is closed");
|
|
76
|
+
}
|
|
77
|
+
if (!this.connection.remotePassword || !this.connection.remoteUsername) {
|
|
76
78
|
throw new Error("remoteParams missing");
|
|
79
|
+
}
|
|
77
80
|
|
|
78
|
-
if (this.waitStart)
|
|
81
|
+
if (this.waitStart) {
|
|
82
|
+
await this.waitStart.asPromise();
|
|
83
|
+
}
|
|
79
84
|
this.waitStart = new Event();
|
|
80
85
|
|
|
81
86
|
this.setState("checking");
|
|
@@ -113,7 +118,7 @@ export const IceGathererStates = ["new", "gathering", "complete"] as const;
|
|
|
113
118
|
export type IceGathererState = (typeof IceGathererStates)[number];
|
|
114
119
|
|
|
115
120
|
export class RTCIceGatherer {
|
|
116
|
-
onIceCandidate: (candidate: IceCandidate) => void = () => {};
|
|
121
|
+
onIceCandidate: (candidate: IceCandidate | undefined) => void = () => {};
|
|
117
122
|
gatheringState: IceGathererState = "new";
|
|
118
123
|
|
|
119
124
|
readonly onGatheringStateChange = new Event<[IceGathererState]>();
|
|
@@ -126,9 +131,10 @@ export class RTCIceGatherer {
|
|
|
126
131
|
async gather() {
|
|
127
132
|
if (this.gatheringState === "new") {
|
|
128
133
|
this.setState("gathering");
|
|
129
|
-
await this.connection.gatherCandidates((candidate) =>
|
|
130
|
-
this.onIceCandidate(candidateFromIce(candidate))
|
|
131
|
-
);
|
|
134
|
+
await this.connection.gatherCandidates((candidate) => {
|
|
135
|
+
this.onIceCandidate(candidateFromIce(candidate));
|
|
136
|
+
});
|
|
137
|
+
this.onIceCandidate(undefined);
|
|
132
138
|
this.setState("complete");
|
|
133
139
|
}
|
|
134
140
|
}
|
package/src/transport/sctp.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jspack } from "@shinyoshiaki/jspack";
|
|
2
2
|
import debug from "debug";
|
|
3
|
-
import { Event } from "rx.mini";
|
|
4
3
|
import * as uuid from "uuid";
|
|
4
|
+
import { Event } from "../imports/common";
|
|
5
5
|
|
|
6
6
|
import { SCTP, SCTP_STATE, type Transport } from "../../../sctp/src";
|
|
7
7
|
import {
|