@hyperframes/core 0.9.95 → 0.9.96
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/audibleVideo.d.ts +10 -0
- package/dist/audibleVideo.js +37 -0
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +67 -67
- package/dist/index.d.ts +1 -1
- package/dist/runtime/adapters/seek-dispatch.d.ts +40 -0
- package/dist/runtime/adapters/seek-dispatch.js +164 -0
- package/dist/runtime/assetUrl.d.ts +6 -0
- package/dist/runtime/assetUrl.js +8 -0
- package/dist/runtime/audioFx.d.ts +77 -0
- package/dist/runtime/audioFx.js +277 -0
- package/dist/runtime/bridge.d.ts +6 -0
- package/dist/runtime/bridge.js +20 -0
- package/dist/runtime/decodesFirst.d.ts +4 -0
- package/dist/runtime/decodesFirst.js +14 -0
- package/dist/runtime/media.d.ts +113 -0
- package/dist/runtime/media.js +820 -0
- package/dist/runtime/mediaLoadFailure.d.ts +8 -0
- package/dist/runtime/mediaLoadFailure.js +58 -0
- package/dist/runtime/mediaProxy.d.ts +91 -0
- package/dist/runtime/mediaProxy.js +803 -0
- package/dist/runtime/playbackHealth.d.ts +31 -0
- package/dist/runtime/playbackHealth.js +137 -0
- package/dist/runtime/preloadMedia.d.ts +16 -0
- package/dist/runtime/preloadMedia.js +266 -0
- package/dist/runtime/previewCopies.d.ts +13 -0
- package/dist/runtime/previewCopies.js +80 -0
- package/dist/runtime/proxyWait.d.ts +3 -0
- package/dist/runtime/proxyWait.js +51 -0
- package/dist/runtime/runtimeLoad.d.ts +3 -0
- package/dist/runtime/runtimeLoad.js +13 -0
- package/dist/runtime/state.d.ts +7 -0
- package/dist/runtime/state.js +3 -0
- package/dist/runtime/timedClipHide.d.ts +12 -0
- package/dist/runtime/timedClipHide.js +94 -0
- package/dist/runtime/types.d.ts +29 -18
- package/dist/runtime/webAudioTransport.d.ts +241 -0
- package/dist/runtime/webAudioTransport.js +1162 -0
- package/package.json +12 -4
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { RuntimeMediaClip } from "./types.js";
|
|
2
|
+
import { type HostSlot } from "../mediaTiming.js";
|
|
3
|
+
export { MEDIA_HARD_SYNC_SECONDS, MEDIA_SYNC_TOLERANCE_SECONDS } from "./mediaSteer.js";
|
|
4
|
+
export type { RuntimeMediaClip } from "./types.js";
|
|
5
|
+
export { readElementPlaybackRate, readElementRateSpec, resolveNaturalMediaTimelineDuration, } from "./playbackRate.js";
|
|
6
|
+
export declare function readElementPlaybackStart(el: Element): number;
|
|
7
|
+
export declare const HOLD_CAP_MS = 5000;
|
|
8
|
+
/**
|
|
9
|
+
* Resolve a media element's timeline window without conflating a video's
|
|
10
|
+
* authored display slot with the amount of source left to decode.
|
|
11
|
+
*
|
|
12
|
+
* An explicit video slot may outlive its source and hold the final frame; a loop fills its slot.
|
|
13
|
+
* Other audio remains source-bounded because it has no visual hold state.
|
|
14
|
+
*/
|
|
15
|
+
export declare function resolveRuntimeMediaClipDuration(params: {
|
|
16
|
+
isVideo: boolean;
|
|
17
|
+
loops: boolean;
|
|
18
|
+
sourceDuration: number | null;
|
|
19
|
+
hostRemaining: number | null;
|
|
20
|
+
explicitDuration: number | null;
|
|
21
|
+
}): number | null;
|
|
22
|
+
export declare function refreshRuntimeMediaCache(params?: {
|
|
23
|
+
resolveStartSeconds?: (element: Element) => number;
|
|
24
|
+
resolveDurationSeconds?: (element: HTMLVideoElement | HTMLAudioElement) => number | null;
|
|
25
|
+
resolveHostSlots?: (element: HTMLVideoElement | HTMLAudioElement) => HostSlot[];
|
|
26
|
+
shouldIncludeElement?: (element: HTMLVideoElement | HTMLAudioElement) => boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Build clips for exactly these elements instead of scanning the document for
|
|
29
|
+
* them. For a caller that already knows which media it needs this pass — the
|
|
30
|
+
* per-seek sync only touches the clips whose active state can change — and so
|
|
31
|
+
* should not pay to re-derive the window of every clip in the composition.
|
|
32
|
+
*
|
|
33
|
+
* Every field is still read FRESH from the element. This narrows which
|
|
34
|
+
* elements are visited, never how current the answer is: `el.duration` can be
|
|
35
|
+
* reset under the caller by an `el.load()` it did not make.
|
|
36
|
+
*/
|
|
37
|
+
elements?: Array<HTMLVideoElement | HTMLAudioElement>;
|
|
38
|
+
}): {
|
|
39
|
+
timedMediaEls: Array<HTMLVideoElement | HTMLAudioElement>;
|
|
40
|
+
mediaClips: RuntimeMediaClip[];
|
|
41
|
+
videoClips: RuntimeMediaClip[];
|
|
42
|
+
maxMediaEnd: number;
|
|
43
|
+
};
|
|
44
|
+
export declare function primeMediaForLaterStarts(els: Iterable<HTMLMediaElement>): void;
|
|
45
|
+
export declare function isUnplayable(el: HTMLMediaElement): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Drop every per-source sync baseline tracked for `el` — offset drift
|
|
48
|
+
* samples, the seek-past-buffered-range retry latch, and the last
|
|
49
|
+
* runtime-applied volume — so the next `syncRuntimeMedia` tick treats it as
|
|
50
|
+
* a first tick (hard resync, fresh drift baseline) instead of comparing
|
|
51
|
+
* against state computed for a different file. Used both when a clip leaves
|
|
52
|
+
* its active window (below) and by the runtime's proxy-swap helper
|
|
53
|
+
* (mediaProxy.ts) right after an in-place `src` swap, which points the same
|
|
54
|
+
* element at a different file without ever leaving its active window.
|
|
55
|
+
*/
|
|
56
|
+
export declare function evictMediaSyncState(el: HTMLMediaElement): void;
|
|
57
|
+
/** Whether the clip is inside its window at the playhead right now: the sync tick keeps its time while it is. */
|
|
58
|
+
export declare function isActiveAtPlayhead(el: HTMLMediaElement): boolean;
|
|
59
|
+
/** The source time the clip shows at the playhead, while it is inside its window. */
|
|
60
|
+
export declare function sourceTimeAtPlayhead(el: HTMLMediaElement): number | undefined;
|
|
61
|
+
/** Test-only seam: whether any per-source sync state is still tracked for `el`. */
|
|
62
|
+
export declare function hasMediaSyncStateForTest(el: HTMLMediaElement): boolean;
|
|
63
|
+
export declare const MEDIA_PRESEEK_SECONDS = 1.5;
|
|
64
|
+
export declare function mediaSourceTimeAt(clip: RuntimeMediaClip, timeSeconds: number): number;
|
|
65
|
+
export declare function resetVideoStartLatency(): void;
|
|
66
|
+
export declare function syncRuntimeMedia(params: {
|
|
67
|
+
clips: RuntimeMediaClip[];
|
|
68
|
+
timeSeconds: number;
|
|
69
|
+
playing: boolean;
|
|
70
|
+
playbackRate: number;
|
|
71
|
+
/** Force-mute every element (parent-frame proxy owns all audio). Asserted per
|
|
72
|
+
* tick so sub-composition media added mid-playback inherits the silence. */
|
|
73
|
+
outputMuted?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* User's explicit mute preference (set via `onSetMuted`). Symmetric to
|
|
76
|
+
* `outputMuted` — also asserted per tick — so a sub-composition that
|
|
77
|
+
* activates after the user mutes doesn't briefly play at author volume
|
|
78
|
+
* before the next bridge message lands.
|
|
79
|
+
*/
|
|
80
|
+
userMuted?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* User's volume preference (0–1, set via `onSetVolume`). Multiplied with the
|
|
83
|
+
* per-clip author volume so `data-volume="0.5"` at user volume 0.8 yields 0.4.
|
|
84
|
+
*/
|
|
85
|
+
userVolume?: number;
|
|
86
|
+
/**
|
|
87
|
+
* Invoked at most once when a media element's `play()` promise rejects with
|
|
88
|
+
* `NotAllowedError`. The caller is expected to latch and post a single
|
|
89
|
+
* outbound message; further invocations are suppressed by the caller.
|
|
90
|
+
*/
|
|
91
|
+
onAutoplayBlocked?: () => void;
|
|
92
|
+
clockAhead?: (el: HTMLMediaElement) => number;
|
|
93
|
+
/** `clipGain` is `data-volume` for a routed clip, played ahead of its FX; 1 otherwise. */
|
|
94
|
+
onElementVolume?: (el: HTMLMediaElement, effectiveVolume: number, authorVolume: number, clipGain: number, unfadedVolume?: number) => void;
|
|
95
|
+
/** Is THIS element owned by the Web Audio transport? Owned → mute it (transport
|
|
96
|
+
* plays it); not owned → leave audible (HTMLMedia fallback). Per-element, not a
|
|
97
|
+
* global flag, so a not-yet-claimed track isn't muted by other tracks. */
|
|
98
|
+
isWebAudioOwned?: (el: HTMLMediaElement) => boolean;
|
|
99
|
+
/** Native media routed through WebAudio keeps its upstream element volume at
|
|
100
|
+
* unity; do not mistake that transport write for an authored volume edit. */
|
|
101
|
+
isWebAudioRouted?: (el: HTMLMediaElement) => boolean;
|
|
102
|
+
forceSync?: boolean;
|
|
103
|
+
keepLateMedia?: boolean;
|
|
104
|
+
/** False while the playhead is not moving (audio output has not started): a paused video waits for it. */
|
|
105
|
+
clockAdvancing?: boolean;
|
|
106
|
+
/** How far the next tick will move the playhead: an audio clip due within it starts now. */
|
|
107
|
+
cueAheadSeconds?: number;
|
|
108
|
+
/** Seeks a sounding element under a gain dip; false when it has no dip stage and the sync seeks it plainly. */
|
|
109
|
+
seekUnderDip?: (el: HTMLMediaElement, target: number) => boolean;
|
|
110
|
+
/** Lets a video clip that runs to the composition end hold its last frame at the terminal time.
|
|
111
|
+
* A thunk, because deriving the duration is only worth it for a clip past its own end. */
|
|
112
|
+
getCompositionDuration: () => number;
|
|
113
|
+
}): void;
|