@caprid/relay 0.5.0 → 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 +55 -54
- package/dist/client-diagnostics.d.ts +249 -0
- package/dist/client-diagnostics.d.ts.map +1 -0
- package/dist/client-diagnostics.js +608 -0
- package/dist/client-diagnostics.js.map +1 -0
- package/dist/cmcd.d.ts +99 -0
- package/dist/cmcd.d.ts.map +1 -0
- package/dist/cmcd.js +631 -0
- package/dist/cmcd.js.map +1 -0
- package/dist/connect-session.d.ts +65 -5
- package/dist/connect-session.d.ts.map +1 -1
- package/dist/connect-session.js +116 -12
- package/dist/connect-session.js.map +1 -1
- package/dist/connect.d.ts +10 -2
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +3 -2
- package/dist/connect.js.map +1 -1
- package/dist/diagnostics-report.d.ts +115 -0
- package/dist/diagnostics-report.d.ts.map +1 -0
- package/dist/diagnostics-report.js +475 -0
- package/dist/diagnostics-report.js.map +1 -0
- package/dist/diagnostics.d.ts +23 -0
- package/dist/diagnostics.d.ts.map +1 -0
- package/dist/diagnostics.js +23 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/frame-reader.d.ts +18 -3
- package/dist/frame-reader.d.ts.map +1 -1
- package/dist/frame-reader.js +86 -3
- package/dist/frame-reader.js.map +1 -1
- package/dist/frame-writer.d.ts +17 -1
- package/dist/frame-writer.d.ts.map +1 -1
- package/dist/frame-writer.js +95 -5
- package/dist/frame-writer.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/media-track-properties.d.ts +3 -2
- package/dist/media-track-properties.d.ts.map +1 -1
- package/dist/media-track-properties.js +3 -2
- package/dist/media-track-properties.js.map +1 -1
- package/dist/publish.d.ts +19 -6
- package/dist/publish.d.ts.map +1 -1
- package/dist/publish.js +17 -4
- package/dist/publish.js.map +1 -1
- package/dist/relay-session.d.ts.map +1 -1
- package/dist/relay-session.js +3 -1
- package/dist/relay-session.js.map +1 -1
- package/dist/replaceable-track.d.ts +2 -2
- package/dist/replaceable-track.d.ts.map +1 -1
- package/dist/replaceable-track.js +8 -2
- package/dist/replaceable-track.js.map +1 -1
- package/dist/subscription.d.ts.map +1 -1
- package/dist/subscription.js +22 -8
- package/dist/subscription.js.map +1 -1
- package/dist/supervised-publisher.d.ts +22 -1
- package/dist/supervised-publisher.d.ts.map +1 -1
- package/dist/supervised-publisher.js +11 -2
- package/dist/supervised-publisher.js.map +1 -1
- package/dist/supervised-relay.d.ts +23 -1
- package/dist/supervised-relay.d.ts.map +1 -1
- package/dist/supervised-relay.js +12 -3
- package/dist/supervised-relay.js.map +1 -1
- package/dist/supervised-subscriber.d.ts +28 -8
- package/dist/supervised-subscriber.d.ts.map +1 -1
- package/dist/supervised-subscriber.js +36 -11
- package/dist/supervised-subscriber.js.map +1 -1
- package/dist/supervision.d.ts +18 -0
- package/dist/supervision.d.ts.map +1 -1
- package/dist/supervision.js +34 -0
- package/dist/supervision.js.map +1 -1
- package/dist/supervisor.d.ts +23 -9
- package/dist/supervisor.d.ts.map +1 -1
- package/dist/supervisor.js +193 -14
- package/dist/supervisor.js.map +1 -1
- package/dist/version.d.ts +6 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/dist/write-slot.d.ts +11 -0
- package/dist/write-slot.d.ts.map +1 -1
- package/dist/write-slot.js +16 -1
- package/dist/write-slot.js.map +1 -1
- package/package.json +13 -9
package/dist/cmcd.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type Diagnostics, type DiagnosticsPublication, type DiagnosticsPublisher } from './client-diagnostics.js';
|
|
2
|
+
/**
|
|
3
|
+
* CMCD v2 (CTA-5004-B) on `diag.cmcd` (spec/behavior.md, "Client diagnostics", "CMCD"; TypeScript only): records in
|
|
4
|
+
* the shape draft-wilaw-moq-cmcd-event-timeline-00 gives them, each group's payload an MSF Event Timeline (§8) array.
|
|
5
|
+
* Derived from what a recorder already holds: its frame readers' `receive` sections, its audio inputs' `audio`
|
|
6
|
+
* sections, its `page` section and its events.
|
|
7
|
+
*/
|
|
8
|
+
/** The CMCD events (`e`) the SDK can see, and so the ones {@link publishCmcd} sends. */
|
|
9
|
+
export type CmcdEventType =
|
|
10
|
+
/** Time interval: every `intervalMs`. */
|
|
11
|
+
't'
|
|
12
|
+
/** Play state change: a remote track's `sta` changed. */
|
|
13
|
+
| 'ps'
|
|
14
|
+
/** Error: a want failed for good, or the connection ended with an error. */
|
|
15
|
+
| 'e'
|
|
16
|
+
/** Backgrounded: the page went to the background, or came back. */
|
|
17
|
+
| 'b';
|
|
18
|
+
/**
|
|
19
|
+
* A CMCD value in a record's `data`: a number for CTA-5004-B's Integer and Decimal, `true` for a Boolean, a string for
|
|
20
|
+
* a String or a Token (its bare value, unquoted), and for an Inner List the list's Structured Field text, such as
|
|
21
|
+
* `(5000;v)`.
|
|
22
|
+
*/
|
|
23
|
+
export type CmcdValue = number | string | boolean;
|
|
24
|
+
/** One CMCD record, as an MSF Event Timeline record with the `T` (wall clock) index. */
|
|
25
|
+
export interface CmcdRecord {
|
|
26
|
+
/** When it was triggered: wall clock, milliseconds since the epoch. CMCD's `ts`, which `data` never carries. */
|
|
27
|
+
T: number;
|
|
28
|
+
/** The CMCD keys, in alphabetical order; `v` is always 2. */
|
|
29
|
+
data: Record<string, CmcdValue>;
|
|
30
|
+
}
|
|
31
|
+
/** A remote media track as {@link PublishCmcdOptions.keys} sees it, for one record. */
|
|
32
|
+
export interface CmcdTrack {
|
|
33
|
+
/** The record's `cid`: the namespace and the track, joined with `/`. */
|
|
34
|
+
readonly cid: string;
|
|
35
|
+
/** The namespace the reader's current subscription was made on, joined with `/`: the generation's, when following one. */
|
|
36
|
+
readonly namespace: string;
|
|
37
|
+
/** The track name. */
|
|
38
|
+
readonly track: string;
|
|
39
|
+
/** `a` for a reader with an audio input watched beside it, `v` otherwise. */
|
|
40
|
+
readonly type: 'a' | 'v';
|
|
41
|
+
/** The scope the reader reports under, such as `p2/audio`; empty for the recorder itself. */
|
|
42
|
+
readonly scope: string;
|
|
43
|
+
/** What triggered the record. */
|
|
44
|
+
readonly event: CmcdEventType;
|
|
45
|
+
}
|
|
46
|
+
/** Options for {@link publishCmcd}, after draft-wilaw-moq-cmcd-event-timeline-00's `cmcdConfig`. */
|
|
47
|
+
export interface PublishCmcdOptions {
|
|
48
|
+
/** The events that trigger records. A non-empty array; default all four, `['t', 'ps', 'e', 'b']`. */
|
|
49
|
+
events?: readonly CmcdEventType[];
|
|
50
|
+
/**
|
|
51
|
+
* How often a `t` record goes, in milliseconds. Default 30000. Below 5000 counts as 5000, as the draft asks, so a
|
|
52
|
+
* configuration cannot set the report rate high.
|
|
53
|
+
*/
|
|
54
|
+
intervalMs?: number;
|
|
55
|
+
/**
|
|
56
|
+
* The keys records may carry. Default every key the SDK derives: `bg`, `bl`, `br`, `bs`, `bsa`, `bsd`, `bsda`,
|
|
57
|
+
* `cid`, `dfa`, `ec`, `msd`, `mtp`, `sid`, `sn`, `st`, `sta`, `tbl`. `v` and `e` go in every record whatever the
|
|
58
|
+
* list says, and a key CTA-5004-B requires beside an event too: `sta` with `ps`, `ec` with `e`. A key the draft
|
|
59
|
+
* bans (`ab`, `d`, `ot`, `url` and the rest) is a RangeError. Application keys from `keys` must be listed too.
|
|
60
|
+
*/
|
|
61
|
+
enabledKeys?: readonly string[];
|
|
62
|
+
/** The session ID, `sid`: 1 to 64 characters. Default the recorder's `instance`. */
|
|
63
|
+
sid?: string;
|
|
64
|
+
/** Records to gather into one group before writing it. A positive integer; default one record per group. */
|
|
65
|
+
batchCount?: number;
|
|
66
|
+
/**
|
|
67
|
+
* How long a group may gather records before it is written, in milliseconds, from its first record. A positive
|
|
68
|
+
* integer. With `batchCount` too, a group is written when either is reached first.
|
|
69
|
+
*/
|
|
70
|
+
batchIntervalMs?: number;
|
|
71
|
+
/**
|
|
72
|
+
* The Default Publisher Priority (0x0E) of `diag.cmcd`, an integer from 0 to 255, lower being more urgent. Default
|
|
73
|
+
* 232: behind every media track and behind `diag.events` (224), ahead of `diag.stats` (240).
|
|
74
|
+
*/
|
|
75
|
+
priority?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Add keys to a track's record, or override the SDK's, such as a video freeze count the application keeps: return
|
|
78
|
+
* the keys, `undefined` for a key to leave it out. Called synchronously for each record. `v`, `e`, `sn` and `sid`
|
|
79
|
+
* stay the SDK's, and `sta` on a `ps` record and `ec` on an `e` record, left out, go back in. A value that is not a {@link CmcdValue}, or an application key that is neither one of the draft's
|
|
80
|
+
* allowed keys nor a custom key (with a `-`, a string of at most 64 characters, as CTA-5004-B asks), is left out.
|
|
81
|
+
*/
|
|
82
|
+
keys?(track: CmcdTrack): Readonly<Record<string, CmcdValue | undefined>> | undefined;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Publish CMCD v2 records on `diag.cmcd` of the publication, derived from what the recorder holds: one record per
|
|
86
|
+
* remote media track (a frame reader that reads a want, with `cid` its namespace and track) at each trigger, or one
|
|
87
|
+
* without `cid` while there is none. Nothing is sent while the relay has no subscription to the track. Each group
|
|
88
|
+
* carries one record, or a batch, as an MSF Event Timeline array; group IDs start at 0. Publish it beside
|
|
89
|
+
* {@link publishDiagnostics}, on the same publication.
|
|
90
|
+
*
|
|
91
|
+
* ```ts
|
|
92
|
+
* const publication = publishCmcd(diagnostics, relay.publish(['diag', 'player', id, viewer]), {
|
|
93
|
+
* events: ['t', 'ps', 'e'],
|
|
94
|
+
* intervalMs: 10_000,
|
|
95
|
+
* });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export declare function publishCmcd(diagnostics: Diagnostics, publisher: DiagnosticsPublisher, options?: PublishCmcdOptions): DiagnosticsPublication;
|
|
99
|
+
//# sourceMappingURL=cmcd.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cmcd.d.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