@remotion/promo-pages 4.0.485 → 4.0.487

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/templates.js CHANGED
@@ -1378,7 +1378,7 @@ var getDefaultConfig = () => {
1378
1378
  var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
1379
1379
 
1380
1380
  // ../design/dist/esm/index.mjs
1381
- import React32, { useEffect as useEffect22, useMemo as useMemo42, useState as useState21 } from "react";
1381
+ import React32, { useEffect as useEffect21, useMemo as useMemo42, useState as useState21 } from "react";
1382
1382
 
1383
1383
  // ../paths/dist/esm/index.mjs
1384
1384
  var cutLInstruction = ({
@@ -3484,6 +3484,94 @@ var getBoundingBox = (d) => {
3484
3484
  const unarced = removeATSHVQInstructions(normalizeInstructions(parsed));
3485
3485
  return getBoundingBoxFromInstructions(unarced);
3486
3486
  };
3487
+ var translateSegments = (segments, x, y) => {
3488
+ return segments.map((segment) => {
3489
+ if (segment.type === "a" || segment.type === "c" || segment.type === "v" || segment.type === "s" || segment.type === "h" || segment.type === "l" || segment.type === "m" || segment.type === "q" || segment.type === "t") {
3490
+ return segment;
3491
+ }
3492
+ if (segment.type === "V") {
3493
+ return {
3494
+ type: "V",
3495
+ y: segment.y + y
3496
+ };
3497
+ }
3498
+ if (segment.type === "H") {
3499
+ return {
3500
+ type: "H",
3501
+ x: segment.x + x
3502
+ };
3503
+ }
3504
+ if (segment.type === "A") {
3505
+ return {
3506
+ type: "A",
3507
+ rx: segment.rx,
3508
+ ry: segment.ry,
3509
+ largeArcFlag: segment.largeArcFlag,
3510
+ sweepFlag: segment.sweepFlag,
3511
+ xAxisRotation: segment.xAxisRotation,
3512
+ x: segment.x + x,
3513
+ y: segment.y + y
3514
+ };
3515
+ }
3516
+ if (segment.type === "Z") {
3517
+ return segment;
3518
+ }
3519
+ if (segment.type === "C") {
3520
+ return {
3521
+ type: "C",
3522
+ cp1x: segment.cp1x + x,
3523
+ cp1y: segment.cp1y + y,
3524
+ cp2x: segment.cp2x + x,
3525
+ cp2y: segment.cp2y + y,
3526
+ x: segment.x + x,
3527
+ y: segment.y + y
3528
+ };
3529
+ }
3530
+ if (segment.type === "Q") {
3531
+ return {
3532
+ type: "Q",
3533
+ cpx: segment.cpx + x,
3534
+ cpy: segment.cpy + y,
3535
+ x: segment.x + x,
3536
+ y: segment.y + y
3537
+ };
3538
+ }
3539
+ if (segment.type === "S") {
3540
+ return {
3541
+ type: "S",
3542
+ cpx: segment.cpx + x,
3543
+ cpy: segment.cpy + y,
3544
+ x: segment.x + x,
3545
+ y: segment.y + y
3546
+ };
3547
+ }
3548
+ if (segment.type === "T") {
3549
+ return {
3550
+ type: "T",
3551
+ x: segment.x + x,
3552
+ y: segment.y + y
3553
+ };
3554
+ }
3555
+ if (segment.type === "L") {
3556
+ return {
3557
+ type: "L",
3558
+ x: segment.x + x,
3559
+ y: segment.y + y
3560
+ };
3561
+ }
3562
+ if (segment.type === "M") {
3563
+ return {
3564
+ type: "M",
3565
+ x: segment.x + x,
3566
+ y: segment.y + y
3567
+ };
3568
+ }
3569
+ throw new Error(`Unknown segment type: ${segment.type}`);
3570
+ });
3571
+ };
3572
+ var translatePath = (path, x, y) => {
3573
+ return serializeInstructions(translateSegments(parsePath(path), x, y));
3574
+ };
3487
3575
  var mod = (x, m) => {
3488
3576
  return (x % m + m) % m;
3489
3577
  };
@@ -4045,94 +4133,6 @@ var getLength = (path) => {
4045
4133
  const constructucted = construct(path);
4046
4134
  return constructucted.totalLength;
4047
4135
  };
4048
- var translateSegments = (segments, x, y) => {
4049
- return segments.map((segment) => {
4050
- if (segment.type === "a" || segment.type === "c" || segment.type === "v" || segment.type === "s" || segment.type === "h" || segment.type === "l" || segment.type === "m" || segment.type === "q" || segment.type === "t") {
4051
- return segment;
4052
- }
4053
- if (segment.type === "V") {
4054
- return {
4055
- type: "V",
4056
- y: segment.y + y
4057
- };
4058
- }
4059
- if (segment.type === "H") {
4060
- return {
4061
- type: "H",
4062
- x: segment.x + x
4063
- };
4064
- }
4065
- if (segment.type === "A") {
4066
- return {
4067
- type: "A",
4068
- rx: segment.rx,
4069
- ry: segment.ry,
4070
- largeArcFlag: segment.largeArcFlag,
4071
- sweepFlag: segment.sweepFlag,
4072
- xAxisRotation: segment.xAxisRotation,
4073
- x: segment.x + x,
4074
- y: segment.y + y
4075
- };
4076
- }
4077
- if (segment.type === "Z") {
4078
- return segment;
4079
- }
4080
- if (segment.type === "C") {
4081
- return {
4082
- type: "C",
4083
- cp1x: segment.cp1x + x,
4084
- cp1y: segment.cp1y + y,
4085
- cp2x: segment.cp2x + x,
4086
- cp2y: segment.cp2y + y,
4087
- x: segment.x + x,
4088
- y: segment.y + y
4089
- };
4090
- }
4091
- if (segment.type === "Q") {
4092
- return {
4093
- type: "Q",
4094
- cpx: segment.cpx + x,
4095
- cpy: segment.cpy + y,
4096
- x: segment.x + x,
4097
- y: segment.y + y
4098
- };
4099
- }
4100
- if (segment.type === "S") {
4101
- return {
4102
- type: "S",
4103
- cpx: segment.cpx + x,
4104
- cpy: segment.cpy + y,
4105
- x: segment.x + x,
4106
- y: segment.y + y
4107
- };
4108
- }
4109
- if (segment.type === "T") {
4110
- return {
4111
- type: "T",
4112
- x: segment.x + x,
4113
- y: segment.y + y
4114
- };
4115
- }
4116
- if (segment.type === "L") {
4117
- return {
4118
- type: "L",
4119
- x: segment.x + x,
4120
- y: segment.y + y
4121
- };
4122
- }
4123
- if (segment.type === "M") {
4124
- return {
4125
- type: "M",
4126
- x: segment.x + x,
4127
- y: segment.y + y
4128
- };
4129
- }
4130
- throw new Error(`Unknown segment type: ${segment.type}`);
4131
- });
4132
- };
4133
- var translatePath = (path, x, y) => {
4134
- return serializeInstructions(translateSegments(parsePath(path), x, y));
4135
- };
4136
4136
  var resetPath = (d) => {
4137
4137
  const box = getBoundingBox(d);
4138
4138
  return translatePath(d, -box.x1, -box.y1);
@@ -4321,8 +4321,8 @@ import {
4321
4321
  forwardRef as forwardRef10,
4322
4322
  useCallback as useCallback17,
4323
4323
  useContext as useContext32,
4324
- useEffect as useEffect17,
4325
4324
  useImperativeHandle as useImperativeHandle7,
4325
+ useLayoutEffect as useLayoutEffect10,
4326
4326
  useMemo as useMemo31,
4327
4327
  useRef as useRef23,
4328
4328
  useState as useState16
@@ -4330,7 +4330,7 @@ import {
4330
4330
  import { jsx as jsx26 } from "react/jsx-runtime";
4331
4331
  import { forwardRef as forwardRef11, useCallback as useCallback18, useState as useState17 } from "react";
4332
4332
  import { jsx as jsx27 } from "react/jsx-runtime";
4333
- import { useCallback as useCallback19, useContext as useContext33, useLayoutEffect as useLayoutEffect10, useRef as useRef24 } from "react";
4333
+ import { useCallback as useCallback19, useContext as useContext33, useLayoutEffect as useLayoutEffect11, useRef as useRef24 } from "react";
4334
4334
  import { jsx as jsx28 } from "react/jsx-runtime";
4335
4335
  import React29, { forwardRef as forwardRef12, useCallback as useCallback20, useRef as useRef25 } from "react";
4336
4336
  import { jsx as jsx29 } from "react/jsx-runtime";
@@ -4356,8 +4356,8 @@ import { useCallback as useCallback24 } from "react";
4356
4356
  import {
4357
4357
  useCallback as useCallback22,
4358
4358
  useContext as useContext36,
4359
- useEffect as useEffect18,
4360
- useLayoutEffect as useLayoutEffect11,
4359
+ useEffect as useEffect17,
4360
+ useLayoutEffect as useLayoutEffect12,
4361
4361
  useMemo as useMemo35,
4362
4362
  useState as useState19
4363
4363
  } from "react";
@@ -4366,13 +4366,13 @@ import React37, {
4366
4366
  forwardRef as forwardRef13,
4367
4367
  useCallback as useCallback23,
4368
4368
  useContext as useContext37,
4369
- useEffect as useEffect20,
4369
+ useEffect as useEffect19,
4370
4370
  useImperativeHandle as useImperativeHandle9,
4371
4371
  useMemo as useMemo36,
4372
4372
  useRef as useRef27,
4373
4373
  useState as useState20
4374
4374
  } from "react";
4375
- import { useEffect as useEffect19 } from "react";
4375
+ import { useEffect as useEffect18 } from "react";
4376
4376
  import { jsx as jsx34 } from "react/jsx-runtime";
4377
4377
  import { jsx as jsx35 } from "react/jsx-runtime";
4378
4378
  import React39, { useMemo as useMemo37 } from "react";
@@ -4389,9 +4389,9 @@ import { forwardRef as forwardRef16, useCallback as useCallback25, useContext as
4389
4389
  import {
4390
4390
  forwardRef as forwardRef15,
4391
4391
  useContext as useContext38,
4392
- useEffect as useEffect21,
4392
+ useEffect as useEffect20,
4393
4393
  useImperativeHandle as useImperativeHandle10,
4394
- useLayoutEffect as useLayoutEffect12,
4394
+ useLayoutEffect as useLayoutEffect13,
4395
4395
  useMemo as useMemo39,
4396
4396
  useRef as useRef28
4397
4397
  } from "react";
@@ -5565,7 +5565,7 @@ var getComponentsToAddStacksTo = () => componentsToAddStacksTo;
5565
5565
  var addSequenceStackTraces = (component) => {
5566
5566
  componentsToAddStacksTo.push(component);
5567
5567
  };
5568
- var VERSION = "4.0.485";
5568
+ var VERSION = "4.0.487";
5569
5569
  var checkMultipleRemotionVersions = () => {
5570
5570
  if (typeof globalThis === "undefined") {
5571
5571
  return;
@@ -5971,6 +5971,12 @@ var textSchema = {
5971
5971
  default: undefined,
5972
5972
  description: "Color"
5973
5973
  },
5974
+ "style.fontFamily": {
5975
+ type: "font-family",
5976
+ default: undefined,
5977
+ description: "Font family",
5978
+ keyframable: false
5979
+ },
5974
5980
  "style.fontSize": {
5975
5981
  type: "number",
5976
5982
  default: undefined,
@@ -11429,7 +11435,8 @@ var useBufferManager = (logLevel, mountTime) => {
11429
11435
  if (rendering) {
11430
11436
  return;
11431
11437
  }
11432
- if (blocks.length > 0) {
11438
+ if (blocks.length > 0 && !buffering.current) {
11439
+ buffering.current = true;
11433
11440
  onBufferingCallbacks.forEach((c2) => c2());
11434
11441
  playbackLogging({
11435
11442
  logLevel,
@@ -11444,7 +11451,8 @@ var useBufferManager = (logLevel, mountTime) => {
11444
11451
  if (rendering) {
11445
11452
  return;
11446
11453
  }
11447
- if (blocks.length === 0) {
11454
+ if (blocks.length === 0 && buffering.current) {
11455
+ buffering.current = false;
11448
11456
  onResumeCallbacks.forEach((c2) => c2());
11449
11457
  playbackLogging({
11450
11458
  logLevel,
@@ -11477,15 +11485,11 @@ var useIsPlayerBuffering = (bufferManager) => {
11477
11485
  const onResume = () => {
11478
11486
  setIsBuffering(false);
11479
11487
  };
11480
- bufferManager.listenForBuffering(onBuffer);
11481
- bufferManager.listenForResume(onResume);
11488
+ const buffer = bufferManager.listenForBuffering(onBuffer);
11489
+ const resume = bufferManager.listenForResume(onResume);
11482
11490
  return () => {
11483
- bufferManager.listenForBuffering(() => {
11484
- return;
11485
- });
11486
- bufferManager.listenForResume(() => {
11487
- return;
11488
- });
11491
+ buffer.remove();
11492
+ resume.remove();
11489
11493
  };
11490
11494
  }, [bufferManager]);
11491
11495
  return isBuffering;
@@ -11609,6 +11613,72 @@ var useBufferUntilFirstFrame = ({
11609
11613
  };
11610
11614
  }, [bufferUntilFirstFrame]);
11611
11615
  };
11616
+ var getMediaSyncAction = (input) => {
11617
+ const {
11618
+ duration,
11619
+ currentTime,
11620
+ paused,
11621
+ ended,
11622
+ desiredUnclampedTime,
11623
+ mediaTagTime,
11624
+ mediaTagLastUpdate,
11625
+ rvcTime,
11626
+ rvcLastUpdate,
11627
+ isVariableFpsVideo,
11628
+ acceptableTimeShift,
11629
+ lastSeekDueToShift,
11630
+ playing,
11631
+ playbackRate,
11632
+ mediaTagBufferingOrStalled,
11633
+ playerBuffering,
11634
+ absoluteFrame,
11635
+ onlyWarnForMediaSeekingError,
11636
+ isPremounting,
11637
+ isPostmounting,
11638
+ pauseWhenBuffering
11639
+ } = input;
11640
+ const shouldBeTime = !Number.isNaN(duration) && Number.isFinite(duration) ? Math.min(duration, desiredUnclampedTime) : desiredUnclampedTime;
11641
+ const timeShiftMediaTag = Math.abs(shouldBeTime - mediaTagTime);
11642
+ const timeShiftRvcTag = rvcTime ? Math.abs(shouldBeTime - rvcTime) : null;
11643
+ const mostRecentTimeshift = rvcLastUpdate && rvcTime > mediaTagLastUpdate ? timeShiftRvcTag : timeShiftMediaTag;
11644
+ const timeShift = timeShiftRvcTag && !isVariableFpsVideo ? mostRecentTimeshift : timeShiftMediaTag;
11645
+ if (timeShift > acceptableTimeShift && lastSeekDueToShift !== shouldBeTime) {
11646
+ return {
11647
+ type: "seek-due-to-shift",
11648
+ shouldBeTime,
11649
+ why: `because time shift is too big. shouldBeTime = ${shouldBeTime}, isTime = ${mediaTagTime}, requestVideoCallbackTime = ${rvcTime}, timeShift = ${timeShift}${isVariableFpsVideo ? ", isVariableFpsVideo = true" : ""}, isPremounting = ${isPremounting}, isPostmounting = ${isPostmounting}, pauseWhenBuffering = ${pauseWhenBuffering}`,
11650
+ bufferUntilFirstFrame: playing && playbackRate > 0,
11651
+ playReason: playing && paused ? "player is playing but media tag is paused, and just seeked" : null,
11652
+ warnAboutNonSeekable: !onlyWarnForMediaSeekingError
11653
+ };
11654
+ }
11655
+ const seekThreshold = playing ? 0.15 : 0.01;
11656
+ const makesSenseToSeek = Math.abs(currentTime - shouldBeTime) > seekThreshold;
11657
+ const isSomethingElseBuffering = playerBuffering && !mediaTagBufferingOrStalled;
11658
+ if (!playing || isSomethingElseBuffering) {
11659
+ return {
11660
+ type: "seek-if-not-playing",
11661
+ shouldBeTime,
11662
+ why: makesSenseToSeek ? `not playing or something else is buffering. time offset is over seek threshold (${seekThreshold})` : null
11663
+ };
11664
+ }
11665
+ if (!playing || playerBuffering) {
11666
+ return { type: "none" };
11667
+ }
11668
+ const pausedCondition = paused && !ended;
11669
+ const firstFrameCondition = absoluteFrame === 0;
11670
+ if (pausedCondition || firstFrameCondition) {
11671
+ const reason = pausedCondition ? "media tag is paused" : "absolute frame is 0";
11672
+ return {
11673
+ type: "play-and-seek",
11674
+ shouldBeTime,
11675
+ why: makesSenseToSeek ? `is over timeshift threshold (threshold = ${seekThreshold}) and ${reason}` : null,
11676
+ playReason: `player is playing and ${reason}`,
11677
+ bufferUntilFirstFrame: !isVariableFpsVideo && playbackRate > 0
11678
+ };
11679
+ }
11680
+ return { type: "none" };
11681
+ };
11612
11682
  var useCurrentTimeOfMediaTagWithUpdateTimeStamp = (mediaRef) => {
11613
11683
  const lastUpdate = React21.useRef({
11614
11684
  time: mediaRef.current?.currentTime ?? 0,
@@ -12028,89 +12098,93 @@ var useMediaPlayback = ({
12028
12098
  if (!src) {
12029
12099
  throw new Error(`No 'src' attribute was passed to the ${tagName} element.`);
12030
12100
  }
12031
- const { duration } = mediaRef.current;
12032
- const shouldBeTime = !Number.isNaN(duration) && Number.isFinite(duration) ? Math.min(duration, desiredUnclampedTime) : desiredUnclampedTime;
12033
- const mediaTagTime = mediaTagCurrentTime.current.time;
12034
- const rvcTime = rvcCurrentTime.current?.time ?? null;
12035
- const isVariableFpsVideo = isVariableFpsVideoMap.current[src];
12036
- const timeShiftMediaTag = Math.abs(shouldBeTime - mediaTagTime);
12037
- const timeShiftRvcTag = rvcTime ? Math.abs(shouldBeTime - rvcTime) : null;
12038
- const mostRecentTimeshift = rvcCurrentTime.current?.lastUpdate && rvcCurrentTime.current.time > mediaTagCurrentTime.current.lastUpdate ? timeShiftRvcTag : timeShiftMediaTag;
12039
- const timeShift = timeShiftRvcTag && !isVariableFpsVideo ? mostRecentTimeshift : timeShiftMediaTag;
12040
- if (timeShift > acceptableTimeShiftButLessThanDuration && lastSeekDueToShift.current !== shouldBeTime) {
12101
+ const { current } = mediaRef;
12102
+ const action = getMediaSyncAction({
12103
+ duration: current.duration,
12104
+ currentTime: current.currentTime,
12105
+ paused: current.paused,
12106
+ ended: current.ended,
12107
+ desiredUnclampedTime,
12108
+ mediaTagTime: mediaTagCurrentTime.current.time,
12109
+ mediaTagLastUpdate: mediaTagCurrentTime.current.lastUpdate,
12110
+ rvcTime: rvcCurrentTime.current?.time ?? null,
12111
+ rvcLastUpdate: rvcCurrentTime.current?.lastUpdate ?? null,
12112
+ isVariableFpsVideo: Boolean(isVariableFpsVideoMap.current[src]),
12113
+ acceptableTimeShift: acceptableTimeShiftButLessThanDuration,
12114
+ lastSeekDueToShift: lastSeekDueToShift.current,
12115
+ playing,
12116
+ playbackRate,
12117
+ mediaTagBufferingOrStalled: isMediaTagBuffering || isBuffering(),
12118
+ playerBuffering: buffering.buffering.current,
12119
+ absoluteFrame,
12120
+ onlyWarnForMediaSeekingError,
12121
+ isPremounting,
12122
+ isPostmounting,
12123
+ pauseWhenBuffering
12124
+ });
12125
+ if (action.type === "none") {
12126
+ return;
12127
+ }
12128
+ if (action.type === "seek-due-to-shift") {
12041
12129
  lastSeek.current = seek({
12042
- mediaRef: mediaRef.current,
12043
- time: shouldBeTime,
12130
+ mediaRef: current,
12131
+ time: action.shouldBeTime,
12044
12132
  logLevel,
12045
- why: `because time shift is too big. shouldBeTime = ${shouldBeTime}, isTime = ${mediaTagTime}, requestVideoCallbackTime = ${rvcTime}, timeShift = ${timeShift}${isVariableFpsVideo ? ", isVariableFpsVideo = true" : ""}, isPremounting = ${isPremounting}, isPostmounting = ${isPostmounting}, pauseWhenBuffering = ${pauseWhenBuffering}`,
12133
+ why: action.why,
12046
12134
  mountTime
12047
12135
  });
12048
12136
  lastSeekDueToShift.current = lastSeek.current;
12049
- if (playing) {
12050
- if (playbackRate > 0) {
12051
- bufferUntilFirstFrame(shouldBeTime);
12052
- }
12053
- if (mediaRef.current.paused) {
12054
- playAndHandleNotAllowedError({
12055
- mediaRef,
12056
- mediaType,
12057
- onAutoPlayError,
12058
- logLevel,
12059
- mountTime,
12060
- reason: "player is playing but media tag is paused, and just seeked",
12061
- isPlayer: env.isPlayer
12062
- });
12063
- }
12064
- }
12065
- if (!onlyWarnForMediaSeekingError) {
12066
- warnAboutNonSeekableMedia(mediaRef.current, onlyWarnForMediaSeekingError ? "console-warning" : "console-error");
12137
+ if (action.bufferUntilFirstFrame) {
12138
+ bufferUntilFirstFrame(action.shouldBeTime);
12067
12139
  }
12068
- return;
12069
- }
12070
- const seekThreshold = playing ? 0.15 : 0.01;
12071
- const makesSenseToSeek = Math.abs(mediaRef.current.currentTime - shouldBeTime) > seekThreshold;
12072
- const isMediaTagBufferingOrStalled = isMediaTagBuffering || isBuffering();
12073
- const isSomethingElseBuffering = buffering.buffering.current && !isMediaTagBufferingOrStalled;
12074
- if (!playing || isSomethingElseBuffering) {
12075
- if (makesSenseToSeek) {
12076
- lastSeek.current = seek({
12077
- mediaRef: mediaRef.current,
12078
- time: shouldBeTime,
12140
+ if (action.playReason !== null) {
12141
+ playAndHandleNotAllowedError({
12142
+ mediaRef,
12143
+ mediaType,
12144
+ onAutoPlayError,
12079
12145
  logLevel,
12080
- why: `not playing or something else is buffering. time offset is over seek threshold (${seekThreshold})`,
12081
- mountTime
12146
+ mountTime,
12147
+ reason: action.playReason,
12148
+ isPlayer: env.isPlayer
12082
12149
  });
12083
12150
  }
12151
+ if (action.warnAboutNonSeekable) {
12152
+ warnAboutNonSeekableMedia(current, "console-error");
12153
+ }
12084
12154
  return;
12085
12155
  }
12086
- if (!playing || buffering.buffering.current) {
12087
- return;
12088
- }
12089
- const pausedCondition = mediaRef.current.paused && !mediaRef.current.ended;
12090
- const firstFrameCondition = absoluteFrame === 0;
12091
- if (pausedCondition || firstFrameCondition) {
12092
- const reason = pausedCondition ? "media tag is paused" : "absolute frame is 0";
12093
- if (makesSenseToSeek) {
12156
+ if (action.type === "seek-if-not-playing") {
12157
+ if (action.why !== null) {
12094
12158
  lastSeek.current = seek({
12095
- mediaRef: mediaRef.current,
12096
- time: shouldBeTime,
12159
+ mediaRef: current,
12160
+ time: action.shouldBeTime,
12097
12161
  logLevel,
12098
- why: `is over timeshift threshold (threshold = ${seekThreshold}) and ${reason}`,
12162
+ why: action.why,
12099
12163
  mountTime
12100
12164
  });
12101
12165
  }
12102
- playAndHandleNotAllowedError({
12103
- mediaRef,
12104
- mediaType,
12105
- onAutoPlayError,
12166
+ return;
12167
+ }
12168
+ if (action.why !== null) {
12169
+ lastSeek.current = seek({
12170
+ mediaRef: current,
12171
+ time: action.shouldBeTime,
12106
12172
  logLevel,
12107
- mountTime,
12108
- reason: `player is playing and ${reason}`,
12109
- isPlayer: env.isPlayer
12173
+ why: action.why,
12174
+ mountTime
12110
12175
  });
12111
- if (!isVariableFpsVideo && playbackRate > 0) {
12112
- bufferUntilFirstFrame(shouldBeTime);
12113
- }
12176
+ }
12177
+ playAndHandleNotAllowedError({
12178
+ mediaRef,
12179
+ mediaType,
12180
+ onAutoPlayError,
12181
+ logLevel,
12182
+ mountTime,
12183
+ reason: action.playReason,
12184
+ isPlayer: env.isPlayer
12185
+ });
12186
+ if (action.bufferUntilFirstFrame) {
12187
+ bufferUntilFirstFrame(action.shouldBeTime);
12114
12188
  }
12115
12189
  }, [
12116
12190
  absoluteFrame,
@@ -13301,6 +13375,18 @@ var loadImage = ({
13301
13375
  function exponentialBackoff(errorCount) {
13302
13376
  return 1000 * 2 ** (errorCount - 1);
13303
13377
  }
13378
+ var waitForNextFrame = ({
13379
+ onFrame
13380
+ }) => {
13381
+ if (typeof requestAnimationFrame === "undefined") {
13382
+ onFrame();
13383
+ return () => {
13384
+ return;
13385
+ };
13386
+ }
13387
+ const frame = requestAnimationFrame(onFrame);
13388
+ return () => cancelAnimationFrame(frame);
13389
+ };
13304
13390
  var CanvasImageContent = forwardRef10(({
13305
13391
  src,
13306
13392
  width,
@@ -13330,6 +13416,17 @@ var CanvasImageContent = forwardRef10(({
13330
13416
  overrideId: controls?.overrideId ?? null
13331
13417
  });
13332
13418
  const sequenceContext = useContext32(SequenceContext);
13419
+ const pendingLoadDelayRef = useRef23(null);
13420
+ const continuePendingLoadDelay = useCallback17(() => {
13421
+ const pending = pendingLoadDelayRef.current;
13422
+ if (!pending || pending.continued) {
13423
+ return;
13424
+ }
13425
+ pending.continued = true;
13426
+ pending.unblock();
13427
+ continueRender2(pending.handle);
13428
+ pendingLoadDelayRef.current = null;
13429
+ }, [continueRender2]);
13333
13430
  const sourceCanvas = useMemo31(() => {
13334
13431
  if (typeof document === "undefined") {
13335
13432
  return null;
@@ -13347,7 +13444,7 @@ var CanvasImageContent = forwardRef10(({
13347
13444
  ref.current = canvas;
13348
13445
  }
13349
13446
  }, [ref, refForOutline]);
13350
- useEffect17(() => {
13447
+ useLayoutEffect10(() => {
13351
13448
  const isPremounting = Boolean(sequenceContext?.premounting);
13352
13449
  const isPostmounting = Boolean(sequenceContext?.postmounting);
13353
13450
  const handle = delayRender2(`Rendering <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`, {
@@ -13359,17 +13456,13 @@ var CanvasImageContent = forwardRef10(({
13359
13456
  };
13360
13457
  const controller = new AbortController;
13361
13458
  let cancelled = false;
13362
- let continued = false;
13363
13459
  let errorCount = 0;
13364
13460
  let timeoutId = null;
13365
13461
  setLoadedImage(null);
13366
- const continueRenderOnce = () => {
13367
- if (continued) {
13368
- return;
13369
- }
13370
- continued = true;
13371
- unblock();
13372
- continueRender2(handle);
13462
+ pendingLoadDelayRef.current = {
13463
+ handle,
13464
+ unblock,
13465
+ continued: false
13373
13466
  };
13374
13467
  const attemptLoad = () => {
13375
13468
  loadImage({ src: actualSrc, signal: controller.signal }).then((image) => {
@@ -13377,13 +13470,9 @@ var CanvasImageContent = forwardRef10(({
13377
13470
  return;
13378
13471
  }
13379
13472
  setLoadedImage(image);
13380
- }).then(() => {
13381
- if (!cancelled) {
13382
- continueRenderOnce();
13383
- }
13384
13473
  }).catch((err) => {
13385
13474
  if (err.name === "AbortError") {
13386
- continueRenderOnce();
13475
+ continuePendingLoadDelay();
13387
13476
  return;
13388
13477
  }
13389
13478
  errorCount++;
@@ -13397,7 +13486,7 @@ var CanvasImageContent = forwardRef10(({
13397
13486
  }, backoff);
13398
13487
  } else if (onError) {
13399
13488
  onError(err);
13400
- continueRenderOnce();
13489
+ continuePendingLoadDelay();
13401
13490
  } else {
13402
13491
  cancelRender2(err);
13403
13492
  }
@@ -13410,12 +13499,12 @@ var CanvasImageContent = forwardRef10(({
13410
13499
  clearTimeout(timeoutId);
13411
13500
  }
13412
13501
  controller.abort();
13413
- continueRenderOnce();
13502
+ continuePendingLoadDelay();
13414
13503
  };
13415
13504
  }, [
13416
13505
  actualSrc,
13417
13506
  cancelRender2,
13418
- continueRender2,
13507
+ continuePendingLoadDelay,
13419
13508
  delayPlayback,
13420
13509
  delayRender2,
13421
13510
  delayRenderRetries,
@@ -13426,13 +13515,16 @@ var CanvasImageContent = forwardRef10(({
13426
13515
  sequenceContext?.postmounting,
13427
13516
  sequenceContext?.premounting
13428
13517
  ]);
13429
- useEffect17(() => {
13518
+ useLayoutEffect10(() => {
13430
13519
  if (!loadedImage || !outputCanvas || !sourceCanvas) {
13431
13520
  return;
13432
13521
  }
13433
13522
  const handle = delayRender2(`Applying effects to <CanvasImage> with src="${truncateSrcForLabel(actualSrc)}"`);
13434
13523
  let cancelled = false;
13435
13524
  let continued = false;
13525
+ let cancelWaitForNextFrame = () => {
13526
+ return;
13527
+ };
13436
13528
  const continueRenderOnce = () => {
13437
13529
  if (continued) {
13438
13530
  return;
@@ -13467,7 +13559,15 @@ var CanvasImageContent = forwardRef10(({
13467
13559
  height: canvasHeight
13468
13560
  }).then((completed) => {
13469
13561
  if (completed && !cancelled) {
13470
- continueRenderOnce();
13562
+ cancelWaitForNextFrame = waitForNextFrame({
13563
+ onFrame: () => {
13564
+ if (cancelled) {
13565
+ return;
13566
+ }
13567
+ continueRenderOnce();
13568
+ continuePendingLoadDelay();
13569
+ }
13570
+ });
13471
13571
  }
13472
13572
  }).catch((err) => {
13473
13573
  if (cancelled) {
@@ -13476,12 +13576,14 @@ var CanvasImageContent = forwardRef10(({
13476
13576
  if (onError) {
13477
13577
  onError(err);
13478
13578
  continueRenderOnce();
13579
+ continuePendingLoadDelay();
13479
13580
  } else {
13480
13581
  cancelRender2(err);
13481
13582
  }
13482
13583
  });
13483
13584
  return () => {
13484
13585
  cancelled = true;
13586
+ cancelWaitForNextFrame();
13485
13587
  continueRenderOnce();
13486
13588
  };
13487
13589
  }, [
@@ -13489,6 +13591,7 @@ var CanvasImageContent = forwardRef10(({
13489
13591
  cancelRender2,
13490
13592
  chainState,
13491
13593
  continueRender2,
13594
+ continuePendingLoadDelay,
13492
13595
  delayRender2,
13493
13596
  fit,
13494
13597
  height,
@@ -13698,7 +13801,7 @@ var ImgContent = ({
13698
13801
  if (typeof window !== "undefined") {
13699
13802
  const isPremounting = Boolean(sequenceContext?.premounting);
13700
13803
  const isPostmounting = Boolean(sequenceContext?.postmounting);
13701
- useLayoutEffect10(() => {
13804
+ useLayoutEffect11(() => {
13702
13805
  if (window.process?.env?.NODE_ENV === "test") {
13703
13806
  if (imageRef.current) {
13704
13807
  imageRef.current.src = actualSrc;
@@ -14594,7 +14697,7 @@ var OffthreadVideoForRendering = ({
14594
14697
  mediaVolume: 1
14595
14698
  });
14596
14699
  warnAboutTooHighVolume(volume);
14597
- useEffect18(() => {
14700
+ useEffect17(() => {
14598
14701
  if (!src) {
14599
14702
  throw new Error("No src passed");
14600
14703
  }
@@ -14651,7 +14754,7 @@ var OffthreadVideoForRendering = ({
14651
14754
  }, [toneMapped, currentTime, src, transparent]);
14652
14755
  const [imageSrc, setImageSrc] = useState19(null);
14653
14756
  const { delayRender: delayRender2, continueRender: continueRender2 } = useDelayRender();
14654
- useLayoutEffect11(() => {
14757
+ useLayoutEffect12(() => {
14655
14758
  if (!window.remotion_videoEnabled) {
14656
14759
  return;
14657
14760
  }
@@ -14755,7 +14858,7 @@ var useEmitVideoFrame = ({
14755
14858
  ref,
14756
14859
  onVideoFrame
14757
14860
  }) => {
14758
- useEffect19(() => {
14861
+ useEffect18(() => {
14759
14862
  const { current } = ref;
14760
14863
  if (!current) {
14761
14864
  return;
@@ -14930,7 +15033,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
14930
15033
  tag: "video",
14931
15034
  mountTime
14932
15035
  }));
14933
- useEffect20(() => {
15036
+ useEffect19(() => {
14934
15037
  const { current } = videoRef;
14935
15038
  if (!current) {
14936
15039
  return;
@@ -14973,7 +15076,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
14973
15076
  const currentOnDurationCallback = useRef27(onDuration);
14974
15077
  currentOnDurationCallback.current = onDuration;
14975
15078
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
14976
- useEffect20(() => {
15079
+ useEffect19(() => {
14977
15080
  const { current } = videoRef;
14978
15081
  if (!current) {
14979
15082
  return;
@@ -14990,7 +15093,7 @@ var VideoForDevelopmentRefForwardingFunction = (props2, ref) => {
14990
15093
  current.removeEventListener("loadedmetadata", onLoadedMetadata);
14991
15094
  };
14992
15095
  }, [src]);
14993
- useEffect20(() => {
15096
+ useEffect19(() => {
14994
15097
  const { current } = videoRef;
14995
15098
  if (!current) {
14996
15099
  return;
@@ -15605,6 +15708,15 @@ var staticFile = (path) => {
15605
15708
  }
15606
15709
  return preparsed;
15607
15710
  };
15711
+ var Still = (props2) => {
15712
+ const newProps = {
15713
+ ...props2,
15714
+ durationInFrames: 1,
15715
+ fps: 1
15716
+ };
15717
+ return React42.createElement(Composition, newProps);
15718
+ };
15719
+ addSequenceStackTraces(Still);
15608
15720
  var roundTo6Commas = (num) => {
15609
15721
  return Math.round(num * 1e5) / 1e5;
15610
15722
  };
@@ -15771,7 +15883,7 @@ var VideoForRenderingForwardFunction = ({
15771
15883
  mediaVolume: 1
15772
15884
  });
15773
15885
  warnAboutTooHighVolume(volume);
15774
- useEffect21(() => {
15886
+ useEffect20(() => {
15775
15887
  if (!props2.src) {
15776
15888
  throw new Error("No src passed");
15777
15889
  }
@@ -15815,7 +15927,7 @@ var VideoForRenderingForwardFunction = ({
15815
15927
  return videoRef.current;
15816
15928
  }, []);
15817
15929
  useEmitVideoFrame({ ref: videoRef, onVideoFrame });
15818
- useEffect21(() => {
15930
+ useEffect20(() => {
15819
15931
  if (!window.remotion_videoEnabled) {
15820
15932
  return;
15821
15933
  }
@@ -15905,7 +16017,7 @@ var VideoForRenderingForwardFunction = ({
15905
16017
  ]);
15906
16018
  const { src } = props2;
15907
16019
  if (environment.isRendering) {
15908
- useLayoutEffect12(() => {
16020
+ useLayoutEffect13(() => {
15909
16021
  if (window.process?.env?.NODE_ENV === "test") {
15910
16022
  return;
15911
16023
  }
@@ -19009,7 +19121,7 @@ var extrudeAndTransformElement = (options) => {
19009
19121
  // ../design/dist/esm/index.mjs
19010
19122
  import { jsx as jsx212, Fragment as Fragment3 } from "react/jsx-runtime";
19011
19123
  import { jsx as jsx312, jsxs as jsxs5 } from "react/jsx-runtime";
19012
- import { useEffect as useEffect23, useMemo as useMemo210, useRef as useRef31 } from "react";
19124
+ import { useEffect as useEffect22, useMemo as useMemo210, useRef as useRef31 } from "react";
19013
19125
  import { jsx as jsx44 } from "react/jsx-runtime";
19014
19126
  import { jsx as jsx53, jsxs as jsxs22 } from "react/jsx-runtime";
19015
19127
  import React62 from "react";
@@ -19264,7 +19376,7 @@ var useHoverTransforms = (ref, disabled) => {
19264
19376
  isActive: false
19265
19377
  });
19266
19378
  const eventTarget = useMemo42(() => new EventTarget, []);
19267
- useEffect22(() => {
19379
+ useEffect21(() => {
19268
19380
  if (disabled) {
19269
19381
  eventTarget.dispatchEvent(new Event("disabled"));
19270
19382
  } else {
@@ -19411,7 +19523,7 @@ var getAngle = (ref, coordinates) => {
19411
19523
  var lastCoordinates = null;
19412
19524
  var useMousePosition = (ref) => {
19413
19525
  const [angle, setAngle] = useState21(getAngle(ref.current, lastCoordinates));
19414
- useEffect22(() => {
19526
+ useEffect21(() => {
19415
19527
  const element = ref.current;
19416
19528
  if (!element) {
19417
19529
  return;
@@ -19532,7 +19644,7 @@ var Spinner = ({ size, duration }) => {
19532
19644
  };
19533
19645
  }, [size]);
19534
19646
  const pathsRef = useRef31([]);
19535
- useEffect23(() => {
19647
+ useEffect22(() => {
19536
19648
  const animate = () => {
19537
19649
  const now = performance.now();
19538
19650
  for (let index = 0;index < lines; index++) {