@reactor-team/js-sdk 3.3.0 → 3.4.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 +52 -0
- package/dist/index.cjs +296 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +98 -4
- package/dist/index.d.ts +98 -4
- package/dist/index.js +296 -25
- package/dist/index.js.map +1 -1
- package/dist/wasm/README.md +5 -2
- package/dist/wasm/reactor_wasm.d.ts +61 -1
- package/dist/wasm/reactor_wasm.js +117 -7
- package/dist/wasm/reactor_wasm_bg.wasm.d.ts +6 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -258,6 +258,8 @@ type TrackDirection = 'recvonly' | 'sendonly';
|
|
|
258
258
|
type GenerationMode = 'streamed' | 'stepped';
|
|
259
259
|
/** Byte layout of a frame given to `pushVideoFrame`. */
|
|
260
260
|
type PixelFormat = 'rgba' | 'rgb' | 'bgra';
|
|
261
|
+
/** Codec of an encoded frame given to `pushEncodedVideoFrame`. */
|
|
262
|
+
type EncodedVideoCodec = 'h264';
|
|
261
263
|
interface ClientOptions {
|
|
262
264
|
modelName: string;
|
|
263
265
|
apiUrl?: string;
|
|
@@ -281,6 +283,9 @@ interface ClientOptions {
|
|
|
281
283
|
/** How long `step()` waits for a step's result, generation included.
|
|
282
284
|
* Default 300000. */
|
|
283
285
|
stepTimeoutMs?: number;
|
|
286
|
+
/** The largest data-channel message, in bytes, the client declares and
|
|
287
|
+
* accepts: 262144 (256 KiB) to 1073741824 (1 GiB). Default 64 MiB. */
|
|
288
|
+
maxMessageSize?: number;
|
|
284
289
|
logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
|
285
290
|
}
|
|
286
291
|
interface ConnectOptions {
|
|
@@ -410,6 +415,38 @@ interface StepOptions {
|
|
|
410
415
|
state?: Record<string, unknown>;
|
|
411
416
|
/** Commands to run after the state, in order. */
|
|
412
417
|
commands?: StepCommand[];
|
|
418
|
+
/** This step's own frames, by input track name: what `pushFrame()` takes,
|
|
419
|
+
* or an `EncodedFrame`. They go after the frames pushed to that track
|
|
420
|
+
* since the previous step, exactly as if pushed just before the step, so
|
|
421
|
+
* each track must be published first. A bad track or frame anywhere fails
|
|
422
|
+
* the step before any of them is pushed, leaving the buffer as it was. */
|
|
423
|
+
media?: Record<string, ReadonlyArray<PushFrame | EncodedFrame>>;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* An encoded video frame for a step: one H.264 access unit (Annex B), its
|
|
427
|
+
* bytes sent as they are. `width` and `height` are the frame it decodes to.
|
|
428
|
+
*
|
|
429
|
+
* The runtime decodes a track's encoded frames of one step as one stream,
|
|
430
|
+
* before the step runs, and the model reads the RGB frames as if they had
|
|
431
|
+
* been pushed raw. So give them in decode order, starting at a keyframe.
|
|
432
|
+
*
|
|
433
|
+
* `data` may be a WebCodecs `EncodedVideoChunk` as a `VideoEncoder` hands it
|
|
434
|
+
* over; configure the encoder with `avc: { format: 'annexb' }`, as its
|
|
435
|
+
* default (`"avc"`) is length-prefixed, not Annex B.
|
|
436
|
+
*/
|
|
437
|
+
interface EncodedFrame {
|
|
438
|
+
/** Tells an encoded frame from a raw one in `step()`'s `media`. */
|
|
439
|
+
codec: EncodedVideoCodec;
|
|
440
|
+
/** One access unit. A chunk's bytes are copied out when it is pushed. */
|
|
441
|
+
data: Uint8Array | ArrayBuffer | EncodedVideoChunk;
|
|
442
|
+
/** Width of the frame it decodes to. */
|
|
443
|
+
width: number;
|
|
444
|
+
/** Height of the frame it decodes to. */
|
|
445
|
+
height: number;
|
|
446
|
+
/** Opaque bytes the decoded frame carries to the model. */
|
|
447
|
+
metadata?: Uint8Array;
|
|
448
|
+
/** When the frame was captured, in microseconds. */
|
|
449
|
+
captureTimeUs?: number;
|
|
413
450
|
}
|
|
414
451
|
/** Raw pixels for `Reactor.pushFrame()`. `ImageData` is one of these as is. */
|
|
415
452
|
interface RawVideoFrame {
|
|
@@ -442,6 +479,9 @@ interface PublishedTrack {
|
|
|
442
479
|
* track is unpublished or its connection ends: publish again for a new
|
|
443
480
|
* handle. */
|
|
444
481
|
pushFrame(frame: PushFrame, options?: PushFrameOptions): Promise<void>;
|
|
482
|
+
/** Buffers one encoded video frame on this track for the next `step()` —
|
|
483
|
+
* `reactor.pushEncodedFrame(name, frame)`. Rejects as `pushFrame()` does. */
|
|
484
|
+
pushEncodedFrame(frame: EncodedFrame): Promise<void>;
|
|
445
485
|
}
|
|
446
486
|
/** Per-frame extras for a pushed video frame. */
|
|
447
487
|
interface PushFrameOptions {
|
|
@@ -826,9 +866,10 @@ declare class Reactor implements Disposable {
|
|
|
826
866
|
* is finalized on "ready" — see `handleStatusChanged()`. */
|
|
827
867
|
private connectStartTime;
|
|
828
868
|
private waitingStartTime;
|
|
829
|
-
/** The tail of every `pushFrame()` so far, settled
|
|
830
|
-
* reach the binding in call order however long each
|
|
831
|
-
* read, and `step()` waits for the ones called
|
|
869
|
+
/** The tail of every `pushFrame()`/`pushEncodedFrame()` so far, settled
|
|
870
|
+
* either way — pushes reach the binding in call order however long each
|
|
871
|
+
* one's pixels take to read, and `step()` waits for the ones called
|
|
872
|
+
* before it. */
|
|
832
873
|
private pendingPushes;
|
|
833
874
|
private readonly emitter;
|
|
834
875
|
/** Serializes connect()/reconnect()/disconnect() (and the free() inside
|
|
@@ -1092,6 +1133,20 @@ declare class Reactor implements Disposable {
|
|
|
1092
1133
|
* when its request cannot be sent, they are dropped with it rather than
|
|
1093
1134
|
* kept for the next step.
|
|
1094
1135
|
*
|
|
1136
|
+
* `media` gives the step frames of its own, by input track name, pushed
|
|
1137
|
+
* after the ones already pushed to that track: what `pushFrame()` takes,
|
|
1138
|
+
* or an `EncodedFrame` — H.264 the runtime decodes before the step runs,
|
|
1139
|
+
* so the model reads RGB frames as for a raw push. They are pushed only
|
|
1140
|
+
* once `state` and `commands` are well formed and the session is ready, so
|
|
1141
|
+
* a step refused for those leaves the frames buffered as they were. They go
|
|
1142
|
+
* all or nothing: a bad track or frame anywhere in `media` rejects the step
|
|
1143
|
+
* before any of it is pushed or sent, leaving the buffer as it was. A
|
|
1144
|
+
* session that leaves 'ready' once the media is in has the step refused and
|
|
1145
|
+
* keeps the frames for the next one, as pushed frames are.
|
|
1146
|
+
* A track's encoded frames of one step go in decode order, starting at a
|
|
1147
|
+
* keyframe; a step whose frames do not decode rejects with a
|
|
1148
|
+
* `StepRefusedError`.
|
|
1149
|
+
*
|
|
1095
1150
|
* ```ts
|
|
1096
1151
|
* const camera = await reactor.publishTrack('camera');
|
|
1097
1152
|
* await camera.pushFrame(imageData);
|
|
@@ -1132,6 +1187,45 @@ declare class Reactor implements Disposable {
|
|
|
1132
1187
|
/** `pushFrame()`, for the track's current publication or, from a
|
|
1133
1188
|
* `PublishedTrack`, only for the `publication` it came from. */
|
|
1134
1189
|
private pushTo;
|
|
1190
|
+
/**
|
|
1191
|
+
* Buffers one encoded video frame for the next `step()` on the sendonly
|
|
1192
|
+
* video track `trackName`, its bytes as they are: one H.264 access unit
|
|
1193
|
+
* (Annex B), with the `width` and `height` it decodes to. The
|
|
1194
|
+
* `PublishedTrack` that `publishTrack()` resolves with does the same
|
|
1195
|
+
* through `track.pushEncodedFrame(frame)`.
|
|
1196
|
+
*
|
|
1197
|
+
* The runtime decodes a track's encoded frames of one step as one stream,
|
|
1198
|
+
* before the step runs, and the model reads the RGB frames as if they had
|
|
1199
|
+
* been pushed raw. So push them in decode order, starting at a keyframe; a
|
|
1200
|
+
* step whose frames do not decode rejects with a `StepRefusedError`, as
|
|
1201
|
+
* does a runtime that predates encoded frames. Encoded and raw pushes keep
|
|
1202
|
+
* their call order, and a `step()` waits for every push called before it.
|
|
1203
|
+
*
|
|
1204
|
+
* ```ts
|
|
1205
|
+
* const encoder = new VideoEncoder({
|
|
1206
|
+
* output: (chunk) => void camera.pushEncodedFrame({ codec: 'h264', data: chunk, width, height }),
|
|
1207
|
+
* error: console.error,
|
|
1208
|
+
* });
|
|
1209
|
+
* encoder.configure({ codec: 'avc1.42001f', width, height, avc: { format: 'annexb' } });
|
|
1210
|
+
* ```
|
|
1211
|
+
*
|
|
1212
|
+
* Rejects with an `InvalidStateError` outside a stepped session, for a
|
|
1213
|
+
* track not published on this connection, for an audio or recvonly track,
|
|
1214
|
+
* for empty data, a zero dimension or a codec other than `"h264"`.
|
|
1215
|
+
*/
|
|
1216
|
+
pushEncodedFrame(trackName: string, frame: EncodedFrame): Promise<void>;
|
|
1217
|
+
/** `pushEncodedFrame()`, for the track's current publication or, from a
|
|
1218
|
+
* `PublishedTrack`, only for the `publication` it came from. */
|
|
1219
|
+
private pushEncodedTo;
|
|
1220
|
+
/** Refuses a push whose connection ended since it was called, or whose
|
|
1221
|
+
* track is not (or no longer) published on it. */
|
|
1222
|
+
private checkPushTarget;
|
|
1223
|
+
/** Pushes `step()`'s `media`, track by track and in order, each frame as
|
|
1224
|
+
* `pushFrame()` or `pushEncodedFrame()` would. All or nothing: the binding
|
|
1225
|
+
* checks the step's `state` and `commands`, then every frame, before the
|
|
1226
|
+
* first is pushed, so a refused step, or a bad track or frame anywhere,
|
|
1227
|
+
* leaves the buffer as it was. */
|
|
1228
|
+
private pushStepMedia;
|
|
1135
1229
|
/** Drops every frame buffered for the next step, pushes called before it
|
|
1136
1230
|
* included: it waits its turn behind them, as a `step()` does. */
|
|
1137
1231
|
clearStepInputs(): Promise<void>;
|
|
@@ -1642,4 +1736,4 @@ interface ClipDownloadButtonProps {
|
|
|
1642
1736
|
}
|
|
1643
1737
|
declare function ClipDownloadButton({ clip, getJwt, filename, children, className, style, disabled, onSuccess, onError, }: ClipDownloadButtonProps): react.JSX.Element;
|
|
1644
1738
|
|
|
1645
|
-
export { AbortedError, BadRequestError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipKind, ClipPlayer, type ClipPlayerProps, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_PLAYLIST_POLL_SLACK_MS, DataChannelChunkingRequiredError, DecodeError, DisconnectedError, type DownloadClipOptions, type FetchPlaylistOptions, FileRef, type GenerationMode, GenerationModeMismatchError, InvalidStateError, type JwtRequestContext, type JwtResolver, type JwtSource, type MessageScope, MessageTooLargeError, type ModelSchema, type ModelSchemaOperation, type ModelSchemaPathItem, type ModerationAction, type ModerationEvent, NetworkError, NotFoundError, type PublishedTrack, type PushAudioFrame, type PushFrame, type PushFrameOptions, type PushVideoFrame, RateLimitedError, Reactor, type ReactorActions, type ReactorConnectOptions, ReactorError, type ReactorEventMap, type ReactorEventName, type ReactorMessage, type ReactorOptions, ReactorProvider, type ReactorProviderProps, type ReactorState, type ReactorStatus, type ReactorStore, ReactorView, type ReactorViewProps, RecorderDisabledError, RecordingError, RequestTimeoutError, ServerError, type SessionResponse, SessionTerminalError, type StepCommand, StepCommandFailedError, type StepFile, type StepFrame, StepNotReadyError, type StepOptions, StepRefusedError, type StepResult, StepResultTooLargeError, StepSessionEndedError, type StepTrack, type TrackCapability, type TrackDirection, type TrackKind, type TrackMappingEntry, TransportError, UnauthorizedError, UnsupportedFrameEncodingError, type UseClipDownloadOptions, type UseClipDownloadResult, VersionMismatchError, WebcamStream, type WebcamStreamProps, createPlayableManifestUrl, downloadClipAsFile, fetchPlaylist, isFileRef, normalizeJwtSource, parsePlaylist, stepFrameToImageData, useClipDownload, useReactor, useReactorInternalMessage, useReactorMessage, useStats };
|
|
1739
|
+
export { AbortedError, BadRequestError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipKind, ClipPlayer, type ClipPlayerProps, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_PLAYLIST_POLL_SLACK_MS, DataChannelChunkingRequiredError, DecodeError, DisconnectedError, type DownloadClipOptions, type EncodedFrame, type EncodedVideoCodec, type FetchPlaylistOptions, FileRef, type GenerationMode, GenerationModeMismatchError, InvalidStateError, type JwtRequestContext, type JwtResolver, type JwtSource, type MessageScope, MessageTooLargeError, type ModelSchema, type ModelSchemaOperation, type ModelSchemaPathItem, type ModerationAction, type ModerationEvent, NetworkError, NotFoundError, type PublishedTrack, type PushAudioFrame, type PushFrame, type PushFrameOptions, type PushVideoFrame, RateLimitedError, Reactor, type ReactorActions, type ReactorConnectOptions, ReactorError, type ReactorEventMap, type ReactorEventName, type ReactorMessage, type ReactorOptions, ReactorProvider, type ReactorProviderProps, type ReactorState, type ReactorStatus, type ReactorStore, ReactorView, type ReactorViewProps, RecorderDisabledError, RecordingError, RequestTimeoutError, ServerError, type SessionResponse, SessionTerminalError, type StepCommand, StepCommandFailedError, type StepFile, type StepFrame, StepNotReadyError, type StepOptions, StepRefusedError, type StepResult, StepResultTooLargeError, StepSessionEndedError, type StepTrack, type TrackCapability, type TrackDirection, type TrackKind, type TrackMappingEntry, TransportError, UnauthorizedError, UnsupportedFrameEncodingError, type UseClipDownloadOptions, type UseClipDownloadResult, VersionMismatchError, WebcamStream, type WebcamStreamProps, createPlayableManifestUrl, downloadClipAsFile, fetchPlaylist, isFileRef, normalizeJwtSource, parsePlaylist, stepFrameToImageData, useClipDownload, useReactor, useReactorInternalMessage, useReactorMessage, useStats };
|
package/dist/index.d.ts
CHANGED
|
@@ -258,6 +258,8 @@ type TrackDirection = 'recvonly' | 'sendonly';
|
|
|
258
258
|
type GenerationMode = 'streamed' | 'stepped';
|
|
259
259
|
/** Byte layout of a frame given to `pushVideoFrame`. */
|
|
260
260
|
type PixelFormat = 'rgba' | 'rgb' | 'bgra';
|
|
261
|
+
/** Codec of an encoded frame given to `pushEncodedVideoFrame`. */
|
|
262
|
+
type EncodedVideoCodec = 'h264';
|
|
261
263
|
interface ClientOptions {
|
|
262
264
|
modelName: string;
|
|
263
265
|
apiUrl?: string;
|
|
@@ -281,6 +283,9 @@ interface ClientOptions {
|
|
|
281
283
|
/** How long `step()` waits for a step's result, generation included.
|
|
282
284
|
* Default 300000. */
|
|
283
285
|
stepTimeoutMs?: number;
|
|
286
|
+
/** The largest data-channel message, in bytes, the client declares and
|
|
287
|
+
* accepts: 262144 (256 KiB) to 1073741824 (1 GiB). Default 64 MiB. */
|
|
288
|
+
maxMessageSize?: number;
|
|
284
289
|
logLevel?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace';
|
|
285
290
|
}
|
|
286
291
|
interface ConnectOptions {
|
|
@@ -410,6 +415,38 @@ interface StepOptions {
|
|
|
410
415
|
state?: Record<string, unknown>;
|
|
411
416
|
/** Commands to run after the state, in order. */
|
|
412
417
|
commands?: StepCommand[];
|
|
418
|
+
/** This step's own frames, by input track name: what `pushFrame()` takes,
|
|
419
|
+
* or an `EncodedFrame`. They go after the frames pushed to that track
|
|
420
|
+
* since the previous step, exactly as if pushed just before the step, so
|
|
421
|
+
* each track must be published first. A bad track or frame anywhere fails
|
|
422
|
+
* the step before any of them is pushed, leaving the buffer as it was. */
|
|
423
|
+
media?: Record<string, ReadonlyArray<PushFrame | EncodedFrame>>;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* An encoded video frame for a step: one H.264 access unit (Annex B), its
|
|
427
|
+
* bytes sent as they are. `width` and `height` are the frame it decodes to.
|
|
428
|
+
*
|
|
429
|
+
* The runtime decodes a track's encoded frames of one step as one stream,
|
|
430
|
+
* before the step runs, and the model reads the RGB frames as if they had
|
|
431
|
+
* been pushed raw. So give them in decode order, starting at a keyframe.
|
|
432
|
+
*
|
|
433
|
+
* `data` may be a WebCodecs `EncodedVideoChunk` as a `VideoEncoder` hands it
|
|
434
|
+
* over; configure the encoder with `avc: { format: 'annexb' }`, as its
|
|
435
|
+
* default (`"avc"`) is length-prefixed, not Annex B.
|
|
436
|
+
*/
|
|
437
|
+
interface EncodedFrame {
|
|
438
|
+
/** Tells an encoded frame from a raw one in `step()`'s `media`. */
|
|
439
|
+
codec: EncodedVideoCodec;
|
|
440
|
+
/** One access unit. A chunk's bytes are copied out when it is pushed. */
|
|
441
|
+
data: Uint8Array | ArrayBuffer | EncodedVideoChunk;
|
|
442
|
+
/** Width of the frame it decodes to. */
|
|
443
|
+
width: number;
|
|
444
|
+
/** Height of the frame it decodes to. */
|
|
445
|
+
height: number;
|
|
446
|
+
/** Opaque bytes the decoded frame carries to the model. */
|
|
447
|
+
metadata?: Uint8Array;
|
|
448
|
+
/** When the frame was captured, in microseconds. */
|
|
449
|
+
captureTimeUs?: number;
|
|
413
450
|
}
|
|
414
451
|
/** Raw pixels for `Reactor.pushFrame()`. `ImageData` is one of these as is. */
|
|
415
452
|
interface RawVideoFrame {
|
|
@@ -442,6 +479,9 @@ interface PublishedTrack {
|
|
|
442
479
|
* track is unpublished or its connection ends: publish again for a new
|
|
443
480
|
* handle. */
|
|
444
481
|
pushFrame(frame: PushFrame, options?: PushFrameOptions): Promise<void>;
|
|
482
|
+
/** Buffers one encoded video frame on this track for the next `step()` —
|
|
483
|
+
* `reactor.pushEncodedFrame(name, frame)`. Rejects as `pushFrame()` does. */
|
|
484
|
+
pushEncodedFrame(frame: EncodedFrame): Promise<void>;
|
|
445
485
|
}
|
|
446
486
|
/** Per-frame extras for a pushed video frame. */
|
|
447
487
|
interface PushFrameOptions {
|
|
@@ -826,9 +866,10 @@ declare class Reactor implements Disposable {
|
|
|
826
866
|
* is finalized on "ready" — see `handleStatusChanged()`. */
|
|
827
867
|
private connectStartTime;
|
|
828
868
|
private waitingStartTime;
|
|
829
|
-
/** The tail of every `pushFrame()` so far, settled
|
|
830
|
-
* reach the binding in call order however long each
|
|
831
|
-
* read, and `step()` waits for the ones called
|
|
869
|
+
/** The tail of every `pushFrame()`/`pushEncodedFrame()` so far, settled
|
|
870
|
+
* either way — pushes reach the binding in call order however long each
|
|
871
|
+
* one's pixels take to read, and `step()` waits for the ones called
|
|
872
|
+
* before it. */
|
|
832
873
|
private pendingPushes;
|
|
833
874
|
private readonly emitter;
|
|
834
875
|
/** Serializes connect()/reconnect()/disconnect() (and the free() inside
|
|
@@ -1092,6 +1133,20 @@ declare class Reactor implements Disposable {
|
|
|
1092
1133
|
* when its request cannot be sent, they are dropped with it rather than
|
|
1093
1134
|
* kept for the next step.
|
|
1094
1135
|
*
|
|
1136
|
+
* `media` gives the step frames of its own, by input track name, pushed
|
|
1137
|
+
* after the ones already pushed to that track: what `pushFrame()` takes,
|
|
1138
|
+
* or an `EncodedFrame` — H.264 the runtime decodes before the step runs,
|
|
1139
|
+
* so the model reads RGB frames as for a raw push. They are pushed only
|
|
1140
|
+
* once `state` and `commands` are well formed and the session is ready, so
|
|
1141
|
+
* a step refused for those leaves the frames buffered as they were. They go
|
|
1142
|
+
* all or nothing: a bad track or frame anywhere in `media` rejects the step
|
|
1143
|
+
* before any of it is pushed or sent, leaving the buffer as it was. A
|
|
1144
|
+
* session that leaves 'ready' once the media is in has the step refused and
|
|
1145
|
+
* keeps the frames for the next one, as pushed frames are.
|
|
1146
|
+
* A track's encoded frames of one step go in decode order, starting at a
|
|
1147
|
+
* keyframe; a step whose frames do not decode rejects with a
|
|
1148
|
+
* `StepRefusedError`.
|
|
1149
|
+
*
|
|
1095
1150
|
* ```ts
|
|
1096
1151
|
* const camera = await reactor.publishTrack('camera');
|
|
1097
1152
|
* await camera.pushFrame(imageData);
|
|
@@ -1132,6 +1187,45 @@ declare class Reactor implements Disposable {
|
|
|
1132
1187
|
/** `pushFrame()`, for the track's current publication or, from a
|
|
1133
1188
|
* `PublishedTrack`, only for the `publication` it came from. */
|
|
1134
1189
|
private pushTo;
|
|
1190
|
+
/**
|
|
1191
|
+
* Buffers one encoded video frame for the next `step()` on the sendonly
|
|
1192
|
+
* video track `trackName`, its bytes as they are: one H.264 access unit
|
|
1193
|
+
* (Annex B), with the `width` and `height` it decodes to. The
|
|
1194
|
+
* `PublishedTrack` that `publishTrack()` resolves with does the same
|
|
1195
|
+
* through `track.pushEncodedFrame(frame)`.
|
|
1196
|
+
*
|
|
1197
|
+
* The runtime decodes a track's encoded frames of one step as one stream,
|
|
1198
|
+
* before the step runs, and the model reads the RGB frames as if they had
|
|
1199
|
+
* been pushed raw. So push them in decode order, starting at a keyframe; a
|
|
1200
|
+
* step whose frames do not decode rejects with a `StepRefusedError`, as
|
|
1201
|
+
* does a runtime that predates encoded frames. Encoded and raw pushes keep
|
|
1202
|
+
* their call order, and a `step()` waits for every push called before it.
|
|
1203
|
+
*
|
|
1204
|
+
* ```ts
|
|
1205
|
+
* const encoder = new VideoEncoder({
|
|
1206
|
+
* output: (chunk) => void camera.pushEncodedFrame({ codec: 'h264', data: chunk, width, height }),
|
|
1207
|
+
* error: console.error,
|
|
1208
|
+
* });
|
|
1209
|
+
* encoder.configure({ codec: 'avc1.42001f', width, height, avc: { format: 'annexb' } });
|
|
1210
|
+
* ```
|
|
1211
|
+
*
|
|
1212
|
+
* Rejects with an `InvalidStateError` outside a stepped session, for a
|
|
1213
|
+
* track not published on this connection, for an audio or recvonly track,
|
|
1214
|
+
* for empty data, a zero dimension or a codec other than `"h264"`.
|
|
1215
|
+
*/
|
|
1216
|
+
pushEncodedFrame(trackName: string, frame: EncodedFrame): Promise<void>;
|
|
1217
|
+
/** `pushEncodedFrame()`, for the track's current publication or, from a
|
|
1218
|
+
* `PublishedTrack`, only for the `publication` it came from. */
|
|
1219
|
+
private pushEncodedTo;
|
|
1220
|
+
/** Refuses a push whose connection ended since it was called, or whose
|
|
1221
|
+
* track is not (or no longer) published on it. */
|
|
1222
|
+
private checkPushTarget;
|
|
1223
|
+
/** Pushes `step()`'s `media`, track by track and in order, each frame as
|
|
1224
|
+
* `pushFrame()` or `pushEncodedFrame()` would. All or nothing: the binding
|
|
1225
|
+
* checks the step's `state` and `commands`, then every frame, before the
|
|
1226
|
+
* first is pushed, so a refused step, or a bad track or frame anywhere,
|
|
1227
|
+
* leaves the buffer as it was. */
|
|
1228
|
+
private pushStepMedia;
|
|
1135
1229
|
/** Drops every frame buffered for the next step, pushes called before it
|
|
1136
1230
|
* included: it waits its turn behind them, as a `step()` does. */
|
|
1137
1231
|
clearStepInputs(): Promise<void>;
|
|
@@ -1642,4 +1736,4 @@ interface ClipDownloadButtonProps {
|
|
|
1642
1736
|
}
|
|
1643
1737
|
declare function ClipDownloadButton({ clip, getJwt, filename, children, className, style, disabled, onSuccess, onError, }: ClipDownloadButtonProps): react.JSX.Element;
|
|
1644
1738
|
|
|
1645
|
-
export { AbortedError, BadRequestError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipKind, ClipPlayer, type ClipPlayerProps, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_PLAYLIST_POLL_SLACK_MS, DataChannelChunkingRequiredError, DecodeError, DisconnectedError, type DownloadClipOptions, type FetchPlaylistOptions, FileRef, type GenerationMode, GenerationModeMismatchError, InvalidStateError, type JwtRequestContext, type JwtResolver, type JwtSource, type MessageScope, MessageTooLargeError, type ModelSchema, type ModelSchemaOperation, type ModelSchemaPathItem, type ModerationAction, type ModerationEvent, NetworkError, NotFoundError, type PublishedTrack, type PushAudioFrame, type PushFrame, type PushFrameOptions, type PushVideoFrame, RateLimitedError, Reactor, type ReactorActions, type ReactorConnectOptions, ReactorError, type ReactorEventMap, type ReactorEventName, type ReactorMessage, type ReactorOptions, ReactorProvider, type ReactorProviderProps, type ReactorState, type ReactorStatus, type ReactorStore, ReactorView, type ReactorViewProps, RecorderDisabledError, RecordingError, RequestTimeoutError, ServerError, type SessionResponse, SessionTerminalError, type StepCommand, StepCommandFailedError, type StepFile, type StepFrame, StepNotReadyError, type StepOptions, StepRefusedError, type StepResult, StepResultTooLargeError, StepSessionEndedError, type StepTrack, type TrackCapability, type TrackDirection, type TrackKind, type TrackMappingEntry, TransportError, UnauthorizedError, UnsupportedFrameEncodingError, type UseClipDownloadOptions, type UseClipDownloadResult, VersionMismatchError, WebcamStream, type WebcamStreamProps, createPlayableManifestUrl, downloadClipAsFile, fetchPlaylist, isFileRef, normalizeJwtSource, parsePlaylist, stepFrameToImageData, useClipDownload, useReactor, useReactorInternalMessage, useReactorMessage, useStats };
|
|
1739
|
+
export { AbortedError, BadRequestError, type Capabilities, type Clip, ClipDownloadButton, type ClipDownloadButtonProps, type ClipDownloadState, type ClipKind, ClipPlayer, type ClipPlayerProps, type CommandCapability, ConflictError, type ConnectOptions, type ConnectionStats, type ConnectionTimings, DEFAULT_PLAYLIST_POLL_SLACK_MS, DataChannelChunkingRequiredError, DecodeError, DisconnectedError, type DownloadClipOptions, type EncodedFrame, type EncodedVideoCodec, type FetchPlaylistOptions, FileRef, type GenerationMode, GenerationModeMismatchError, InvalidStateError, type JwtRequestContext, type JwtResolver, type JwtSource, type MessageScope, MessageTooLargeError, type ModelSchema, type ModelSchemaOperation, type ModelSchemaPathItem, type ModerationAction, type ModerationEvent, NetworkError, NotFoundError, type PublishedTrack, type PushAudioFrame, type PushFrame, type PushFrameOptions, type PushVideoFrame, RateLimitedError, Reactor, type ReactorActions, type ReactorConnectOptions, ReactorError, type ReactorEventMap, type ReactorEventName, type ReactorMessage, type ReactorOptions, ReactorProvider, type ReactorProviderProps, type ReactorState, type ReactorStatus, type ReactorStore, ReactorView, type ReactorViewProps, RecorderDisabledError, RecordingError, RequestTimeoutError, ServerError, type SessionResponse, SessionTerminalError, type StepCommand, StepCommandFailedError, type StepFile, type StepFrame, StepNotReadyError, type StepOptions, StepRefusedError, type StepResult, StepResultTooLargeError, StepSessionEndedError, type StepTrack, type TrackCapability, type TrackDirection, type TrackKind, type TrackMappingEntry, TransportError, UnauthorizedError, UnsupportedFrameEncodingError, type UseClipDownloadOptions, type UseClipDownloadResult, VersionMismatchError, WebcamStream, type WebcamStreamProps, createPlayableManifestUrl, downloadClipAsFile, fetchPlaylist, isFileRef, normalizeJwtSource, parsePlaylist, stepFrameToImageData, useClipDownload, useReactor, useReactorInternalMessage, useReactorMessage, useStats };
|