@vanillaskyai/video 0.10.23 → 0.11.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/CHANGELOG.md +69 -0
- package/PUBLIC-API.md +47 -438
- package/README.md +53 -97
- package/dist/builtin-metadata-OT6V7TB4.js +8 -0
- package/dist/{chapter-title-2JVDU62E.js → chapter-title-2RCXX7SN.js} +1 -2
- package/dist/{chunk-5BSJLT6H.js → chunk-2WIETEL7.js} +16 -29
- package/dist/{chunk-3O7OMMMF.js → chunk-35K6IKB2.js} +3 -3
- package/dist/{chunk-PDQFQIQW.js → chunk-3EQ6PVWL.js} +1 -1
- package/dist/chunk-4G4JBMCM.js +37 -0
- package/dist/{chunk-7AA2JWHZ.js → chunk-5DOQTIMD.js} +6 -6
- package/dist/chunk-666HGTVZ.js +41 -0
- package/dist/{chunk-7M56IUUX.js → chunk-6Z3ID54H.js} +0 -18
- package/dist/chunk-AUN4S3YW.js +50 -0
- package/dist/chunk-HIQM4J3U.js +30 -0
- package/dist/chunk-ISWQ6T5X.js +36 -0
- package/dist/{chunk-224QNWRA.js → chunk-K5J7ESRO.js} +1 -10
- package/dist/chunk-NM4CXXZY.js +25 -0
- package/dist/{chunk-44WND2VP.js → chunk-RFXHLLYU.js} +34 -62
- package/dist/{chunk-RXTN2CW6.js → chunk-Z3DLSLAJ.js} +1 -1
- package/dist/cinema-media-YZ2UANJG.js +365 -0
- package/dist/cli.js +154 -1748
- package/dist/{compose-video-BH5K6XWT.js → compose-video-RSLI4CVP.js} +4 -4
- package/dist/{events-B4YCc4vc.d.ts → events-BZAfl0Dm.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -6
- package/dist/preload-media-23JXUFCF.js +77 -0
- package/dist/react.d.ts +39 -15
- package/dist/react.js +1355 -740
- package/dist/scene-validation-SGLLLFY5.js +9 -0
- package/dist/server.d.ts +67 -117
- package/dist/server.js +296 -626
- package/dist/test.d.ts +2 -2
- package/dist/test.js +21 -21
- package/dist/{text-stream-LD364KBI.js → text-stream-SOVLYR2L.js} +2 -2
- package/dist/{types-BqB8zC9u.d.ts → types-CG-kPI81.d.ts} +3 -1
- package/dist/{types-DdZw4GRQ.d.ts → types-ht-Zw3Wv.d.ts} +1 -1
- package/docs/agent-integration.md +19 -64
- package/docs/architecture.md +80 -106
- package/docs/customization.md +49 -66
- package/docs/development.md +18 -17
- package/docs/errors.md +4 -4
- package/docs/getting-started.md +74 -93
- package/docs/media-and-audio.md +9 -7
- package/docs/performance.md +11 -6
- package/docs/persistence.md +3 -7
- package/docs/production.md +4 -15
- package/docs/prompt-and-input.md +1 -2
- package/docs/provider-integration.md +156 -181
- package/docs/reference/protocol.md +5 -14
- package/docs/reference/provider-adapters.md +21 -13
- package/docs/security.md +1 -14
- package/docs/testing.md +56 -123
- package/package.json +4 -25
- package/starters/video-chat/.env.example +12 -4
- package/starters/video-chat/.env.native.example +13 -0
- package/starters/video-chat/README.md +72 -11
- package/starters/video-chat/package.json +1 -1
- package/starters/video-chat/providers/text-native.ts +94 -0
- package/starters/video-chat/providers/text.ts +19 -0
- package/starters/video-chat/providers/transcription.ts +32 -0
- package/starters/video-chat/providers/video-custom.ts +45 -0
- package/starters/video-chat/providers/video-delivery.ts +57 -0
- package/starters/video-chat/providers/video-google.ts +48 -0
- package/starters/video-chat/providers/video-job.ts +103 -0
- package/starters/video-chat/providers/video-runway.ts +45 -0
- package/starters/video-chat/providers/video.ts +39 -63
- package/starters/video-chat/server.ts +3 -29
- package/starters/video-chat/vite.config.ts +2 -8
- package/styles/video-chat.css +8 -105
- package/dist/builtin-server-W4PLJUZ5.js +0 -8
- package/dist/catalog-types-WTbLP6Jh.d.ts +0 -78
- package/dist/check-runtime.d.ts +0 -15
- package/dist/check-runtime.js +0 -96
- package/dist/chunk-2E6T633S.js +0 -27
- package/dist/chunk-4YM2M62S.js +0 -13
- package/dist/chunk-4ZJLPHBV.js +0 -684
- package/dist/chunk-5JBMYQP6.js +0 -156
- package/dist/chunk-73NTSFFI.js +0 -81
- package/dist/chunk-EGVQODKU.js +0 -83
- package/dist/chunk-HFVNAPHZ.js +0 -35
- package/dist/chunk-IIN5M5HW.js +0 -697
- package/dist/chunk-IQMYK5DX.js +0 -133
- package/dist/chunk-IR44XKBI.js +0 -46
- package/dist/chunk-JKVOBTRO.js +0 -145
- package/dist/chunk-LVM5Q2DL.js +0 -68
- package/dist/chunk-M4QTEJTK.js +0 -709
- package/dist/chunk-QSBDB4J2.js +0 -16
- package/dist/chunk-R3XAOMKP.js +0 -29
- package/dist/chunk-SPVTJH3F.js +0 -24
- package/dist/chunk-YAHT3LST.js +0 -663
- package/dist/chunk-ZD2VTUYR.js +0 -28
- package/dist/cinema-media-HYCDG65Z.js +0 -11
- package/dist/comparison-XXAP4S4J.js +0 -36
- package/dist/editorial-timeline-VUQC6KPA.js +0 -42
- package/dist/key-figure-4TJK7HLT.js +0 -29
- package/dist/kit-DrRpdn0p.d.ts +0 -79
- package/dist/mobile-message-FIHAO6XC.js +0 -49
- package/dist/preload-media-LJXWKTWG.js +0 -57
- package/dist/quote-GRPIYKQJ.js +0 -32
- package/dist/system-prompt-AG26KJAA.js +0 -12
- package/dist/template-catalog.d.ts +0 -400
- package/dist/template-catalog.js +0 -6
- package/dist/templates.d.ts +0 -25
- package/dist/templates.js +0 -102
- package/dist/validate-4OUD2CLX.js +0 -10
- package/docs/concepts.md +0 -107
- package/docs/custom-templates.md +0 -346
- package/docs/immersive-interface.md +0 -86
- package/docs/motion-and-effects.md +0 -109
- package/docs/reference/design-system.html +0 -125
- package/docs/responsive-orientation.md +0 -37
- package/docs/streaming-protocol.md +0 -15
- package/examples/custom-template/README.md +0 -19
- package/examples/custom-template/minimal-text.tsx +0 -82
- package/examples/custom-template/structured-data.tsx +0 -104
- package/registry/items/backgrounds.json +0 -70
- package/registry/items/chapterTitle.json +0 -80
- package/registry/items/cinemaMedia.json +0 -136
- package/registry/items/comparison.json +0 -168
- package/registry/items/editorialTimeline.json +0 -172
- package/registry/items/keyFigure.json +0 -162
- package/registry/items/mobileMessage.json +0 -153
- package/registry/items/motion.json +0 -45
- package/registry/items/quote.json +0 -161
- package/registry/items/template-context.json +0 -31
- package/registry/items/theme.json +0 -47
- package/registry/items/typography.json +0 -47
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createVideo
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2WIETEL7.js";
|
|
4
|
+
import "./chunk-Z3DLSLAJ.js";
|
|
5
|
+
import "./chunk-35K6IKB2.js";
|
|
4
6
|
import "./chunk-E7CL7UPB.js";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-7M56IUUX.js";
|
|
7
|
+
import "./chunk-6Z3ID54H.js";
|
|
7
8
|
import "./chunk-AUPC6MDK.js";
|
|
8
9
|
import "./chunk-7NZOMTAL.js";
|
|
9
|
-
import "./chunk-3O7OMMMF.js";
|
|
10
10
|
export {
|
|
11
11
|
createVideo
|
|
12
12
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as VideoOrientation, a as VideoStyle, b as Video, c as VideoCapabilities, d as VideoAudio, e as VideoScene, f as VIDEO_PROTOCOL_VERSION } from './types-ht-Zw3Wv.js';
|
|
2
2
|
|
|
3
3
|
type VideoWarningCategory = "validation" | "readability" | "grounding" | "provider" | "media" | "protocol";
|
|
4
4
|
type VideoWarningCode = "scene_duration_adjusted" | "scene_omitted_unreadable" | "scene_omitted_for_closer" | "scene_variable_clipped" | "chart_scale_imbalance" | "plan_incomplete" | "plan_missing_closer" | "provider_warning" | "provider_diagnostics_unavailable" | "media_budget_reached";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { d as VideoAudio, h as VideoNarrationGroup,
|
|
1
|
+
import { b as Video, e as VideoScene, g as VideoTemplatePacing } from './types-ht-Zw3Wv.js';
|
|
2
|
+
export { d as VideoAudio, h as VideoNarrationGroup, V as VideoOrientation, a as VideoStyle, i as VideoStyleOptions } from './types-ht-Zw3Wv.js';
|
|
3
3
|
|
|
4
4
|
type VideoStatus = "idle" | "streaming" | "complete" | "error" | "aborted";
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSceneDuration,
|
|
3
3
|
getSceneDurationBounds,
|
|
4
|
-
getSpokenDuration
|
|
5
|
-
|
|
4
|
+
getSpokenDuration,
|
|
5
|
+
getVideoDuration
|
|
6
|
+
} from "./chunk-AUN4S3YW.js";
|
|
7
|
+
import "./chunk-35K6IKB2.js";
|
|
6
8
|
import {
|
|
7
9
|
VideoValidationError,
|
|
8
10
|
parseVideo
|
|
9
11
|
} from "./chunk-AUPC6MDK.js";
|
|
10
12
|
import "./chunk-7NZOMTAL.js";
|
|
11
|
-
import "./chunk-3O7OMMMF.js";
|
|
12
|
-
import {
|
|
13
|
-
getVideoDuration
|
|
14
|
-
} from "./chunk-SPVTJH3F.js";
|
|
15
13
|
export {
|
|
16
14
|
VideoValidationError,
|
|
17
15
|
getSceneDuration,
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveMediaType
|
|
3
|
+
} from "./chunk-K5J7ESRO.js";
|
|
4
|
+
import {
|
|
5
|
+
withDeadline
|
|
6
|
+
} from "./chunk-4G4JBMCM.js";
|
|
7
|
+
|
|
8
|
+
// src/player/preload-media.ts
|
|
9
|
+
var MAX_QUEUED_URLS = 64;
|
|
10
|
+
var MAX_REMEMBERED_URLS = 64;
|
|
11
|
+
var MAX_WARM_BYTES = 32 * 1024 * 1024;
|
|
12
|
+
var warmed = /* @__PURE__ */ new Set();
|
|
13
|
+
var pending = /* @__PURE__ */ new Map();
|
|
14
|
+
var queue = [];
|
|
15
|
+
var running = false;
|
|
16
|
+
function pump() {
|
|
17
|
+
if (running) return;
|
|
18
|
+
const job = queue.shift();
|
|
19
|
+
if (!job) return;
|
|
20
|
+
if (job.signal?.aborted) {
|
|
21
|
+
pending.delete(job.url);
|
|
22
|
+
job.done();
|
|
23
|
+
pump();
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
running = true;
|
|
27
|
+
void withDeadline(async (signal) => {
|
|
28
|
+
const response = await fetch(job.url, { signal, cache: "force-cache" });
|
|
29
|
+
if (!response.ok) throw new Error("Media warm failed");
|
|
30
|
+
const reader = response.body?.getReader();
|
|
31
|
+
if (reader) {
|
|
32
|
+
let bytes = 0;
|
|
33
|
+
try {
|
|
34
|
+
while (true) {
|
|
35
|
+
const part = await reader.read();
|
|
36
|
+
if (part.done) break;
|
|
37
|
+
bytes += part.value.byteLength;
|
|
38
|
+
if (bytes > MAX_WARM_BYTES) throw new Error("Media warm exceeded its byte allowance");
|
|
39
|
+
}
|
|
40
|
+
} finally {
|
|
41
|
+
await reader.cancel().catch(() => void 0);
|
|
42
|
+
reader.releaseLock();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
warmed.add(job.url);
|
|
46
|
+
while (warmed.size > MAX_REMEMBERED_URLS) warmed.delete(warmed.values().next().value);
|
|
47
|
+
}, 8e3, job.signal).catch(() => void 0).finally(() => {
|
|
48
|
+
running = false;
|
|
49
|
+
pending.delete(job.url);
|
|
50
|
+
job.done();
|
|
51
|
+
pump();
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function warm(url, signal) {
|
|
55
|
+
if (!url || signal?.aborted || warmed.has(url)) return Promise.resolve();
|
|
56
|
+
const existing = pending.get(url);
|
|
57
|
+
if (existing) return existing;
|
|
58
|
+
if (queue.length >= MAX_QUEUED_URLS) return Promise.resolve();
|
|
59
|
+
let done;
|
|
60
|
+
const result = new Promise((resolve) => {
|
|
61
|
+
done = resolve;
|
|
62
|
+
});
|
|
63
|
+
pending.set(url, result);
|
|
64
|
+
queue.push({ url, signal, done });
|
|
65
|
+
pump();
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
async function preloadSceneMedia(variables, signal) {
|
|
69
|
+
if (typeof window === "undefined" || typeof fetch === "undefined") return;
|
|
70
|
+
const url = typeof variables.mediaUrl === "string" ? variables.mediaUrl.trim() : "";
|
|
71
|
+
if (!url || resolveMediaType(String(variables.mediaType || "auto"), url) === "gradient") return;
|
|
72
|
+
const poster = typeof variables.mediaPoster === "string" ? variables.mediaPoster.trim() : "";
|
|
73
|
+
await Promise.all([warm(poster, signal), warm(url, signal)]);
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
preloadSceneMedia
|
|
77
|
+
};
|
package/dist/react.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
3
|
-
import { b as VideoEvent } from './events-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { V as VideoChatMode, a as VideoChatAskOptions, b as VideoChatMedia, c as VideoChatSuggestion, d as VideoChatCapabilities, e as VideoChatWelcome } from './types-BqB8zC9u.js';
|
|
7
|
-
import './catalog-types-WTbLP6Jh.js';
|
|
3
|
+
import { b as VideoEvent } from './events-BZAfl0Dm.js';
|
|
4
|
+
import { V as VideoOrientation, e as VideoScene, b as Video, i as VideoStyleOptions } from './types-ht-Zw3Wv.js';
|
|
5
|
+
import { a as VideoChatMode, e as VideoChatAskOptions, f as VideoChatMedia, g as VideoChatSuggestion, c as VideoChatCapabilities, h as VideoChatWelcome } from './types-CG-kPI81.js';
|
|
8
6
|
|
|
9
7
|
type VideoPlaybackMode = "manual" | "muted-autoplay" | "autoplay-with-sound" | "autoplay-after-interaction";
|
|
10
8
|
|
|
@@ -12,6 +10,16 @@ interface NativeMediaAudioOptions {
|
|
|
12
10
|
/** Volume of the active scene video's embedded audio, from 0 to 1. */
|
|
13
11
|
volume?: number;
|
|
14
12
|
}
|
|
13
|
+
type PlaybackWaitReason = "scene-generation" | "speech" | "media-decoding";
|
|
14
|
+
type MediaPlaybackMetric = {
|
|
15
|
+
type: "media-playback";
|
|
16
|
+
clipDurationSec: number;
|
|
17
|
+
sceneDurationSec: number;
|
|
18
|
+
repeatCount: number;
|
|
19
|
+
} | {
|
|
20
|
+
type: "buffer";
|
|
21
|
+
bufferedSeconds: number;
|
|
22
|
+
};
|
|
15
23
|
interface VideoPlayerSharedProps {
|
|
16
24
|
/** High-level startup policy. When set, this overrides autoPlay and startMuted. */
|
|
17
25
|
playbackMode?: VideoPlaybackMode;
|
|
@@ -44,6 +52,8 @@ interface VideoPlayerSharedProps {
|
|
|
44
52
|
narrationReady?: () => boolean;
|
|
45
53
|
/** Active audio time: paragraph-relative for a narration group, scene-relative otherwise. Undefined resumes the normal clock. */
|
|
46
54
|
narrationTime?: (scene: VideoScene) => number | undefined;
|
|
55
|
+
/** Actual utterance completion when a voice has no audio clock. Pair with useNarration.isSpeaking. */
|
|
56
|
+
narrationActive?: (scene: VideoScene) => boolean;
|
|
47
57
|
/**
|
|
48
58
|
* Hold the playhead where it is, and release it again.
|
|
49
59
|
*
|
|
@@ -70,21 +80,21 @@ interface VideoPlayerSharedProps {
|
|
|
70
80
|
/** First actual mounted video frame; excludes graphics, posters and safe fallbacks. */
|
|
71
81
|
onMediaFramePresented?: () => unknown;
|
|
72
82
|
/** Stream playback has reached its available scenes; excludes initial waiting and deliberate pauses. */
|
|
73
|
-
onStallChange?: (stalled: boolean) => unknown;
|
|
83
|
+
onStallChange?: (stalled: boolean, reason?: PlaybackWaitReason) => unknown;
|
|
84
|
+
/** Opt-in local native-media diagnostics; contains no scene IDs, URLs, or content. */
|
|
85
|
+
onPlaybackMetric?: (metric: MediaPlaybackMetric) => unknown;
|
|
74
86
|
/** Fires when the scene under the playhead changes, including on a loop wrap. */
|
|
75
87
|
onSceneChange?: (scene: VideoScene, index: number) => void;
|
|
76
88
|
}
|
|
77
89
|
type VideoPlayerProps = VideoPlayerSharedProps & ({
|
|
78
90
|
video: Video;
|
|
79
91
|
stream?: never;
|
|
80
|
-
templates?: TemplateRegistry;
|
|
81
92
|
} | {
|
|
82
93
|
stream?: AsyncIterable<VideoEvent>;
|
|
83
94
|
video?: never;
|
|
84
|
-
templates?: TemplateRegistry;
|
|
85
95
|
});
|
|
86
96
|
|
|
87
|
-
declare function VideoPlayer({
|
|
97
|
+
declare function VideoPlayer({ stream, video, onPlaybackEnd, onComplete, onError, ...props }: VideoPlayerProps): ReactElement | null;
|
|
88
98
|
|
|
89
99
|
interface VideoErrorOptions {
|
|
90
100
|
code: string;
|
|
@@ -193,8 +203,6 @@ interface VideoChatTurn {
|
|
|
193
203
|
interface UseVideoChatOptions {
|
|
194
204
|
/** One provider-neutral route created with createVideoChatHandler. */
|
|
195
205
|
endpoint?: string | URL;
|
|
196
|
-
/** Customer-owned templates that replace built-ins and add new renderers. */
|
|
197
|
-
templates?: TemplateRegistry;
|
|
198
206
|
mode?: VideoChatMode;
|
|
199
207
|
orientation?: VideoOrientation;
|
|
200
208
|
style?: VideoStyleOptions;
|
|
@@ -225,8 +233,13 @@ type VideoChatPlaybackMetric = {
|
|
|
225
233
|
} | {
|
|
226
234
|
type: "stall";
|
|
227
235
|
durationMs: number;
|
|
228
|
-
reason:
|
|
229
|
-
}
|
|
236
|
+
reason: PlaybackWaitReason;
|
|
237
|
+
} | {
|
|
238
|
+
type: "scene-duration";
|
|
239
|
+
speechDurationSec: number;
|
|
240
|
+
clipDurationSec: number;
|
|
241
|
+
recovered: boolean;
|
|
242
|
+
} | MediaPlaybackMetric);
|
|
230
243
|
interface VideoChatFirstFrameMetric {
|
|
231
244
|
turnId: string;
|
|
232
245
|
mode: VideoChatMode;
|
|
@@ -266,16 +279,27 @@ interface UseVideoChatResult {
|
|
|
266
279
|
declare function useVideoChat(options?: UseVideoChatOptions): UseVideoChatResult;
|
|
267
280
|
|
|
268
281
|
interface VideoChatProps {
|
|
269
|
-
/** Connection,
|
|
282
|
+
/** Connection, voice, and rendering defaults for the session. */
|
|
270
283
|
options?: UseVideoChatOptions;
|
|
271
284
|
/** Added to the scoped component root for application layout and branding. */
|
|
272
285
|
className?: string;
|
|
273
286
|
/** Replaces the default two-line welcome heading without changing the interaction. */
|
|
274
287
|
welcomeTitle?: ReactNode;
|
|
288
|
+
/** Application identity only; does not change scenes, prompts or playback. */
|
|
289
|
+
branding?: {
|
|
290
|
+
/** Visible fallback when logo is omitted, and the home link's accessible name. */
|
|
291
|
+
name: string;
|
|
292
|
+
/** App-owned logo element. Give images/SVGs explicit dimensions. */
|
|
293
|
+
logo?: ReactNode;
|
|
294
|
+
/** HTTP(S) or root-relative destination. Omit to preserve the Home/reset shortcut. */
|
|
295
|
+
homeUrl?: string;
|
|
296
|
+
/** Keep the SDK's Docs/About/GitHub section in Settings. Defaults to true. */
|
|
297
|
+
showDeveloperLinks?: boolean;
|
|
298
|
+
};
|
|
275
299
|
/** Show a dismissible safe notice when generated visuals fall back. Defaults to false. */
|
|
276
300
|
showRecoveryNotice?: boolean;
|
|
277
301
|
}
|
|
278
302
|
/** A complete voice-and-video chat interface backed by createVideoChatHandler. */
|
|
279
|
-
declare function VideoChat({ options, className, welcomeTitle, showRecoveryNotice }: VideoChatProps): react.JSX.Element;
|
|
303
|
+
declare function VideoChat({ options, className, welcomeTitle, branding, showRecoveryNotice }: VideoChatProps): react.JSX.Element;
|
|
280
304
|
|
|
281
305
|
export { type CreateVideoChatVoiceOptions, type UseVideoChatOptions, type UseVideoChatResult, VideoChat, VideoChatAskOptions, VideoChatCapabilities, type VideoChatFirstFrameMetric, VideoChatMedia, VideoChatMode, type VideoChatPlaybackMetric, type VideoChatPreparedSpeech, type VideoChatProps, type VideoChatStatus, VideoChatSuggestion, type VideoChatTurn, type VideoChatVoice, VideoChatWelcome, VideoError, type VideoErrorOptions, type VideoPlaybackMode, VideoPlayer, type VideoPlayerProps, createVideoChatVoice, useVideoChat };
|