moqtail 0.7.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/README.md +514 -0
- package/dist/byte_buffer-BOK6VPTF.d.cts +864 -0
- package/dist/byte_buffer-BOK6VPTF.d.ts +864 -0
- package/dist/client/index.cjs +7785 -0
- package/dist/client/index.d.cts +1665 -0
- package/dist/client/index.d.ts +1665 -0
- package/dist/client/index.js +7767 -0
- package/dist/index.cjs +8559 -0
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +8459 -0
- package/dist/model/index.cjs +4759 -0
- package/dist/model/index.d.cts +362 -0
- package/dist/model/index.d.ts +362 -0
- package/dist/model/index.js +4645 -0
- package/dist/util/index.cjs +1799 -0
- package/dist/util/index.d.cts +205 -0
- package/dist/util/index.d.ts +205 -0
- package/dist/util/index.js +1789 -0
- package/dist/version_parameter-CgEPNuUt.d.ts +1660 -0
- package/dist/version_parameter-DCE9_itC.d.cts +1660 -0
- package/package.json +97 -0
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { n as MoqtObject } from '../byte_buffer-BOK6VPTF.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2025 The MOQtail Authors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare class NetworkTelemetry {
|
|
19
|
+
private events;
|
|
20
|
+
private windowMs;
|
|
21
|
+
constructor(windowMs?: number);
|
|
22
|
+
push({ latency, size }: {
|
|
23
|
+
latency: number;
|
|
24
|
+
size: number;
|
|
25
|
+
}): void;
|
|
26
|
+
private clean;
|
|
27
|
+
get throughput(): number;
|
|
28
|
+
get latency(): number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Copyright 2025 The MOQtail Authors
|
|
33
|
+
*
|
|
34
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
* you may not use this file except in compliance with the License.
|
|
36
|
+
* You may obtain a copy of the License at
|
|
37
|
+
*
|
|
38
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
39
|
+
*
|
|
40
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
41
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
42
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
+
* See the License for the specific language governing permissions and
|
|
44
|
+
* limitations under the License.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
interface BufferedObject {
|
|
48
|
+
object: MoqtObject;
|
|
49
|
+
createdAt: number;
|
|
50
|
+
}
|
|
51
|
+
interface Clock {
|
|
52
|
+
now(): number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A playout buffer that manages timed delivery of MoQT objects.
|
|
56
|
+
*
|
|
57
|
+
* The buffer automatically extracts capture timestamps from extension headers
|
|
58
|
+
* to determine when objects should be played out, maintaining consistent latency
|
|
59
|
+
* and dropping old GOPs when necessary.
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const buffer = new PlayoutBuffer(objectStream, {
|
|
64
|
+
* targetLatencyMs: 500,
|
|
65
|
+
* maxLatencyMs: 2000,
|
|
66
|
+
* clock
|
|
67
|
+
* });
|
|
68
|
+
* buffer.onObject = (obj) => {
|
|
69
|
+
* if (obj) {
|
|
70
|
+
* // Process the object
|
|
71
|
+
* } else {
|
|
72
|
+
* // End of stream
|
|
73
|
+
* }
|
|
74
|
+
* };
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare class PlayoutBuffer {
|
|
78
|
+
#private;
|
|
79
|
+
readonly options?: {
|
|
80
|
+
targetLatencyMs: number;
|
|
81
|
+
maxLatencyMs: number;
|
|
82
|
+
clock: Clock;
|
|
83
|
+
} | undefined;
|
|
84
|
+
onObject: ((obj: MoqtObject | null) => void) | null;
|
|
85
|
+
constructor(objectStream: ReadableStream<MoqtObject>, options?: {
|
|
86
|
+
targetLatencyMs: number;
|
|
87
|
+
maxLatencyMs: number;
|
|
88
|
+
clock: Clock;
|
|
89
|
+
} | undefined);
|
|
90
|
+
hasObjectReady(): Promise<boolean>;
|
|
91
|
+
getStatus(): {
|
|
92
|
+
bufferSize: number;
|
|
93
|
+
isRunning: boolean;
|
|
94
|
+
oldestTimestamp?: number;
|
|
95
|
+
};
|
|
96
|
+
cleanup(): void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Copyright 2025 The MOQtail Authors
|
|
101
|
+
*
|
|
102
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
103
|
+
* you may not use this file except in compliance with the License.
|
|
104
|
+
* You may obtain a copy of the License at
|
|
105
|
+
*
|
|
106
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
107
|
+
*
|
|
108
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
109
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
110
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
111
|
+
* See the License for the specific language governing permissions and
|
|
112
|
+
* limitations under the License.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
declare class PullPlayoutBuffer {
|
|
116
|
+
#private;
|
|
117
|
+
readonly options: {
|
|
118
|
+
bucketCapacity?: number;
|
|
119
|
+
targetLatencyMs?: number;
|
|
120
|
+
maxLatencyMs?: number;
|
|
121
|
+
};
|
|
122
|
+
constructor(writeStream: ReadableStream<MoqtObject>, options: {
|
|
123
|
+
bucketCapacity?: number;
|
|
124
|
+
targetLatencyMs?: number;
|
|
125
|
+
maxLatencyMs?: number;
|
|
126
|
+
});
|
|
127
|
+
nextObject(callback: (obj: MoqtObject | null) => void): void;
|
|
128
|
+
hasObjectReady(): boolean;
|
|
129
|
+
getStatus(): {
|
|
130
|
+
bufferSize: number;
|
|
131
|
+
isRunning: boolean;
|
|
132
|
+
};
|
|
133
|
+
cleanup(): void;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Copyright 2025 The MOQtail Authors
|
|
138
|
+
*
|
|
139
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
140
|
+
* you may not use this file except in compliance with the License.
|
|
141
|
+
* You may obtain a copy of the License at
|
|
142
|
+
*
|
|
143
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
144
|
+
*
|
|
145
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
146
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
147
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
148
|
+
* See the License for the specific language governing permissions and
|
|
149
|
+
* limitations under the License.
|
|
150
|
+
*/
|
|
151
|
+
declare class ClockNormalizer {
|
|
152
|
+
private offset;
|
|
153
|
+
private timeServerUrl;
|
|
154
|
+
private numSamples;
|
|
155
|
+
private constructor();
|
|
156
|
+
static create(timeServerUrl?: string, numberOfSamples?: number): Promise<ClockNormalizer>;
|
|
157
|
+
getSkew(): number;
|
|
158
|
+
now(): number;
|
|
159
|
+
recalibrate(): Promise<number>;
|
|
160
|
+
private static calculateSkew;
|
|
161
|
+
private static takeSingleSample;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Copyright 2025 The MOQtail Authors
|
|
166
|
+
*
|
|
167
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
168
|
+
* you may not use this file except in compliance with the License.
|
|
169
|
+
* You may obtain a copy of the License at
|
|
170
|
+
*
|
|
171
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
172
|
+
*
|
|
173
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
174
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
175
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
176
|
+
* See the License for the specific language governing permissions and
|
|
177
|
+
* limitations under the License.
|
|
178
|
+
*/
|
|
179
|
+
/**
|
|
180
|
+
* @deprecated This class is deprecated and will be removed in a future version.
|
|
181
|
+
* Use ClockNormalizer (see ./clock_normalizer.ts) instead for better time synchronization.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link ClockNormalizer} - Modern replacement with better accuracy
|
|
184
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now} Performance.now() for basic timing
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* // ❌ Deprecated - Don't use
|
|
189
|
+
* const offset = await AkamaiOffset.getClockSkew()
|
|
190
|
+
*
|
|
191
|
+
* // ✅ Use ClockNormalizer instead
|
|
192
|
+
* import { ClockNormalizer } from './clock_normalizer'
|
|
193
|
+
* const normalizer = await ClockNormalizer.create()
|
|
194
|
+
* const offset = normalizer.getSkew()
|
|
195
|
+
* const normalizedTime = normalizer.now()
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
declare class AkamaiOffset {
|
|
199
|
+
private static _offset;
|
|
200
|
+
private static _promise;
|
|
201
|
+
static getClockSkew(): Promise<number>;
|
|
202
|
+
private static ClockSkew;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { AkamaiOffset, type BufferedObject, type Clock, ClockNormalizer, NetworkTelemetry, PlayoutBuffer, PullPlayoutBuffer };
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { n as MoqtObject } from '../byte_buffer-BOK6VPTF.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright 2025 The MOQtail Authors
|
|
5
|
+
*
|
|
6
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
* you may not use this file except in compliance with the License.
|
|
8
|
+
* You may obtain a copy of the License at
|
|
9
|
+
*
|
|
10
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
*
|
|
12
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
* See the License for the specific language governing permissions and
|
|
16
|
+
* limitations under the License.
|
|
17
|
+
*/
|
|
18
|
+
declare class NetworkTelemetry {
|
|
19
|
+
private events;
|
|
20
|
+
private windowMs;
|
|
21
|
+
constructor(windowMs?: number);
|
|
22
|
+
push({ latency, size }: {
|
|
23
|
+
latency: number;
|
|
24
|
+
size: number;
|
|
25
|
+
}): void;
|
|
26
|
+
private clean;
|
|
27
|
+
get throughput(): number;
|
|
28
|
+
get latency(): number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Copyright 2025 The MOQtail Authors
|
|
33
|
+
*
|
|
34
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
* you may not use this file except in compliance with the License.
|
|
36
|
+
* You may obtain a copy of the License at
|
|
37
|
+
*
|
|
38
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
39
|
+
*
|
|
40
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
41
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
42
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
+
* See the License for the specific language governing permissions and
|
|
44
|
+
* limitations under the License.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
interface BufferedObject {
|
|
48
|
+
object: MoqtObject;
|
|
49
|
+
createdAt: number;
|
|
50
|
+
}
|
|
51
|
+
interface Clock {
|
|
52
|
+
now(): number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A playout buffer that manages timed delivery of MoQT objects.
|
|
56
|
+
*
|
|
57
|
+
* The buffer automatically extracts capture timestamps from extension headers
|
|
58
|
+
* to determine when objects should be played out, maintaining consistent latency
|
|
59
|
+
* and dropping old GOPs when necessary.
|
|
60
|
+
*
|
|
61
|
+
* Usage:
|
|
62
|
+
* ```typescript
|
|
63
|
+
* const buffer = new PlayoutBuffer(objectStream, {
|
|
64
|
+
* targetLatencyMs: 500,
|
|
65
|
+
* maxLatencyMs: 2000,
|
|
66
|
+
* clock
|
|
67
|
+
* });
|
|
68
|
+
* buffer.onObject = (obj) => {
|
|
69
|
+
* if (obj) {
|
|
70
|
+
* // Process the object
|
|
71
|
+
* } else {
|
|
72
|
+
* // End of stream
|
|
73
|
+
* }
|
|
74
|
+
* };
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
declare class PlayoutBuffer {
|
|
78
|
+
#private;
|
|
79
|
+
readonly options?: {
|
|
80
|
+
targetLatencyMs: number;
|
|
81
|
+
maxLatencyMs: number;
|
|
82
|
+
clock: Clock;
|
|
83
|
+
} | undefined;
|
|
84
|
+
onObject: ((obj: MoqtObject | null) => void) | null;
|
|
85
|
+
constructor(objectStream: ReadableStream<MoqtObject>, options?: {
|
|
86
|
+
targetLatencyMs: number;
|
|
87
|
+
maxLatencyMs: number;
|
|
88
|
+
clock: Clock;
|
|
89
|
+
} | undefined);
|
|
90
|
+
hasObjectReady(): Promise<boolean>;
|
|
91
|
+
getStatus(): {
|
|
92
|
+
bufferSize: number;
|
|
93
|
+
isRunning: boolean;
|
|
94
|
+
oldestTimestamp?: number;
|
|
95
|
+
};
|
|
96
|
+
cleanup(): void;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Copyright 2025 The MOQtail Authors
|
|
101
|
+
*
|
|
102
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
103
|
+
* you may not use this file except in compliance with the License.
|
|
104
|
+
* You may obtain a copy of the License at
|
|
105
|
+
*
|
|
106
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
107
|
+
*
|
|
108
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
109
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
110
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
111
|
+
* See the License for the specific language governing permissions and
|
|
112
|
+
* limitations under the License.
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
declare class PullPlayoutBuffer {
|
|
116
|
+
#private;
|
|
117
|
+
readonly options: {
|
|
118
|
+
bucketCapacity?: number;
|
|
119
|
+
targetLatencyMs?: number;
|
|
120
|
+
maxLatencyMs?: number;
|
|
121
|
+
};
|
|
122
|
+
constructor(writeStream: ReadableStream<MoqtObject>, options: {
|
|
123
|
+
bucketCapacity?: number;
|
|
124
|
+
targetLatencyMs?: number;
|
|
125
|
+
maxLatencyMs?: number;
|
|
126
|
+
});
|
|
127
|
+
nextObject(callback: (obj: MoqtObject | null) => void): void;
|
|
128
|
+
hasObjectReady(): boolean;
|
|
129
|
+
getStatus(): {
|
|
130
|
+
bufferSize: number;
|
|
131
|
+
isRunning: boolean;
|
|
132
|
+
};
|
|
133
|
+
cleanup(): void;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Copyright 2025 The MOQtail Authors
|
|
138
|
+
*
|
|
139
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
140
|
+
* you may not use this file except in compliance with the License.
|
|
141
|
+
* You may obtain a copy of the License at
|
|
142
|
+
*
|
|
143
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
144
|
+
*
|
|
145
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
146
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
147
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
148
|
+
* See the License for the specific language governing permissions and
|
|
149
|
+
* limitations under the License.
|
|
150
|
+
*/
|
|
151
|
+
declare class ClockNormalizer {
|
|
152
|
+
private offset;
|
|
153
|
+
private timeServerUrl;
|
|
154
|
+
private numSamples;
|
|
155
|
+
private constructor();
|
|
156
|
+
static create(timeServerUrl?: string, numberOfSamples?: number): Promise<ClockNormalizer>;
|
|
157
|
+
getSkew(): number;
|
|
158
|
+
now(): number;
|
|
159
|
+
recalibrate(): Promise<number>;
|
|
160
|
+
private static calculateSkew;
|
|
161
|
+
private static takeSingleSample;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Copyright 2025 The MOQtail Authors
|
|
166
|
+
*
|
|
167
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
168
|
+
* you may not use this file except in compliance with the License.
|
|
169
|
+
* You may obtain a copy of the License at
|
|
170
|
+
*
|
|
171
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
172
|
+
*
|
|
173
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
174
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
175
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
176
|
+
* See the License for the specific language governing permissions and
|
|
177
|
+
* limitations under the License.
|
|
178
|
+
*/
|
|
179
|
+
/**
|
|
180
|
+
* @deprecated This class is deprecated and will be removed in a future version.
|
|
181
|
+
* Use ClockNormalizer (see ./clock_normalizer.ts) instead for better time synchronization.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link ClockNormalizer} - Modern replacement with better accuracy
|
|
184
|
+
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Performance/now} Performance.now() for basic timing
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* // ❌ Deprecated - Don't use
|
|
189
|
+
* const offset = await AkamaiOffset.getClockSkew()
|
|
190
|
+
*
|
|
191
|
+
* // ✅ Use ClockNormalizer instead
|
|
192
|
+
* import { ClockNormalizer } from './clock_normalizer'
|
|
193
|
+
* const normalizer = await ClockNormalizer.create()
|
|
194
|
+
* const offset = normalizer.getSkew()
|
|
195
|
+
* const normalizedTime = normalizer.now()
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
declare class AkamaiOffset {
|
|
199
|
+
private static _offset;
|
|
200
|
+
private static _promise;
|
|
201
|
+
static getClockSkew(): Promise<number>;
|
|
202
|
+
private static ClockSkew;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { AkamaiOffset, type BufferedObject, type Clock, ClockNormalizer, NetworkTelemetry, PlayoutBuffer, PullPlayoutBuffer };
|