@hyperframes/producer 0.8.193 → 0.8.194

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.
@@ -1497,6 +1497,8 @@ import {
1497
1497
  rewriteInlineStyleAssetUrls
1498
1498
  } from "@hyperframes/core";
1499
1499
  import { MAX_AUDIO_GAIN } from "@hyperframes/core/audio-gain";
1500
+ import { readPlaybackRate } from "@hyperframes/parsers/media-duration";
1501
+ import { resolveRateSpec } from "@hyperframes/core/speed-ramp";
1500
1502
  import { gsapCdnDist } from "@hyperframes/core/gsap-cdn";
1501
1503
  import {
1502
1504
  assignBundledRuntimeCompositionIds,
@@ -3472,6 +3474,9 @@ async function discoverMediaFromBrowser(page) {
3472
3474
  const intrinsicDuration = isImage ? 0 : htmlEl.duration;
3473
3475
  const playbackStartRaw = htmlEl.getAttribute("data-playback-start");
3474
3476
  const mediaStartRaw = htmlEl.getAttribute("data-media-start");
3477
+ const playbackRateRaw = htmlEl.getAttribute("data-playback-rate");
3478
+ const automationRaw = htmlEl.getAttribute("data-automation");
3479
+ const defaultPlaybackRate = isImage ? 1 : htmlEl.defaultPlaybackRate;
3475
3480
  const loop = htmlEl.hasAttribute("loop");
3476
3481
  const hasAudio = htmlEl.getAttribute("data-has-audio") === "true";
3477
3482
  const volume = parseFloat(htmlEl.getAttribute("data-volume") || "1");
@@ -3487,6 +3492,9 @@ async function discoverMediaFromBrowser(page) {
3487
3492
  durationInferred,
3488
3493
  playbackStartRaw,
3489
3494
  mediaStartRaw,
3495
+ playbackRateRaw,
3496
+ automationRaw,
3497
+ defaultPlaybackRate,
3490
3498
  loop,
3491
3499
  hasAudio,
3492
3500
  volume,
@@ -3496,7 +3504,17 @@ async function discoverMediaFromBrowser(page) {
3496
3504
  return results;
3497
3505
  });
3498
3506
  return elements.map(
3499
- ({ endRaw, durationRaw, intrinsicDuration, playbackStartRaw, mediaStartRaw, ...element }) => ({
3507
+ ({
3508
+ endRaw,
3509
+ durationRaw,
3510
+ intrinsicDuration,
3511
+ playbackStartRaw,
3512
+ mediaStartRaw,
3513
+ playbackRateRaw,
3514
+ automationRaw,
3515
+ defaultPlaybackRate,
3516
+ ...element
3517
+ }) => ({
3500
3518
  ...element,
3501
3519
  end: parseStrictFiniteTimingNumber(endRaw) ?? 0,
3502
3520
  duration: element.durationInferred && Number.isFinite(intrinsicDuration) && intrinsicDuration > 0 ? intrinsicDuration : parseStrictFiniteTimingNumber(durationRaw) ?? 0,
@@ -3506,7 +3524,14 @@ async function discoverMediaFromBrowser(page) {
3506
3524
  if (name === "data-media-start") return mediaStartRaw;
3507
3525
  return null;
3508
3526
  }
3509
- })
3527
+ }),
3528
+ playbackRate: resolveRateSpec(
3529
+ automationRaw,
3530
+ readPlaybackRate(
3531
+ (name) => name === "data-playback-rate" ? playbackRateRaw : null,
3532
+ defaultPlaybackRate
3533
+ )
3534
+ )
3510
3535
  })
3511
3536
  );
3512
3537
  }
@@ -3926,9 +3951,18 @@ import {
3926
3951
  getCompositionDuration,
3927
3952
  initializeSession as initializeSession4,
3928
3953
  isTransientBrowserError,
3929
- probeBeginFrameLiveness
3954
+ probeBeginFrameLiveness,
3955
+ videoAudioId
3930
3956
  } from "@hyperframes/engine";
3931
- import { MEDIA_RENDER_ID_ATTR as MEDIA_RENDER_ID_ATTR2, fpsToNumber as fpsToNumber7, readMediaStart as readMediaStart2 } from "@hyperframes/core";
3957
+ import {
3958
+ MEDIA_RENDER_ID_ATTR as MEDIA_RENDER_ID_ATTR2,
3959
+ fpsToNumber as fpsToNumber7,
3960
+ normalizeRateSpec as normalizeRateSpec3,
3961
+ readMediaStart as readMediaStart2,
3962
+ shiftRateLane as shiftRateLane2,
3963
+ sourceTimeAt as sourceTimeAt3,
3964
+ timeAtSourceTime
3965
+ } from "@hyperframes/core";
3932
3966
  import { extractMediaSrcMutations } from "@hyperframes/parsers";
3933
3967
 
3934
3968
  // src/services/render/stages/probeFailures.ts
@@ -3987,16 +4021,28 @@ function authoredMediaStarts(html) {
3987
4021
  }
3988
4022
  return starts;
3989
4023
  }
3990
- function adoptRuntimeMediaStart(composition, el, authored) {
4024
+ function isVideoAudio(audio, videoId) {
4025
+ return audio.type === "video" && audio.id === videoAudioId(videoId);
4026
+ }
4027
+ function adoptRuntimeMediaTiming(composition, el, authored) {
3991
4028
  const shift = el.mediaStart - authored;
3992
- if (el.mediaStart <= 0 || Math.abs(shift) <= BROWSER_MEDIA_EPSILON) return;
3993
4029
  const entries = el.tagName === "video" ? [
3994
4030
  ...composition.videos.filter((video) => video.id === el.id),
3995
- ...composition.audios.filter(
3996
- (audio) => audio.type === "video" && audio.id === `${el.id}-audio`
3997
- )
4031
+ ...composition.audios.filter((audio) => isVideoAudio(audio, el.id))
3998
4032
  ] : composition.audios.filter((audio) => audio.type !== "video" && audio.id === el.id);
3999
- for (const entry of entries) entry.mediaStart += shift;
4033
+ for (const entry of entries) {
4034
+ if (typeof entry.playbackRate !== "object") {
4035
+ if (typeof el.playbackRate === "object") {
4036
+ const consumed = Math.max(0, entry.mediaStart - authored);
4037
+ const head = timeAtSourceTime(normalizeRateSpec3(entry.playbackRate), consumed);
4038
+ entry.mediaStart += sourceTimeAt3(el.playbackRate, head) - consumed;
4039
+ entry.playbackRate = shiftRateLane2(el.playbackRate, head);
4040
+ } else {
4041
+ entry.playbackRate = el.playbackRate;
4042
+ }
4043
+ }
4044
+ if (el.mediaStart > 0 && Math.abs(shift) > BROWSER_MEDIA_EPSILON) entry.mediaStart += shift;
4045
+ }
4000
4046
  }
4001
4047
  function reconcileBrowserMediaEnd(existingEnd, projectedEnd, sourceChanged, durationInferred) {
4002
4048
  if (projectedEnd <= 0) return existingEnd;
@@ -4280,7 +4326,7 @@ async function runProbeStage(input) {
4280
4326
  sourceChanged,
4281
4327
  el.durationInferred
4282
4328
  );
4283
- adoptRuntimeMediaStart(
4329
+ adoptRuntimeMediaTiming(
4284
4330
  composition,
4285
4331
  el,
4286
4332
  authoredStarts.get(el.id) ?? existing.mediaStart
@@ -4303,6 +4349,7 @@ async function runProbeStage(input) {
4303
4349
  start: el.start,
4304
4350
  end: resolveBrowserMediaEnd(el.start, el.end, el.duration),
4305
4351
  mediaStart: el.mediaStart,
4352
+ playbackRate: el.playbackRate,
4306
4353
  loop: el.loop,
4307
4354
  hasAudio: el.hasAudio && !el.muted
4308
4355
  });
@@ -4327,7 +4374,7 @@ async function runProbeStage(input) {
4327
4374
  sourceChanged,
4328
4375
  el.durationInferred
4329
4376
  );
4330
- adoptRuntimeMediaStart(
4377
+ adoptRuntimeMediaTiming(
4331
4378
  composition,
4332
4379
  el,
4333
4380
  authoredStarts.get(el.id) ?? existing.mediaStart
@@ -4345,6 +4392,7 @@ async function runProbeStage(input) {
4345
4392
  end: resolveBrowserMediaEnd(el.start, el.end, el.duration),
4346
4393
  mediaStart: el.mediaStart,
4347
4394
  loop: el.loop,
4395
+ playbackRate: el.playbackRate,
4348
4396
  layer: 0,
4349
4397
  volume: el.volume,
4350
4398
  type: "audio"
@@ -4605,7 +4653,8 @@ import {
4605
4653
  isHttpUrl as isHttpUrl2,
4606
4654
  resolveProjectRelativeSrc as resolveProjectRelativeSrc3,
4607
4655
  runVideoExtractionWithRetry,
4608
- safeVideoExtractionSourceIdentity
4656
+ safeVideoExtractionSourceIdentity,
4657
+ videoAudioId as videoAudioId2
4609
4658
  } from "@hyperframes/engine";
4610
4659
 
4611
4660
  // src/services/render/extractionFailureMetadata.ts
@@ -4963,7 +5012,7 @@ function appendAutoDetectedVideoAudio(composition, extracted) {
4963
5012
  const video = composition.videos.find((v) => v.id === ext.videoId);
4964
5013
  if (!video || !video.hasAudio || video.hidden || existingAudioSrcs.has(video.src)) continue;
4965
5014
  composition.audios.push({
4966
- id: `${video.id}-audio`,
5015
+ id: videoAudioId2(video.id),
4967
5016
  src: video.src,
4968
5017
  start: video.start,
4969
5018
  end: video.end,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": "0.1.0",
3
3
  "buildId": "dev",
4
- "sha256": "10a061ef2b83cedec556bdfd42c76f3fd08082832f47bb2803a86b1fce3a6d99",
4
+ "sha256": "17f66a5b2b626b2c74d51365de8d8d74f7c4ce6d96089c893cb1054b201bd512",
5
5
  "artifacts": {
6
6
  "iife": "hyperframe.runtime.iife.js",
7
7
  "esm": "hyperframe.runtime.mjs"