@hyperframes/core 0.8.159 → 0.8.160
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/audioAnalysis.d.ts +119 -0
- package/dist/audioAnalysis.js +466 -0
- package/dist/audioAnalysisLadder.d.ts +52 -0
- package/dist/audioAnalysisLadder.js +78 -0
- package/dist/audioCarve.js +1 -36
- package/dist/audioRhythm.d.ts +50 -0
- package/dist/audioRhythm.js +311 -0
- package/dist/audioSections.d.ts +21 -0
- package/dist/audioSections.js +109 -0
- package/dist/audioSnap.d.ts +18 -0
- package/dist/audioSnap.js +41 -0
- package/dist/fft.d.ts +2 -0
- package/dist/fft.js +36 -0
- package/dist/generated/runtime-inline.js +1 -1
- package/dist/hyperframe.runtime.iife.js +55 -55
- package/dist/runtime/media.d.ts +1 -0
- package/dist/runtime/media.js +35 -0
- package/package.json +8 -4
package/dist/runtime/media.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ export declare function evictMediaSyncState(el: HTMLMediaElement): void;
|
|
|
80
80
|
/** Test-only seam: whether any per-source sync state is still tracked for `el`. */
|
|
81
81
|
export declare function hasMediaSyncStateForTest(el: HTMLMediaElement): boolean;
|
|
82
82
|
export declare const MEDIA_HARD_SYNC_SECONDS = 0.5;
|
|
83
|
+
export declare const VIDEO_PRESEEK_SECONDS = 1.5;
|
|
83
84
|
/** Drift a playing audio element may carry before sync pulls it back onto the playhead. */
|
|
84
85
|
export declare const MEDIA_SYNC_TOLERANCE_SECONDS = 0.04;
|
|
85
86
|
export declare function syncRuntimeMedia(params: {
|
package/dist/runtime/media.js
CHANGED
|
@@ -191,6 +191,40 @@ export function hasMediaSyncStateForTest(el) {
|
|
|
191
191
|
videoSteering.has(el));
|
|
192
192
|
}
|
|
193
193
|
export const MEDIA_HARD_SYNC_SECONDS = 0.5;
|
|
194
|
+
export const VIDEO_PRESEEK_SECONDS = 1.5;
|
|
195
|
+
function prepareUpcomingVideo(clip, time, playing, rate) {
|
|
196
|
+
const { el } = clip;
|
|
197
|
+
const dueIn = clip.start - time;
|
|
198
|
+
if (!playing ||
|
|
199
|
+
el.tagName !== "VIDEO" ||
|
|
200
|
+
dueIn <= 0 ||
|
|
201
|
+
dueIn > VIDEO_PRESEEK_SECONDS * rate ||
|
|
202
|
+
!el.paused ||
|
|
203
|
+
el.seeking ||
|
|
204
|
+
el.readyState < el.HAVE_METADATA ||
|
|
205
|
+
findInjectedRenderFrame(el) ||
|
|
206
|
+
("__HF_EXPORT_RENDER_SEEK_CONFIG" in window && window.__HF_EXPORT_RENDER_SEEK_CONFIG))
|
|
207
|
+
return;
|
|
208
|
+
let target = clip.mediaStart +
|
|
209
|
+
sourceTimeAt(clip.rate ?? clip.playbackRate, clip.start - (clip.origin ?? clip.start));
|
|
210
|
+
if (clip.sourceDuration != null) {
|
|
211
|
+
const loopLength = clip.sourceDuration - clip.mediaStart;
|
|
212
|
+
if (clip.loop && loopLength > 0 && target >= clip.sourceDuration)
|
|
213
|
+
target = clip.mediaStart + ((target - clip.mediaStart) % loopLength);
|
|
214
|
+
else if (!clip.loop)
|
|
215
|
+
target = Math.min(target, clip.sourceDuration);
|
|
216
|
+
}
|
|
217
|
+
if (!Number.isFinite(target) || target < 0 || Math.abs(el.currentTime - target) <= 0.001)
|
|
218
|
+
return;
|
|
219
|
+
try {
|
|
220
|
+
// A trimmed video exposed during its in-point seek has no current frame at the cut.
|
|
221
|
+
// Hidden preparation must not hold the visible-frame seek barrier.
|
|
222
|
+
el.currentTime = target;
|
|
223
|
+
}
|
|
224
|
+
catch (err) {
|
|
225
|
+
swallow("runtime.media.preseek", err);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
194
228
|
/** Drift a playing audio element may carry before sync pulls it back onto the playhead. */
|
|
195
229
|
export const MEDIA_SYNC_TOLERANCE_SECONDS = 0.04;
|
|
196
230
|
// Chromium refuses a slower playbackRate (NotSupportedError).
|
|
@@ -535,5 +569,6 @@ export function syncRuntimeMedia(params) {
|
|
|
535
569
|
lastRelativeTime.set(el, relTime);
|
|
536
570
|
if (!el.paused)
|
|
537
571
|
el.pause();
|
|
572
|
+
prepareUpcomingVideo(clip, params.timeSeconds, params.playing, params.playbackRate);
|
|
538
573
|
}
|
|
539
574
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hyperframes/core",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.160",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -184,6 +184,10 @@
|
|
|
184
184
|
"import": "./dist/audibleVideo.js",
|
|
185
185
|
"types": "./dist/audibleVideo.d.ts"
|
|
186
186
|
},
|
|
187
|
+
"./audio-analysis": {
|
|
188
|
+
"import": "./dist/audioAnalysis.js",
|
|
189
|
+
"types": "./dist/audioAnalysis.d.ts"
|
|
190
|
+
},
|
|
187
191
|
"./audio-gain": {
|
|
188
192
|
"import": "./dist/audioGain.js",
|
|
189
193
|
"types": "./dist/audioGain.d.ts"
|
|
@@ -374,9 +378,9 @@
|
|
|
374
378
|
"linkedom": "^0.18.12",
|
|
375
379
|
"postcss": "^8.5.8",
|
|
376
380
|
"wawoff2": "^2.0.1",
|
|
377
|
-
"@hyperframes/lint": "0.8.
|
|
378
|
-
"@hyperframes/studio-server": "0.8.
|
|
379
|
-
"@hyperframes/parsers": "0.8.
|
|
381
|
+
"@hyperframes/lint": "0.8.160",
|
|
382
|
+
"@hyperframes/studio-server": "0.8.160",
|
|
383
|
+
"@hyperframes/parsers": "0.8.160"
|
|
380
384
|
},
|
|
381
385
|
"devDependencies": {
|
|
382
386
|
"@fontsource/archivo-black": "^5.2.8",
|