@caprid/moq-media 0.4.1 → 0.5.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 +11 -8
- package/dist/video-player.d.ts +25 -24
- package/dist/video-player.d.ts.map +1 -1
- package/dist/video-player.js +7 -7
- package/dist/video-player.js.map +1 -1
- package/dist/webcodecs.d.ts +2 -2
- package/dist/webcodecs.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,6 +4,12 @@
|
|
|
4
4
|
(`draft-ietf-moq-msf-01`) catalogs, plus the clocks, frame sequencer, and audio and video players that sit on top of them. It
|
|
5
5
|
depends only on `@caprid/moq-core`. It needs no encoder, transport library, or Relay connection.
|
|
6
6
|
|
|
7
|
+
```sh
|
|
8
|
+
npm install @caprid/moq-media
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
The frame writer, frame reader, and catalog service that send and receive these formats are in `@caprid/relay/media`.
|
|
12
|
+
|
|
7
13
|
```ts
|
|
8
14
|
import { buildMsfCatalog, composeMoqSource, locProperties, locTrackProperties, parseMsfCatalog } from '@caprid/moq-media';
|
|
9
15
|
|
|
@@ -157,9 +163,6 @@ out of order across group streams, and the sequencer drops what is too late agai
|
|
|
157
163
|
`catchUpAfterUs` tune audio delivery for a listener or for speech-to-text. `missingGroups` on a frame names the groups
|
|
158
164
|
skipped before it (see [voice delivery](https://github.com/caprids/relay-sdks/blob/main/ts/GUIDE.md#voice-delivery-per-direction)).
|
|
159
165
|
|
|
160
|
-
The combined `register_media` publishing handle is still a proposal in `spec/media-layer.md`. `@caprid/relay/media`
|
|
161
|
-
ships the frame writer and catalog service that it would compose.
|
|
162
|
-
|
|
163
166
|
## Media timeline
|
|
164
167
|
|
|
165
168
|
msf-01's Media Timeline track maps media time to group locations, for seeking and playlists, with one record per video
|
|
@@ -221,8 +224,8 @@ the real worklet. See [playing audio](https://github.com/caprids/relay-sdks/blob
|
|
|
221
224
|
|
|
222
225
|
## Video playout
|
|
223
226
|
|
|
224
|
-
`createVideoPlayer({ clock, decoderConfig, render })` plays one video track with no UI. It decodes the frames
|
|
225
|
-
|
|
227
|
+
`createVideoPlayer({ clock, decoderConfig, render })` plays one video track with no UI. It decodes the frames you
|
|
228
|
+
push to it with WebCodecs and calls `render(frame)` when the playout clock says each is due. It closes the frames the clock
|
|
226
229
|
says to drop.
|
|
227
230
|
|
|
228
231
|
```ts
|
|
@@ -241,9 +244,9 @@ subscriber.subscribe({ namespace, track: 'video', parameters: mediaSubscribePara
|
|
|
241
244
|
- `videoDecoderConfigFromTrack(track)` reads the decoder config from a catalog track.
|
|
242
245
|
- The player waits for a keyframe at the start, after a decoder error, and after a `resync` or `restart`, which also
|
|
243
246
|
reset the decoder and close the frames waiting. `player.reset()` does the same at once, for a restart the app hears
|
|
244
|
-
of before the next frame, such as a supervised want's `onRestarted`. `player.configure(decoderConfig)` switches the
|
|
245
|
-
keyframe, as at a rendition switch.
|
|
246
|
-
-
|
|
247
|
+
of before the next frame, such as a supervised want's `onRestarted`. `player.configure(decoderConfig)` switches the
|
|
248
|
+
config from the next keyframe, as at a rendition switch.
|
|
249
|
+
- The player reports a decoder that fails before its first frame, or with `NotSupportedError`, once. It then decodes
|
|
247
250
|
nothing until `player.configure(decoderConfig)`.
|
|
248
251
|
- Share the clock with the audio input so audio drives the video. Without audio, the clock paces it by the wall clock.
|
|
249
252
|
- It uses only `VideoDecoder`, `EncodedVideoChunk` and timers, so it runs in a dedicated worker as it is.
|
package/dist/video-player.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A headless video player
|
|
3
|
-
* playout clock says it is due.
|
|
4
|
-
* so it runs unchanged in a dedicated worker. See spec/media-layer.md, "Video player".
|
|
2
|
+
* A headless video player. It decodes frames with WebCodecs and hands each decoded frame to a sink when the
|
|
3
|
+
* broadcast's playout clock says it is due. It has no DOM and no transport. It uses only `VideoDecoder`,
|
|
4
|
+
* `EncodedVideoChunk` and timers, so it runs unchanged in a dedicated worker. See spec/media-layer.md, "Video player".
|
|
5
5
|
*/
|
|
6
6
|
import type { PlayoutClock } from './clock.js';
|
|
7
7
|
import type { FrameDiscontinuity, SequencedFrame } from './sequencer.js';
|
|
8
8
|
/**
|
|
9
|
-
* What the player calls on its clock
|
|
9
|
+
* What the player calls on its clock. A `PlayoutClock` qualifies. Share the broadcast's clock with its audio input and
|
|
10
10
|
* with the frame reader's sequencer, so video follows the audio that drives it.
|
|
11
11
|
*/
|
|
12
12
|
export type VideoPlayerClock = Pick<PlayoutClock, 'due' | 'localNow'>;
|
|
13
|
-
/** One encoded video frame
|
|
13
|
+
/** One encoded video frame. A `SequencedFrame` from a frame reader qualifies. */
|
|
14
14
|
export type VideoPlayerFrame = Pick<SequencedFrame, 'timestampUs' | 'payload' | 'key'> & {
|
|
15
15
|
/** Set where the frame does not follow the one before; see {@link VideoPlayer.push}. */
|
|
16
16
|
discontinuity?: FrameDiscontinuity | undefined;
|
|
@@ -22,21 +22,21 @@ export interface VideoPlayerOptions {
|
|
|
22
22
|
/** How to decode. `videoDecoderConfigFromTrack` reads one from the catalog. */
|
|
23
23
|
decoderConfig: VideoDecoderConfig;
|
|
24
24
|
/**
|
|
25
|
-
* Show a frame
|
|
26
|
-
* hardware decoder has a fixed pool of frames and stalls while they are all held. A sink that
|
|
27
|
-
* `frame.clone()`. An exception goes to `onError
|
|
28
|
-
*
|
|
25
|
+
* Show a frame. The player calls it when the frame is due. The frame is borrowed. The player closes it once this
|
|
26
|
+
* returns, because a hardware decoder has a fixed pool of frames and stalls while they are all held. A sink that
|
|
27
|
+
* keeps the frame keeps `frame.clone()`. An exception goes to `onError`, or to `console.error` without one. The player
|
|
28
|
+
* still closes the frame and plays on. `canvasRenderer(canvas)` draws onto a canvas.
|
|
29
29
|
*/
|
|
30
30
|
render(frame: VideoFrame): void;
|
|
31
31
|
/**
|
|
32
32
|
* A decoder error, after which the player replaces the decoder and decodes again from the next keyframe, or an
|
|
33
33
|
* exception from `render`. Without it, both go to `console.error`. A decoder that fails before it output any frame,
|
|
34
|
-
* or with a `NotSupportedError`, fails for good
|
|
34
|
+
* or with a `NotSupportedError`, fails for good. A new decoder with the same config would fail the same way, so the
|
|
35
35
|
* player decodes nothing more until `configure()` gives it another config.
|
|
36
36
|
*/
|
|
37
37
|
onError?(error: unknown): void;
|
|
38
38
|
}
|
|
39
|
-
/** The player's counters.
|
|
39
|
+
/** The player's counters. All but `queued` and `lastOffsetUs` only grow. */
|
|
40
40
|
export interface VideoPlayerStats {
|
|
41
41
|
/** Frames the decoder output. */
|
|
42
42
|
decoded: number;
|
|
@@ -46,18 +46,18 @@ export interface VideoPlayerStats {
|
|
|
46
46
|
dropped: number;
|
|
47
47
|
/** Frames pushed and not decoded: while the player waited for a keyframe, or after the decoder failed for good. */
|
|
48
48
|
skipped: number;
|
|
49
|
-
/** Times the
|
|
49
|
+
/** Times the player reset or replaced the decoder, at a `resync` or `restart` and after an error. */
|
|
50
50
|
decoderResets: number;
|
|
51
51
|
/** Decoder errors and exceptions from `render`. */
|
|
52
52
|
errors: number;
|
|
53
53
|
/** Decoded frames waiting to be due now. */
|
|
54
54
|
queued: number;
|
|
55
|
-
/** The clock's offset for the last frame shown, in microseconds
|
|
55
|
+
/** The clock's offset for the last frame shown, in microseconds. This is its sync error, positive when early. */
|
|
56
56
|
lastOffsetUs: number | null;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* When each step of the player's start happened, in microseconds on its clock's local time source
|
|
60
|
-
* happens. The
|
|
59
|
+
* When each step of the player's start happened, in microseconds on its clock's local time source, or `null` until it
|
|
60
|
+
* happens. The player updates the object in place.
|
|
61
61
|
*/
|
|
62
62
|
export interface VideoPlayerJoinPhases {
|
|
63
63
|
/** `createVideoPlayer` returned. */
|
|
@@ -74,7 +74,7 @@ export interface VideoPlayer {
|
|
|
74
74
|
/**
|
|
75
75
|
* Decode a frame, in decode order. A frame reader's `onFrame` can be this. The player waits for a keyframe at the
|
|
76
76
|
* start, after a decoder error, and after a `resync` or `restart`, skipping the frames before it. A `resync` or
|
|
77
|
-
* `restart` also resets the decoder and closes every decoded frame still waiting
|
|
77
|
+
* `restart` also resets the decoder and closes every decoded frame still waiting. They belong to the replaced
|
|
78
78
|
* timeline. A `gap` flushes the decoder instead, since the frames before it are still on the timeline; a frame after a
|
|
79
79
|
* gap that is not a keyframe is skipped, as is every frame after it until one. A frame marked `key` that the decoder
|
|
80
80
|
* finds is not a keyframe is reported and skipped, as are the frames after it until the next keyframe.
|
|
@@ -87,21 +87,22 @@ export interface VideoPlayer {
|
|
|
87
87
|
*/
|
|
88
88
|
configure(decoderConfig: VideoDecoderConfig): void;
|
|
89
89
|
/**
|
|
90
|
-
* Replace the timeline now, as a `restart` frame would
|
|
91
|
-
*
|
|
92
|
-
* arrives, such as a supervised want's `onRestarted
|
|
90
|
+
* Replace the timeline now, as a `restart` frame would. The player resets the decoder, closes every decoded frame
|
|
91
|
+
* still waiting, and starts decoding again at the next keyframe. Call it when the app learns of a restart before the
|
|
92
|
+
* next frame arrives, such as from a supervised want's `onRestarted`. The restart has already moved the clock, so
|
|
93
|
+
* those frames would look due.
|
|
93
94
|
*/
|
|
94
95
|
reset(): void;
|
|
95
96
|
/** Counters, updated in place. */
|
|
96
97
|
readonly stats: Readonly<VideoPlayerStats>;
|
|
97
98
|
/** When each step of the start happened, for measuring a join. */
|
|
98
99
|
readonly joinPhases: Readonly<VideoPlayerJoinPhases>;
|
|
99
|
-
/** Stop
|
|
100
|
+
/** Stop. The player closes the decoder and every decoded frame still waiting, and ignores later pushes. */
|
|
100
101
|
close(): void;
|
|
101
102
|
/** Whether `close()` was called. */
|
|
102
103
|
readonly closed: boolean;
|
|
103
104
|
}
|
|
104
|
-
/** The part of a canvas that {@link canvasRenderer} draws on
|
|
105
|
+
/** The part of a canvas that {@link canvasRenderer} draws on. An `HTMLCanvasElement` or an `OffscreenCanvas` qualifies. */
|
|
105
106
|
export interface VideoCanvas {
|
|
106
107
|
/** The canvas's width in pixels. */
|
|
107
108
|
width: number;
|
|
@@ -112,9 +113,9 @@ export interface VideoCanvas {
|
|
|
112
113
|
}
|
|
113
114
|
/**
|
|
114
115
|
* Create a video player. Decoded frames wait in presentation order until the clock says the earliest is due, so a
|
|
115
|
-
* decoder whose pool of frames is full resumes as they are shown
|
|
116
|
-
* `maxVideoDelayUs`, or
|
|
117
|
-
* timer, so only frames ahead of the clock wait, even while a hidden tab throttles timers.
|
|
116
|
+
* decoder whose pool of frames is full resumes as they are shown. The earliest is due within the clock's
|
|
117
|
+
* `maxVideoDelayUs`, or the player shows it at once as a re-sync. The player asks the clock at each decoded frame as
|
|
118
|
+
* well as on its timer, so only frames ahead of the clock wait, even while a hidden tab throttles timers.
|
|
118
119
|
*
|
|
119
120
|
* ```ts
|
|
120
121
|
* const clock = createPlayoutClock();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-player.d.ts","sourceRoot":"","sources":["../src/video-player.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEzE;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,KAAK,GAAG,UAAU,CAAC,CAAC;AAEtE,iFAAiF;AACjF,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,EAAE,aAAa,GAAG,SAAS,GAAG,KAAK,CAAC,GAAG;IACvF,wFAAwF;IACxF,aAAa,CAAC,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,gGAAgG;IAChG,KAAK,EAAE,gBAAgB,CAAC;IACxB,+EAA+E;IAC/E,aAAa,EAAE,kBAAkB,CAAC;IAClC;;;;;OAKG;IACH,MAAM,CAAC,KAAK,E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AW,GAAG,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAQ/E"}
|
package/dist/video-player.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A headless video player
|
|
3
|
-
* playout clock says it is due.
|
|
4
|
-
* so it runs unchanged in a dedicated worker. See spec/media-layer.md, "Video player".
|
|
2
|
+
* A headless video player. It decodes frames with WebCodecs and hands each decoded frame to a sink when the
|
|
3
|
+
* broadcast's playout clock says it is due. It has no DOM and no transport. It uses only `VideoDecoder`,
|
|
4
|
+
* `EncodedVideoChunk` and timers, so it runs unchanged in a dedicated worker. See spec/media-layer.md, "Video player".
|
|
5
5
|
*/
|
|
6
|
-
/** Ask the clock again at least this often while a frame waits
|
|
6
|
+
/** Ask the clock again at least this often while a frame waits, because the audio input or another track may move it. */
|
|
7
7
|
const CLOCK_RECHECK_US = 50_000;
|
|
8
8
|
const isNotSupported = (error) => error instanceof Error && error.name === 'NotSupportedError';
|
|
9
9
|
const isDataError = (error) => error instanceof Error && error.name === 'DataError';
|
|
10
10
|
/**
|
|
11
11
|
* Create a video player. Decoded frames wait in presentation order until the clock says the earliest is due, so a
|
|
12
|
-
* decoder whose pool of frames is full resumes as they are shown
|
|
13
|
-
* `maxVideoDelayUs`, or
|
|
14
|
-
* timer, so only frames ahead of the clock wait, even while a hidden tab throttles timers.
|
|
12
|
+
* decoder whose pool of frames is full resumes as they are shown. The earliest is due within the clock's
|
|
13
|
+
* `maxVideoDelayUs`, or the player shows it at once as a re-sync. The player asks the clock at each decoded frame as
|
|
14
|
+
* well as on its timer, so only frames ahead of the clock wait, even while a hidden tab throttles timers.
|
|
15
15
|
*
|
|
16
16
|
* ```ts
|
|
17
17
|
* const clock = createPlayoutClock();
|
package/dist/video-player.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"video-player.js","sourceRoot":"","sources":["../src/video-player.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"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,OAAO,GAAG,OAAO,EAAE,CAAC;YAC1B,QAAQ,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;YAC/B,SAAS,EAAE,CAAC;YACZ,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;gBAAE,KAAK,CAAC,KAAK,EAAE,CAAC;YACnD,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,KAAK,QAAQ;gBAAE,OAAO,CAAC,KAAK,EAAE,CAAC;QAC7D,CAAC;QACD,IAAI,MAAM;YACR,OAAO,QAAQ,CAAC,KAAK,KAAK,QAAQ,CAAC;QACrC,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAmB;IAChD,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,wEAAwE,CAAC,CAAC;IACxG,OAAO,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY;YAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,YAAY,CAAC;QAC3E,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,aAAa;YAAE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,aAAa,CAAC;QAC/E,OAAO,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9D,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/webcodecs.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ export declare function audioTrackFromDecoderConfig(config: AudioDecoderConfig):
|
|
|
13
13
|
export declare function audioDecoderConfigFromTrack(track: MsfCatalogTrack): AudioDecoderConfig;
|
|
14
14
|
/**
|
|
15
15
|
* The decoder config for a catalog's video track: its codec, its init data as the description (an AVC track's avcC),
|
|
16
|
-
* and its width and height as the coded size when it declares both. `optimizeForLatency
|
|
17
|
-
*
|
|
16
|
+
* and its width and height as the coded size when it declares both. It sets `optimizeForLatency`, because a live
|
|
17
|
+
* player needs each frame as soon as it decodes.
|
|
18
18
|
*/
|
|
19
19
|
export declare function videoDecoderConfigFromTrack(track: MsfCatalogTrack): VideoDecoderConfig;
|
|
20
20
|
/** One encoded frame ready to publish as a LOC object: `write(payload, { properties })`. */
|
package/dist/webcodecs.js
CHANGED
|
@@ -60,8 +60,8 @@ export function audioDecoderConfigFromTrack(track) {
|
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
62
62
|
* The decoder config for a catalog's video track: its codec, its init data as the description (an AVC track's avcC),
|
|
63
|
-
* and its width and height as the coded size when it declares both. `optimizeForLatency
|
|
64
|
-
*
|
|
63
|
+
* and its width and height as the coded size when it declares both. It sets `optimizeForLatency`, because a live
|
|
64
|
+
* player needs each frame as soon as it decodes.
|
|
65
65
|
*/
|
|
66
66
|
export function videoDecoderConfigFromTrack(track) {
|
|
67
67
|
if (!track.codec)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caprid/moq-media",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Transport-independent LOC and MSF media format helpers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@caprid/moq-core": "0.
|
|
26
|
+
"@caprid/moq-core": "0.5.0"
|
|
27
27
|
},
|
|
28
28
|
"engines": {
|
|
29
29
|
"node": ">=24"
|