@viji-dev/core 0.11.4 → 0.11.6

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/dist/index.d.ts CHANGED
@@ -239,6 +239,16 @@ declare interface AudioStreamAPI {
239
239
  export declare class AudioSystem {
240
240
  private audioContext;
241
241
  private workletRegistered;
242
+ /**
243
+ * Persistent export capture tap (main channel only). Created lazily by
244
+ * `getAudioCaptureStream()`, lives for the AudioSystem lifetime, and is
245
+ * torn down only in `resetAudioState()`. Deliberately NOT severed by
246
+ * `disconnectMainStream()`: on mid-recording disconnect the tap stream
247
+ * goes silent while its tracks stay live, and `connectChannel()` re-wires
248
+ * each new main source node into it, so the exposed MediaStream stays
249
+ * stable across `setAudioStream()` swaps (a recorder never renegotiates).
250
+ */
251
+ private captureDestination;
242
252
  private mainChannel;
243
253
  private additionalChannels;
244
254
  private analysisInterval;
@@ -372,6 +382,18 @@ export declare class AudioSystem {
372
382
  flatness: number;
373
383
  };
374
384
  };
385
+ /**
386
+ * Get a recordable MediaStream carrying the main channel's audio, for
387
+ * host-side export recording. Main channel only — additional channels and
388
+ * source-fed device channels (analysis values, no PCM) are not included.
389
+ *
390
+ * The underlying destination node is created lazily on first call and then
391
+ * persists for the AudioSystem lifetime: on a source swap the stream keeps
392
+ * flowing with the new audio, and on disconnect it goes silent with tracks
393
+ * still live. Returns `null` when the main channel is not connected at
394
+ * call time (or after teardown).
395
+ */
396
+ getAudioCaptureStream(): MediaStream | null;
375
397
  /**
376
398
  * Initialize Essentia.js (async WASM loading)
377
399
  */
@@ -894,6 +916,13 @@ export declare interface CaptureFrameOptions {
894
916
  format?: 'blob' | 'bitmap';
895
917
  /** MIME type for `'blob'` output (ignored for `'bitmap'`). Examples: `'image/png'`, `'image/jpeg'`, `'image/webp'`. */
896
918
  type?: string;
919
+ /**
920
+ * Encoding quality for lossy `'blob'` formats (`'image/jpeg'`, `'image/webp'`),
921
+ * from `0` (smallest) to `1` (best). Values outside the range are clamped.
922
+ * Ignored for `'image/png'` and for `format: 'bitmap'`. When omitted, the
923
+ * browser's default quality is used.
924
+ */
925
+ quality?: number;
897
926
  /**
898
927
  * Target resolution.
899
928
  * - `number`: scale factor relative to the current canvas size (e.g., `0.5` = 50%).
@@ -2832,7 +2861,7 @@ declare type TrackingState = 'TRACKING' | 'LOCKED' | 'BREAKDOWN' | 'LOST';
2832
2861
  /** Returned by `on*` listener registration calls; invoke to unsubscribe. */
2833
2862
  export declare type Unsubscribe = () => void;
2834
2863
 
2835
- export declare const VERSION = "0.11.4";
2864
+ export declare const VERSION = "0.11.6";
2836
2865
 
2837
2866
  /**
2838
2867
  * Real-time video API: drawable frame, dimensions, and the source-side
@@ -3019,13 +3048,13 @@ export declare interface VideoCVAPI {
3019
3048
  }
3020
3049
 
3021
3050
  /**
3022
- * Video stream categorization type
3023
- * - main: Primary video with CV processing (viji.video)
3024
- * - additional: Host-provided MediaStreams without CV (viji.videoStreams[])
3025
- * - directFrame: Injected frames from compositor pipeline (viji.videoStreams[], after additional)
3026
- * - device: Device-provided camera streams (device.video)
3051
+ * Video stream role, derived from position in the index contract.
3052
+ * - main: primary video with CV (`viji.video`)
3053
+ * - additional: host-provided MediaStreams, no CV (`viji.videoStreams[]`)
3054
+ * - device: device camera streams (`viji.devices[].video`)
3055
+ * - directFrame: injected compositor frames (`viji.videoStreams[]`, after additional)
3027
3056
  */
3028
- export declare type VideoStreamType = 'main' | 'additional' | 'directFrame' | 'device';
3057
+ export declare type VideoStreamType = 'main' | 'additional' | 'device' | 'directFrame';
3029
3058
 
3030
3059
  /**
3031
3060
  * The Viji API surface available to artist code as the global `viji` object.
@@ -3735,6 +3764,36 @@ export declare class VijiCore {
3735
3764
  * sharing this core's media engines)
3736
3765
  */
3737
3766
  getAudioStream(): MediaStream | null;
3767
+ /**
3768
+ * Gets a recordable MediaStream carrying the main audio channel's signal,
3769
+ * for client-side export recording (e.g. feeding a WebCodecs
3770
+ * `AudioEncoder` or `MediaRecorder` while capturing scene video).
3771
+ *
3772
+ * The returned stream is stable across `setAudioStream()` swaps: obtain it
3773
+ * once at record start and keep recording — a source change flows into the
3774
+ * same stream with no renegotiation. If audio is disconnected
3775
+ * mid-recording the stream goes **silent** (tracks stay live, the A/V
3776
+ * timeline stays continuous); its tracks end only when the media engines
3777
+ * are disposed (last core sharing them destroyed).
3778
+ *
3779
+ * Scope: main channel only. Additional audio channels and remote-device
3780
+ * audio (analysis values only, no PCM host-side) are not included.
3781
+ * Engine-scoped — identical for all cores sharing this core's media
3782
+ * engines, like {@link getAudioStream}.
3783
+ *
3784
+ * @returns The capture stream, or `null` when no main audio is connected
3785
+ * at call time.
3786
+ *
3787
+ * @example
3788
+ * ```ts
3789
+ * const audioTap = core.getAudioCaptureStream();
3790
+ * if (audioTap) {
3791
+ * const [track] = audioTap.getAudioTracks();
3792
+ * // feed track into MediaStreamTrackProcessor → AudioEncoder
3793
+ * }
3794
+ * ```
3795
+ */
3796
+ getAudioCaptureStream(): MediaStream | null;
3738
3797
  /**
3739
3798
  * Enables or disables user interactions (mouse, keyboard, touch) at runtime
3740
3799
  */
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, C as i, I as r, V as o, a as C, c as E, b as A } from "./index-LgAeJ6JG.js";
1
+ import { A as e, C as i, I as r, V as o, a as C, c as E, b as A } from "./index-BKvsDqj0.js";
2
2
  export {
3
3
  e as AudioSystem,
4
4
  i as CV_FEATURE_KEYS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viji-dev/core",
3
- "version": "0.11.4",
3
+ "version": "0.11.6",
4
4
  "description": "Universal execution engine for Viji Creative scenes",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",