@rivmux/protocol 0.4.0 → 1.0.0-rc.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/README.md CHANGED
@@ -1,3 +1,14 @@
1
1
  # Rivmux Protocol
2
2
 
3
- Protocol TypeScript contracts used by Rivmux browser packages.
3
+ `@rivmux/protocol` 提供 Rivmux 浏览器包共享的 TypeScript 类型与 Worker 消息契约。
4
+
5
+ 该包面向内部包边界维护,不是普通用户的播放器入口。`rivmux` 会重新导出用户需要的选项、事件、错误、媒体信息和能力矩阵类型;应用代码应优先依赖 `rivmux`。
6
+
7
+ 关键导出包括:
8
+
9
+ - `RivmuxPlayerOptions` 及各分组配置类型。
10
+ - `PlayerEventMap`、`PlayerError`、`PlayerWarning` 和重连信息类型;播放器初始化事件为 `initialized`。
11
+ - `RivmuxCapabilities`、`RuntimeCapabilities`、`DecodingCapabilities` 与 `SupportStatus`。
12
+ - 主线程与 Dedicated Worker 之间使用的生命周期、媒体和诊断消息契约。Worker 选项在 `init` 命令中一次性传入;当前不提供动态选项更新命令。
13
+
14
+ 协议变更必须同步更新播放器、Worker 和对应测试;公开类型当前采用手动维护方式。
@@ -0,0 +1,29 @@
1
+ export type SupportStatus = 'supported' | 'unsupported' | 'unknown';
2
+ export interface RuntimeCapabilities {
3
+ dedicatedWorker: boolean;
4
+ workerMse: boolean;
5
+ fetchStreaming: boolean;
6
+ readableStream: boolean;
7
+ webAssembly: boolean;
8
+ }
9
+ export interface DecodingCapabilities {
10
+ video: {
11
+ avc: SupportStatus;
12
+ hevc: SupportStatus;
13
+ av1: SupportStatus;
14
+ };
15
+ audio: {
16
+ aac: SupportStatus;
17
+ opus: SupportStatus;
18
+ };
19
+ stableProfiles: {
20
+ avcAac: SupportStatus;
21
+ hevcAac: SupportStatus;
22
+ };
23
+ }
24
+ export interface RivmuxCapabilities {
25
+ supported: boolean;
26
+ runtime: RuntimeCapabilities;
27
+ decoding: DecodingCapabilities;
28
+ }
29
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,WAAW,GAAG,aAAa,GAAG,SAAS,CAAA;AAEnE,MAAM,WAAW,mBAAmB;IAClC,eAAe,EAAE,OAAO,CAAA;IACxB,SAAS,EAAE,OAAO,CAAA;IAClB,cAAc,EAAE,OAAO,CAAA;IACvB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE;QACL,GAAG,EAAE,aAAa,CAAA;QAClB,IAAI,EAAE,aAAa,CAAA;QACnB,GAAG,EAAE,aAAa,CAAA;KACnB,CAAA;IACD,KAAK,EAAE;QACL,GAAG,EAAE,aAAa,CAAA;QAClB,IAAI,EAAE,aAAa,CAAA;KACpB,CAAA;IACD,cAAc,EAAE;QACd,MAAM,EAAE,aAAa,CAAA;QACrB,OAAO,EAAE,aAAa,CAAA;KACvB,CAAA;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,OAAO,CAAA;IAClB,OAAO,EAAE,mBAAmB,CAAA;IAC5B,QAAQ,EAAE,oBAAoB,CAAA;CAC/B"}
@@ -0,0 +1,45 @@
1
+ /** Runtime diagnostics emitted by the `stats` event. */
2
+ export type PlayerStats = {
3
+ bytesReceived?: number;
4
+ currentNetworkSpeed?: number;
5
+ networkIdleMs?: number;
6
+ outputBytes?: number;
7
+ appendQueueLength?: number;
8
+ appendQueueBytes?: number;
9
+ appendQueueMaxLength?: number;
10
+ appendQueueMaxBytes?: number;
11
+ loaderPaused?: boolean;
12
+ sourceBufferUpdating?: boolean;
13
+ sourceBufferCount?: number;
14
+ bufferedStart?: number;
15
+ bufferedEnd?: number;
16
+ bufferedDuration?: number;
17
+ bufferedRangeCount?: number;
18
+ currentTime?: number;
19
+ liveLatency?: number;
20
+ playbackRate?: number;
21
+ readyState?: number;
22
+ droppedFrames?: number;
23
+ };
24
+ /** High-level category for a player error. */
25
+ export type PlayerErrorKind = 'network' | 'unsupported' | 'demux' | 'codec' | 'mux' | 'mse' | 'runtime';
26
+ /** Serializable error details carried across the Worker boundary. */
27
+ export type PlayerErrorCause = {
28
+ name: string;
29
+ message: string;
30
+ };
31
+ /** Structured error emitted by the player and runtime. */
32
+ export type PlayerError = {
33
+ kind: PlayerErrorKind;
34
+ code: string;
35
+ message: string;
36
+ terminal: boolean;
37
+ cause?: PlayerErrorCause;
38
+ };
39
+ /** Structured recoverable warning emitted by the player and runtime. */
40
+ export type PlayerWarning = {
41
+ code: string;
42
+ message: string;
43
+ cause?: PlayerErrorCause;
44
+ };
45
+ //# sourceMappingURL=diagnostics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,wDAAwD;AACxD,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,8CAA8C;AAC9C,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,aAAa,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAA;AAEvG,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,0DAA0D;AAC1D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,eAAe,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,gBAAgB,CAAA;CACzB,CAAA;AAED,wEAAwE;AACxE,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,gBAAgB,CAAA;CACzB,CAAA"}
@@ -0,0 +1,39 @@
1
+ import type { MediaInfo } from './media';
2
+ import type { PlayerError, PlayerStats, PlayerWarning } from './diagnostics';
3
+ /** Network failure category that caused a live stream reconnect. */
4
+ export type ReconnectReason = 'http-status' | 'network-error' | 'read-error' | 'read-timeout' | 'unexpected-eof';
5
+ /** Details emitted after the runtime schedules another connection attempt. */
6
+ export type ReconnectInfo = {
7
+ /** One-based connection attempt number within the current recovery cycle. */
8
+ attempt: number;
9
+ /** Maximum connection attempts in the current recovery cycle, including the failed connection. */
10
+ maxAttempts: number;
11
+ /** Delay before the next connection attempt starts. */
12
+ delayMs: number;
13
+ /** Failure category that caused this recovery cycle. */
14
+ reason: ReconnectReason;
15
+ };
16
+ /** Details emitted after a reconnected session appends its first media segment. */
17
+ export type RecoveryInfo = {
18
+ /** Connection attempt that successfully recovered playback. */
19
+ attempt: number;
20
+ /** Elapsed time between the recoverable failure and recovery. */
21
+ downtimeMs: number;
22
+ };
23
+ /** Payload map for player events. */
24
+ export type PlayerEventMap = {
25
+ initialized: undefined;
26
+ mediaInfo: MediaInfo;
27
+ stats: PlayerStats;
28
+ warning: PlayerWarning;
29
+ error: PlayerError;
30
+ reconnecting: ReconnectInfo;
31
+ recovered: RecoveryInfo;
32
+ stopped: undefined;
33
+ destroyed: undefined;
34
+ };
35
+ /** Player event name. */
36
+ export type PlayerEventType = keyof PlayerEventMap;
37
+ /** Typed player event listener. */
38
+ export type PlayerEventListener<T extends PlayerEventType> = (payload: PlayerEventMap[T]) => void;
39
+ //# sourceMappingURL=events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAE5E,oEAAoE;AACpE,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,eAAe,GAAG,YAAY,GAAG,cAAc,GAAG,gBAAgB,CAAA;AAEhH,8EAA8E;AAC9E,MAAM,MAAM,aAAa,GAAG;IAC1B,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAA;IACf,kGAAkG;IAClG,WAAW,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,OAAO,EAAE,MAAM,CAAA;IACf,wDAAwD;IACxD,MAAM,EAAE,eAAe,CAAA;CACxB,CAAA;AAED,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG;IACzB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAA;IACf,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG;IAC3B,WAAW,EAAE,SAAS,CAAA;IACtB,SAAS,EAAE,SAAS,CAAA;IACpB,KAAK,EAAE,WAAW,CAAA;IAClB,OAAO,EAAE,aAAa,CAAA;IACtB,KAAK,EAAE,WAAW,CAAA;IAClB,YAAY,EAAE,aAAa,CAAA;IAC3B,SAAS,EAAE,YAAY,CAAA;IACvB,OAAO,EAAE,SAAS,CAAA;IAClB,SAAS,EAAE,SAAS,CAAA;CACrB,CAAA;AAED,yBAAyB;AACzB,MAAM,MAAM,eAAe,GAAG,MAAM,cAAc,CAAA;AAElD,mCAAmC;AACnC,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,eAAe,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,267 +1,7 @@
1
- /** Playback behavior applied to the attached video element. */
2
- export type PlaybackOptions = {
3
- /** Request playback automatically after the startup buffer is ready. */
4
- autoPlay?: boolean;
5
- /** Sets `HTMLVideoElement.muted` before playback starts. */
6
- muted?: boolean;
7
- };
8
- /** Low-latency live playback policy, expressed in seconds. */
9
- export type LatencyOptions = {
10
- /** Minimum buffered duration required before automatic playback starts. */
11
- startupBuffer?: number;
12
- /** Desired live latency behind the live edge. */
13
- target?: number;
14
- /** Maximum live latency before the runtime seeks closer to the live edge. */
15
- max?: number;
16
- /** Forward buffer threshold where the stream loader may pause. */
17
- maxForwardBuffer?: number;
18
- /** Buffered duration to keep behind the current playhead during cleanup. */
19
- backwardBuffer?: number;
20
- };
21
- /** HTTP request settings for stream loading. */
22
- export type NetworkOptions = {
23
- /** Additional request headers sent with stream fetch requests. */
24
- headers?: Record<string, string>;
25
- /** Fetch credentials mode used for stream requests. */
26
- credentials?: RequestCredentials;
27
- /** Retry policy for recoverable stream request failures. */
28
- retry?: {
29
- /** Maximum number of attempts for a stream request. */
30
- maxAttempts?: number;
31
- /** Base retry delay in milliseconds. */
32
- backoffMs?: number;
33
- };
34
- };
35
- /** Advanced runtime asset deployment options. */
36
- export type RuntimeOptions = {
37
- /** Must remain true while M1 supports only worker-backed Media Source Extensions. */
38
- preferWorkerMse?: boolean;
39
- /** Overrides the packaged Dedicated Worker script URL. */
40
- workerUrl?: string;
41
- /** Overrides the WASM binary URL used by the packaged wasm-bindgen runtime. */
42
- wasmUrl?: string;
43
- };
44
- /** Diagnostics and debug reporting options. */
45
- export type DiagnosticsOptions = {
46
- /** Requested runtime stats interval in milliseconds. */
47
- statsIntervalMs?: number;
48
- /** Enables debug-oriented behavior where supported by the runtime. */
49
- debug?: boolean;
50
- };
51
- /** Top-level options accepted by `new RivmuxPlayer(url, options)`. */
52
- export type RivmuxPlayerOptions = {
53
- playback?: PlaybackOptions;
54
- latency?: LatencyOptions;
55
- network?: NetworkOptions;
56
- runtime?: RuntimeOptions;
57
- diagnostics?: DiagnosticsOptions;
58
- };
59
- export type NormalizedPlaybackOptions = Required<PlaybackOptions>;
60
- export type NormalizedLatencyOptions = Required<LatencyOptions>;
61
- export type NormalizedNetworkOptions = {
62
- headers: Record<string, string>;
63
- credentials: RequestCredentials;
64
- retry: {
65
- maxAttempts: number;
66
- backoffMs: number;
67
- };
68
- };
69
- export type NormalizedRuntimeOptions = {
70
- preferWorkerMse: boolean;
71
- workerUrl?: string;
72
- wasmUrl?: string;
73
- };
74
- export type NormalizedDiagnosticsOptions = Required<DiagnosticsOptions>;
75
- /** Fully populated player options after defaults are applied. */
76
- export type NormalizedRivmuxPlayerOptions = {
77
- playback: NormalizedPlaybackOptions;
78
- latency: NormalizedLatencyOptions;
79
- network: NormalizedNetworkOptions;
80
- runtime: NormalizedRuntimeOptions;
81
- diagnostics: NormalizedDiagnosticsOptions;
82
- };
83
- /** Container, codec, and track metadata detected from the stream. */
84
- export type MediaInfo = {
85
- /** Detected media container, such as `flv` or `fmp4`. */
86
- container: string;
87
- /** Video codec string when the stream contains video. */
88
- videoCodec?: string;
89
- /** Audio codec string when the stream contains audio. */
90
- audioCodec?: string;
91
- /** Video width in pixels. */
92
- width?: number;
93
- /** Video height in pixels. */
94
- height?: number;
95
- /** Audio sample rate in Hz. */
96
- audioSampleRate?: number;
97
- /** Number of audio channels. */
98
- audioChannelCount?: number;
99
- };
100
- /** Runtime diagnostics emitted by the `stats` event. */
101
- export type PlayerStats = {
102
- /** Number of source bytes received from the stream loader. */
103
- bytesReceived?: number;
104
- /** Current estimated network speed in bytes per second. */
105
- currentNetworkSpeed?: number;
106
- /** Duration since the last network chunk, in milliseconds. */
107
- networkIdleMs?: number;
108
- /** Number of transmuxed bytes emitted to MSE. */
109
- outputBytes?: number;
110
- /** Number of media segments waiting to be appended. */
111
- appendQueueLength?: number;
112
- /** Total bytes waiting in the append queue. */
113
- appendQueueBytes?: number;
114
- /** Maximum append queue length observed in the current session. */
115
- appendQueueMaxLength?: number;
116
- /** Maximum append queue bytes observed in the current session. */
117
- appendQueueMaxBytes?: number;
118
- /** Whether the loader is paused by latency/buffer policy. */
119
- loaderPaused?: boolean;
120
- /** Whether any SourceBuffer is currently updating. */
121
- sourceBufferUpdating?: boolean;
122
- /** Number of active SourceBuffer instances. */
123
- sourceBufferCount?: number;
124
- /** Start time of the buffered range used for latency calculations. */
125
- bufferedStart?: number;
126
- /** End time of the buffered range used for latency calculations. */
127
- bufferedEnd?: number;
128
- /** Buffered duration ahead of the current playhead. */
129
- bufferedDuration?: number;
130
- /** Number of buffered ranges on the attached video element. */
131
- bufferedRangeCount?: number;
132
- /** Current video playhead time. */
133
- currentTime?: number;
134
- /** Estimated live latency in seconds. */
135
- liveLatency?: number;
136
- /** Current video playback rate. */
137
- playbackRate?: number;
138
- /** Current `HTMLMediaElement.readyState`. */
139
- readyState?: number;
140
- /** Dropped video frame count when the browser exposes it. */
141
- droppedFrames?: number;
142
- };
143
- /** Snapshot of the attached video element sent from the player to the worker. */
144
- export type VideoElementState = {
145
- currentTime: number;
146
- readyState: number;
147
- playbackRate: number;
148
- paused: boolean;
149
- droppedFrames?: number;
150
- };
151
- /** Playback operation requested by the worker-side latency controller. */
152
- export type PlaybackControlAction = {
153
- type: 'play';
154
- reason: 'startup-buffer-ready';
155
- } | {
156
- type: 'set-playback-rate';
157
- playbackRate: number;
158
- reason: 'latency-above-target' | 'latency-near-target';
159
- } | {
160
- type: 'seek';
161
- targetTime: number;
162
- reason: 'latency-max-exceeded';
163
- };
164
- /** Result of applying a worker-requested playback operation. */
165
- export type PlaybackControlResult = {
166
- type: PlaybackControlAction['type'];
167
- accepted: boolean;
168
- message?: string;
169
- };
170
- /** High-level category for a player error. */
171
- export type PlayerErrorKind = 'network' | 'unsupported' | 'demux' | 'codec' | 'mux' | 'mse' | 'runtime';
172
- /** Structured error emitted by the player and runtime. */
173
- export type PlayerError = {
174
- /** Broad error category. */
175
- kind: PlayerErrorKind;
176
- /** Stable machine-readable error code. */
177
- code: string;
178
- /** Human-readable error message. */
179
- message: string;
180
- /** Whether playback should be treated as unrecoverable. */
181
- terminal: boolean;
182
- /** Optional underlying error or diagnostic payload. */
183
- cause?: unknown;
184
- };
185
- /** Structured recoverable warning emitted by the player and runtime. */
186
- export type PlayerWarning = {
187
- /** Stable machine-readable warning code. */
188
- code: string;
189
- /** Human-readable warning message. */
190
- message: string;
191
- /** Optional underlying warning payload. */
192
- cause?: unknown;
193
- };
194
- /** Payload map for player events. */
195
- export type PlayerEventMap = {
196
- /** Worker/runtime initialization completed. */
197
- ready: undefined;
198
- /** Stream metadata was detected. */
199
- mediaInfo: MediaInfo;
200
- /** Runtime diagnostics were sampled. */
201
- stats: PlayerStats;
202
- /** A recoverable runtime warning occurred. */
203
- warning: PlayerWarning;
204
- /** A structured runtime error occurred. */
205
- error: PlayerError;
206
- /** The stream stopped and the media source was detached. */
207
- stopped: undefined;
208
- /** The worker/runtime was destroyed. */
209
- destroyed: undefined;
210
- };
211
- /** Player event name. */
212
- export type PlayerEventType = keyof PlayerEventMap;
213
- /** Typed player event listener. */
214
- export type PlayerEventListener<T extends PlayerEventType> = (payload: PlayerEventMap[T]) => void;
215
- /** Command sent from the player facade to the runtime worker. */
216
- export type WorkerCommand = {
217
- type: 'init';
218
- id: string;
219
- url: string;
220
- options: NormalizedRivmuxPlayerOptions;
221
- } | {
222
- type: 'attach-media-source';
223
- } | {
224
- type: 'start';
225
- } | {
226
- type: 'stop';
227
- } | {
228
- type: 'update-options';
229
- options: Partial<NormalizedRivmuxPlayerOptions>;
230
- } | {
231
- type: 'video-state';
232
- state: VideoElementState;
233
- } | {
234
- type: 'playback-control-result';
235
- result: PlaybackControlResult;
236
- } | {
237
- type: 'destroy';
238
- };
239
- /** Message sent from the runtime worker to the player facade. */
240
- export type WorkerMessage = {
241
- type: 'worker-ready';
242
- } | {
243
- type: 'ready';
244
- } | {
245
- type: 'media-source-handle';
246
- handle: MediaSourceHandle;
247
- } | {
248
- type: 'media-info';
249
- mediaInfo: MediaInfo;
250
- } | {
251
- type: 'stats';
252
- stats: PlayerStats;
253
- } | {
254
- type: 'warning';
255
- warning: PlayerWarning;
256
- } | {
257
- type: 'error';
258
- error: PlayerError;
259
- } | {
260
- type: 'playback-control';
261
- action: PlaybackControlAction;
262
- } | {
263
- type: 'stopped';
264
- } | {
265
- type: 'destroyed';
266
- };
1
+ export type * from './capabilities';
2
+ export type * from './diagnostics';
3
+ export type * from './events';
4
+ export type * from './media';
5
+ export type * from './options';
6
+ export type * from './worker';
267
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM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O,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,gBAAgB,CAAA;AACnC,mBAAmB,eAAe,CAAA;AAClC,mBAAmB,UAAU,CAAA;AAC7B,mBAAmB,SAAS,CAAA;AAC5B,mBAAmB,WAAW,CAAA;AAC9B,mBAAmB,UAAU,CAAA"}
@@ -0,0 +1,53 @@
1
+ /** Container, codec, and track metadata detected from the stream. */
2
+ export type MediaInfo = {
3
+ /** Detected media container, such as `flv` or `fmp4`. */
4
+ container: string;
5
+ /** Video codec string when the stream contains video. */
6
+ videoCodec?: string;
7
+ /** Audio codec string when the stream contains audio. */
8
+ audioCodec?: string;
9
+ /** Video width in pixels. */
10
+ width?: number;
11
+ /** Video height in pixels. */
12
+ height?: number;
13
+ /** Audio sample rate in Hz. */
14
+ audioSampleRate?: number;
15
+ /** Number of audio channels. */
16
+ audioChannelCount?: number;
17
+ };
18
+ /** Snapshot of the attached video element sent from the player to the worker. */
19
+ export type VideoElementState = {
20
+ currentTime: number;
21
+ readyState: number;
22
+ playbackRate: number;
23
+ paused: boolean;
24
+ droppedFrames?: number;
25
+ };
26
+ /** Playback operation requested by the worker-side latency controller. */
27
+ export type PlaybackControlAction = {
28
+ type: 'play';
29
+ reason: 'startup-buffer-ready';
30
+ } | {
31
+ type: 'set-playback-rate';
32
+ playbackRate: number;
33
+ reason: 'latency-above-target' | 'latency-near-target';
34
+ } | {
35
+ type: 'seek';
36
+ targetTime: number;
37
+ reason: 'latency-max-exceeded';
38
+ };
39
+ /** Structured, clone-safe failure returned for a playback operation. */
40
+ export type PlaybackControlError = {
41
+ name: string;
42
+ message: string;
43
+ };
44
+ /** Result of applying a worker-requested playback operation. */
45
+ export type PlaybackControlResult = {
46
+ type: PlaybackControlAction['type'];
47
+ accepted: true;
48
+ } | {
49
+ type: PlaybackControlAction['type'];
50
+ accepted: false;
51
+ error: PlaybackControlError;
52
+ };
53
+ //# sourceMappingURL=media.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"media.d.ts","sourceRoot":"","sources":["../src/media.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,MAAM,SAAS,GAAG;IACtB,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,+BAA+B;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gCAAgC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,iFAAiF;AACjF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,0EAA0E;AAC1E,MAAM,MAAM,qBAAqB,GAC7B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,GAChD;IAAE,IAAI,EAAE,mBAAmB,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,sBAAsB,GAAG,qBAAqB,CAAA;CAAE,GAC3G;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAExE,wEAAwE;AACxE,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAC7B;IACE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IACnC,QAAQ,EAAE,IAAI,CAAA;CACf,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAA;IACnC,QAAQ,EAAE,KAAK,CAAA;IACf,KAAK,EAAE,oBAAoB,CAAA;CAC5B,CAAA"}
@@ -0,0 +1,89 @@
1
+ /** Playback behavior applied to the attached video element. */
2
+ export type PlaybackOptions = {
3
+ /** Request playback automatically after the startup buffer is ready. */
4
+ autoPlay?: boolean;
5
+ /** Sets `HTMLVideoElement.muted` before playback starts. */
6
+ muted?: boolean;
7
+ };
8
+ /** Low-latency live playback policy, expressed in seconds. */
9
+ export type LatencyOptions = {
10
+ /** Minimum buffered duration required before automatic playback starts. */
11
+ startupBuffer?: number;
12
+ /** Desired live latency behind the live edge. */
13
+ target?: number;
14
+ /** Maximum live latency before the runtime seeks closer to the live edge. */
15
+ max?: number;
16
+ /** Forward buffer threshold where the stream loader may pause. */
17
+ maxForwardBuffer?: number;
18
+ /** Buffered duration to keep behind the current playhead during cleanup. */
19
+ backwardBuffer?: number;
20
+ };
21
+ /** HTTP request settings for stream loading. */
22
+ export type NetworkOptions = {
23
+ /** Additional request headers sent with stream fetch requests. */
24
+ headers?: Record<string, string>;
25
+ /** Fetch credentials mode used for stream requests. */
26
+ credentials?: RequestCredentials;
27
+ /** Maximum time without a stream chunk while reads are active, in milliseconds. */
28
+ readIdleTimeoutMs?: number;
29
+ /** Retry policy for recoverable stream request failures. */
30
+ retry?: {
31
+ /** Maximum connection attempts per recovery cycle, including the current connection. */
32
+ maxAttempts?: number;
33
+ /** Base exponential retry delay in milliseconds. */
34
+ backoffMs?: number;
35
+ /** Maximum retry delay after jitter is applied, in milliseconds. */
36
+ maxBackoffMs?: number;
37
+ /** Symmetric jitter ratio in the inclusive range from 0 to 1. */
38
+ jitterRatio?: number;
39
+ };
40
+ };
41
+ /** Advanced runtime asset deployment options. */
42
+ export type RuntimeOptions = {
43
+ /** Overrides the packaged Dedicated Worker script URL. */
44
+ workerUrl?: string;
45
+ /** Overrides the WASM binary URL used by the packaged wasm-bindgen runtime. */
46
+ wasmUrl?: string;
47
+ };
48
+ /** Runtime diagnostics reporting options. */
49
+ export type DiagnosticsOptions = {
50
+ /** Requested runtime stats interval in milliseconds. */
51
+ statsIntervalMs?: number;
52
+ };
53
+ /** Top-level options accepted by `new RivmuxPlayer(url, options)`. */
54
+ export type RivmuxPlayerOptions = {
55
+ playback?: PlaybackOptions;
56
+ latency?: LatencyOptions;
57
+ network?: NetworkOptions;
58
+ runtime?: RuntimeOptions;
59
+ diagnostics?: DiagnosticsOptions;
60
+ };
61
+ export type NormalizedPlaybackOptions = Required<PlaybackOptions>;
62
+ export type NormalizedLatencyOptions = Required<LatencyOptions>;
63
+ export type NormalizedNetworkOptions = {
64
+ headers: Record<string, string>;
65
+ credentials: RequestCredentials;
66
+ readIdleTimeoutMs: number;
67
+ retry: {
68
+ maxAttempts: number;
69
+ backoffMs: number;
70
+ maxBackoffMs: number;
71
+ jitterRatio: number;
72
+ };
73
+ };
74
+ export type NormalizedRuntimeOptions = {
75
+ workerUrl?: string;
76
+ wasmUrl?: string;
77
+ };
78
+ export type NormalizedDiagnosticsOptions = {
79
+ statsIntervalMs: number;
80
+ };
81
+ /** Fully populated player options after defaults are applied. */
82
+ export type NormalizedRivmuxPlayerOptions = {
83
+ playback: NormalizedPlaybackOptions;
84
+ latency: NormalizedLatencyOptions;
85
+ network: NormalizedNetworkOptions;
86
+ runtime: NormalizedRuntimeOptions;
87
+ diagnostics: NormalizedDiagnosticsOptions;
88
+ };
89
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../src/options.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,MAAM,MAAM,eAAe,GAAG;IAC5B,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB,CAAA;AAED,8DAA8D;AAC9D,MAAM,MAAM,cAAc,GAAG;IAC3B,2EAA2E;IAC3E,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,6EAA6E;IAC7E,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,kEAAkE;IAClE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,4EAA4E;IAC5E,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,gDAAgD;AAChD,MAAM,MAAM,cAAc,GAAG;IAC3B,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,uDAAuD;IACvD,WAAW,CAAC,EAAE,kBAAkB,CAAA;IAChC,mFAAmF;IACnF,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,4DAA4D;IAC5D,KAAK,CAAC,EAAE;QACN,wFAAwF;QACxF,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,oDAA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B,CAAA;AAED,MAAM,MAAM,4BAA4B,GAAG;IACzC,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED,iEAAiE;AACjE,MAAM,MAAM,6BAA6B,GAAG;IAC1C,QAAQ,EAAE,yBAAyB,CAAA;IACnC,OAAO,EAAE,wBAAwB,CAAA;IACjC,OAAO,EAAE,wBAAwB,CAAA;IACjC,OAAO,EAAE,wBAAwB,CAAA;IACjC,WAAW,EAAE,4BAA4B,CAAA;CAC1C,CAAA"}
@@ -0,0 +1,62 @@
1
+ import type { PlayerError, PlayerStats, PlayerWarning } from './diagnostics';
2
+ import type { ReconnectInfo, RecoveryInfo } from './events';
3
+ import type { MediaInfo, PlaybackControlAction, PlaybackControlResult, VideoElementState } from './media';
4
+ import type { NormalizedRivmuxPlayerOptions } from './options';
5
+ /** Command sent from the player facade to the runtime worker. */
6
+ export type WorkerCommand = {
7
+ type: 'init';
8
+ id: string;
9
+ url: string;
10
+ options: NormalizedRivmuxPlayerOptions;
11
+ } | {
12
+ type: 'attach-media-source';
13
+ } | {
14
+ type: 'start';
15
+ } | {
16
+ type: 'stop';
17
+ } | {
18
+ type: 'video-state';
19
+ state: VideoElementState;
20
+ } | {
21
+ type: 'playback-control-result';
22
+ result: PlaybackControlResult;
23
+ } | {
24
+ type: 'destroy';
25
+ };
26
+ /** Message sent from the runtime worker to the player facade. */
27
+ export type WorkerMessage = {
28
+ type: 'worker-ready';
29
+ } | {
30
+ type: 'ready';
31
+ } | {
32
+ type: 'media-source-handle';
33
+ handle: MediaSourceHandle;
34
+ } | {
35
+ type: 'started';
36
+ } | {
37
+ type: 'media-info';
38
+ mediaInfo: MediaInfo;
39
+ } | {
40
+ type: 'stats';
41
+ stats: PlayerStats;
42
+ } | {
43
+ type: 'warning';
44
+ warning: PlayerWarning;
45
+ } | {
46
+ type: 'error';
47
+ error: PlayerError;
48
+ } | {
49
+ type: 'reconnecting';
50
+ info: ReconnectInfo;
51
+ } | {
52
+ type: 'recovered';
53
+ info: RecoveryInfo;
54
+ } | {
55
+ type: 'playback-control';
56
+ action: PlaybackControlAction;
57
+ } | {
58
+ type: 'stopped';
59
+ } | {
60
+ type: 'destroyed';
61
+ };
62
+ //# sourceMappingURL=worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"worker.d.ts","sourceRoot":"","sources":["../src/worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACzG,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAA;AAE9D,iEAAiE;AACjE,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,6BAA6B,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,qBAAqB,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,GACjD;IAAE,IAAI,EAAE,yBAAyB,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,GAClE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAA;AAEvB,iEAAiE;AACjE,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,cAAc,CAAA;CAAE,GACxB;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,GACjB;IAAE,IAAI,EAAE,qBAAqB,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAA;CAAE,GAC1D;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,GAC5C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC3C;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,WAAW,CAAA;CAAE,GACrC;IAAE,IAAI,EAAE,cAAc,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GACzC;IAAE,IAAI,EAAE,kBAAkB,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAA;CAAE,GAC3D;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivmux/protocol",
3
- "version": "0.4.0",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "Protocol TypeScript contracts for Rivmux packages.",
5
5
  "homepage": "https://www.npmjs.com/package/@rivmux/protocol",
6
6
  "bugs": {
@@ -28,11 +28,7 @@
28
28
  "types": "./dist/index.d.ts",
29
29
  "devDependencies": {
30
30
  "typescript": "~6.0.3",
31
- "vitest": "^4.1.10"
32
- },
33
- "engines": {
34
- "node": "^22.18.0 || >=24.11.0",
35
- "pnpm": ">=10.0.0"
31
+ "vitest": "^4.1.11"
36
32
  },
37
33
  "scripts": {
38
34
  "build": "tsc -b",