@remotion/media 4.0.432 → 4.0.434

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { LogLevel, LoopVolumeCurveBehavior, VolumeProp } from 'remotion';
2
+ import type { LogLevel, LoopVolumeCurveBehavior, SequenceControls, VolumeProp } from 'remotion';
3
3
  import { type MediaOnError } from '../on-error';
4
4
  import type { FallbackHtml5AudioProps } from './props';
5
5
  type InnerAudioProps = {
@@ -28,5 +28,7 @@ type InnerAudioProps = {
28
28
  readonly debugAudioScheduling?: boolean;
29
29
  readonly onError?: MediaOnError;
30
30
  };
31
- export declare const AudioForPreview: React.FC<InnerAudioProps>;
31
+ export declare const AudioForPreview: React.FC<InnerAudioProps & {
32
+ readonly controls: SequenceControls | undefined;
33
+ }>;
32
34
  export {};
@@ -7,6 +7,10 @@ export type QueuedNode = {
7
7
  scheduledTime: number;
8
8
  playbackRate: number;
9
9
  };
10
+ export type QueuedPeriod = {
11
+ from: number;
12
+ until: number;
13
+ };
10
14
  export declare const makeAudioIterator: (startFromSecond: number, maximumTimestamp: number, cache: {
11
15
  prewarmIteratorForLooping: ({ timeToSeek, maximumTimestamp, }: {
12
16
  timeToSeek: number;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import type { AudioProps } from './props';
3
- export declare const Audio: React.FC<AudioProps>;
3
+ export declare const Audio: React.ComponentType<AudioProps>;
@@ -428,6 +428,17 @@ function makePredecodingIterator(inner) {
428
428
  });
429
429
  };
430
430
  prefetch();
431
+ const _return = () => {
432
+ returned = true;
433
+ buffer.length = 0;
434
+ if (waiter) {
435
+ const w = waiter;
436
+ waiter = null;
437
+ w({ value: undefined, done: true });
438
+ }
439
+ inner.return(undefined);
440
+ return Promise.resolve({ value: undefined, done: true });
441
+ };
431
442
  const iterator = {
432
443
  next() {
433
444
  if (buffer.length > 0) {
@@ -447,17 +458,7 @@ function makePredecodingIterator(inner) {
447
458
  prefetch();
448
459
  });
449
460
  },
450
- return() {
451
- returned = true;
452
- buffer.length = 0;
453
- if (waiter) {
454
- const w = waiter;
455
- waiter = null;
456
- w({ value: undefined, done: true });
457
- }
458
- inner.return(undefined);
459
- return Promise.resolve({ value: undefined, done: true });
460
- },
461
+ return: _return,
461
462
  throw(e) {
462
463
  returned = true;
463
464
  buffer.length = 0;
@@ -780,7 +781,11 @@ var audioIteratorManager = ({
780
781
  return;
781
782
  }
782
783
  const queuedPeriod = audioBufferIterator.getQueuedPeriod();
783
- const currentTimeIsAlreadyQueued = isAlreadyQueued(newTime, queuedPeriod);
784
+ const queuedPeriodMinusLatency = queuedPeriod ? {
785
+ from: queuedPeriod.from - ALLOWED_GLOBAL_TIME_ANCHOR_SHIFT - sharedAudioContext.baseLatency - sharedAudioContext.outputLatency,
786
+ until: queuedPeriod.until
787
+ } : null;
788
+ const currentTimeIsAlreadyQueued = isAlreadyQueued(newTime, queuedPeriodMinusLatency);
784
789
  if (!currentTimeIsAlreadyQueued) {
785
790
  const audioSatisfyResult = await audioBufferIterator.tryToSatisfySeek(newTime, (buffer) => {
786
791
  if (!nonce.isStale()) {
@@ -1879,7 +1884,7 @@ var useCommonEffects = ({
1879
1884
  };
1880
1885
 
1881
1886
  // src/use-media-in-timeline.ts
1882
- import { useContext as useContext2, useEffect, useState } from "react";
1887
+ import { useContext as useContext2, useState, useEffect } from "react";
1883
1888
  import { Internals as Internals9, useCurrentFrame } from "remotion";
1884
1889
  var useMediaInTimeline = ({
1885
1890
  volume,
@@ -1941,7 +1946,7 @@ var useMediaInTimeline = ({
1941
1946
  displayName: finalDisplayName,
1942
1947
  rootId,
1943
1948
  showInTimeline: true,
1944
- nonce,
1949
+ nonce: nonce.get(),
1945
1950
  loopDisplay,
1946
1951
  stack,
1947
1952
  from: 0,
@@ -1961,7 +1966,7 @@ var useMediaInTimeline = ({
1961
1966
  rootId,
1962
1967
  volume: volumes,
1963
1968
  showInTimeline: true,
1964
- nonce,
1969
+ nonce: nonce.get(),
1965
1970
  startMediaFrom: 0 - startsAt + (trimBefore ?? 0),
1966
1971
  doesVolumeChange,
1967
1972
  loopDisplay: undefined,
@@ -2051,7 +2056,7 @@ var AudioForPreviewAssertedShowing = ({
2051
2056
  const [mediaPlayerReady, setMediaPlayerReady] = useState2(false);
2052
2057
  const [shouldFallbackToNativeAudio, setShouldFallbackToNativeAudio] = useState2(false);
2053
2058
  const [playing] = Timeline.usePlayingState();
2054
- const timelineContext = useContext3(Internals10.TimelineContext);
2059
+ const timelineContext = Internals10.useTimelineContext();
2055
2060
  const globalPlaybackRate = timelineContext.playbackRate;
2056
2061
  const sharedAudioContext = useContext3(SharedAudioContext);
2057
2062
  const buffer = useBufferState();
@@ -2283,33 +2288,15 @@ var AudioForPreviewAssertedShowing = ({
2283
2288
  }
2284
2289
  return null;
2285
2290
  };
2286
- var audioSchema = {
2287
- volume: {
2288
- type: "number",
2289
- min: 0,
2290
- max: 20,
2291
- step: 0.01,
2292
- default: 1,
2293
- description: "Volume"
2294
- },
2295
- playbackRate: {
2296
- type: "number",
2297
- min: 0.1,
2298
- step: 0.01,
2299
- default: 1,
2300
- description: "Playback Rate"
2301
- },
2302
- loop: { type: "boolean", default: false, description: "Loop" }
2303
- };
2304
2291
  var AudioForPreview = ({
2305
- loop: loopProp = false,
2292
+ loop = false,
2306
2293
  src,
2307
2294
  logLevel,
2308
2295
  muted,
2309
2296
  name,
2310
- volume: volumeProp,
2297
+ volume,
2311
2298
  loopVolumeCurveBehavior,
2312
- playbackRate: playbackRateProp = 1,
2299
+ playbackRate = 1,
2313
2300
  trimAfter,
2314
2301
  trimBefore,
2315
2302
  showInTimeline,
@@ -2319,19 +2306,9 @@ var AudioForPreview = ({
2319
2306
  audioStreamIndex,
2320
2307
  fallbackHtml5AudioProps,
2321
2308
  debugAudioScheduling,
2322
- onError
2309
+ onError,
2310
+ controls
2323
2311
  }) => {
2324
- const schemaInput = useMemo2(() => {
2325
- return {
2326
- volume: volumeProp,
2327
- playbackRate: playbackRateProp,
2328
- loop: loopProp
2329
- };
2330
- }, [volumeProp, playbackRateProp, loopProp]);
2331
- const {
2332
- controls,
2333
- values: { volume, playbackRate, loop }
2334
- } = Internals10.useSchema(audioSchema, schemaInput);
2335
2312
  const preloadedSrc = usePreload(src);
2336
2313
  const defaultLogLevel = Internals10.useLogLevel();
2337
2314
  const frame = useCurrentFrame2();
@@ -4438,8 +4415,26 @@ var AudioForRendering = ({
4438
4415
  // src/audio/audio.tsx
4439
4416
  import { jsx as jsx3 } from "react/jsx-runtime";
4440
4417
  var { validateMediaProps } = Internals19;
4441
- var Audio = (props) => {
4442
- const { name, stack, showInTimeline, ...otherProps } = props;
4418
+ var audioSchema = {
4419
+ volume: {
4420
+ type: "number",
4421
+ min: 0,
4422
+ max: 20,
4423
+ step: 0.01,
4424
+ default: 1,
4425
+ description: "Volume"
4426
+ },
4427
+ playbackRate: {
4428
+ type: "number",
4429
+ min: 0.1,
4430
+ step: 0.01,
4431
+ default: 1,
4432
+ description: "Playback Rate"
4433
+ },
4434
+ loop: { type: "boolean", default: false, description: "Loop" }
4435
+ };
4436
+ var AudioInner = (props) => {
4437
+ const { name, stack, showInTimeline, controls, ...otherProps } = props;
4443
4438
  const environment = useRemotionEnvironment2();
4444
4439
  if (typeof props.src !== "string") {
4445
4440
  throw new TypeError(`The \`<Audio>\` tag requires a string for \`src\`, but got ${JSON.stringify(props.src)} instead.`);
@@ -4453,9 +4448,11 @@ var Audio = (props) => {
4453
4448
  return /* @__PURE__ */ jsx3(AudioForPreview, {
4454
4449
  name,
4455
4450
  ...otherProps,
4456
- stack: stack ?? null
4451
+ stack: stack ?? null,
4452
+ controls
4457
4453
  });
4458
4454
  };
4455
+ var Audio = Internals19.wrapInSchema(AudioInner, audioSchema);
4459
4456
  Internals19.addSequenceStackTraces(Audio);
4460
4457
 
4461
4458
  // src/video/video.tsx
@@ -4527,7 +4524,7 @@ var VideoForPreviewAssertedShowing = ({
4527
4524
  const [mediaPlayerReady, setMediaPlayerReady] = useState4(false);
4528
4525
  const [shouldFallbackToNativeVideo, setShouldFallbackToNativeVideo] = useState4(false);
4529
4526
  const [playing] = Timeline2.usePlayingState();
4530
- const timelineContext = useContext5(Internals20.TimelineContext);
4527
+ const timelineContext = Internals20.useTimelineContext();
4531
4528
  const globalPlaybackRate = timelineContext.playbackRate;
4532
4529
  const sharedAudioContext = useContext5(SharedAudioContext2);
4533
4530
  const buffer = useBufferState2();
@@ -4784,44 +4781,15 @@ var VideoForPreviewAssertedShowing = ({
4784
4781
  className: classNameValue
4785
4782
  });
4786
4783
  };
4787
- var videoSchema = {
4788
- volume: {
4789
- type: "number",
4790
- min: 0,
4791
- max: 20,
4792
- step: 0.01,
4793
- default: 1,
4794
- description: "Volume"
4795
- },
4796
- playbackRate: {
4797
- type: "number",
4798
- min: 0.1,
4799
- step: 0.01,
4800
- default: 1,
4801
- description: "Playback Rate"
4802
- },
4803
- loop: { type: "boolean", default: false, description: "Loop" }
4804
- };
4805
4784
  var VideoForPreview = (props) => {
4806
- const schemaInput = useMemo4(() => {
4807
- return {
4808
- volume: props.volume,
4809
- playbackRate: props.playbackRate,
4810
- loop: props.loop
4811
- };
4812
- }, [props.volume, props.playbackRate, props.loop]);
4813
- const {
4814
- controls,
4815
- values: { loop, playbackRate, volume }
4816
- } = Internals20.useSchema(videoSchema, schemaInput);
4817
4785
  const frame = useCurrentFrame4();
4818
4786
  const videoConfig = useVideoConfig3();
4819
4787
  const currentTime = frame / videoConfig.fps;
4820
4788
  const showShow = useMemo4(() => {
4821
4789
  return getTimeInSeconds({
4822
4790
  unloopedTimeInSeconds: currentTime,
4823
- playbackRate,
4824
- loop,
4791
+ playbackRate: props.playbackRate,
4792
+ loop: props.loop,
4825
4793
  trimBefore: props.trimBefore,
4826
4794
  trimAfter: props.trimAfter,
4827
4795
  mediaDurationInSeconds: Infinity,
@@ -4831,8 +4799,8 @@ var VideoForPreview = (props) => {
4831
4799
  }) !== null;
4832
4800
  }, [
4833
4801
  currentTime,
4834
- loop,
4835
- playbackRate,
4802
+ props.loop,
4803
+ props.playbackRate,
4836
4804
  props.src,
4837
4805
  videoConfig.fps,
4838
4806
  props.trimBefore,
@@ -4843,10 +4811,7 @@ var VideoForPreview = (props) => {
4843
4811
  }
4844
4812
  return /* @__PURE__ */ jsx4(VideoForPreviewAssertedShowing, {
4845
4813
  ...props,
4846
- volume: volume ?? 1,
4847
- playbackRate,
4848
- loop,
4849
- controls
4814
+ controls: props.controls
4850
4815
  });
4851
4816
  };
4852
4817
 
@@ -5159,6 +5124,52 @@ var VideoForRendering = ({
5159
5124
  // src/video/video.tsx
5160
5125
  import { jsx as jsx6 } from "react/jsx-runtime";
5161
5126
  var { validateMediaTrimProps, resolveTrimProps, validateMediaProps: validateMediaProps2 } = Internals22;
5127
+ var videoSchema = {
5128
+ volume: {
5129
+ type: "number",
5130
+ min: 0,
5131
+ max: 20,
5132
+ step: 0.01,
5133
+ default: 1,
5134
+ description: "Volume"
5135
+ },
5136
+ playbackRate: {
5137
+ type: "number",
5138
+ min: 0.1,
5139
+ step: 0.01,
5140
+ default: 1,
5141
+ description: "Playback Rate"
5142
+ },
5143
+ loop: { type: "boolean", default: false, description: "Loop" },
5144
+ "style.translate": {
5145
+ type: "translate",
5146
+ step: 1,
5147
+ default: "0px 0px",
5148
+ description: "Position"
5149
+ },
5150
+ "style.scale": {
5151
+ type: "number",
5152
+ min: 0.05,
5153
+ max: 100,
5154
+ step: 0.01,
5155
+ default: 1,
5156
+ description: "Scale"
5157
+ },
5158
+ "style.rotate": {
5159
+ type: "rotation",
5160
+ step: 1,
5161
+ default: "0deg",
5162
+ description: "Rotation"
5163
+ },
5164
+ "style.opacity": {
5165
+ type: "number",
5166
+ min: 0,
5167
+ max: 1,
5168
+ step: 0.01,
5169
+ default: 1,
5170
+ description: "Opacity"
5171
+ }
5172
+ };
5162
5173
  var InnerVideo = ({
5163
5174
  src,
5164
5175
  audioStreamIndex,
@@ -5184,7 +5195,8 @@ var InnerVideo = ({
5184
5195
  debugOverlay,
5185
5196
  debugAudioScheduling,
5186
5197
  headless,
5187
- onError
5198
+ onError,
5199
+ controls
5188
5200
  }) => {
5189
5201
  const environment = useRemotionEnvironment4();
5190
5202
  if (typeof src !== "string") {
@@ -5251,10 +5263,11 @@ var InnerVideo = ({
5251
5263
  debugOverlay: debugOverlay ?? false,
5252
5264
  debugAudioScheduling: debugAudioScheduling ?? false,
5253
5265
  headless: headless ?? false,
5254
- onError
5266
+ onError,
5267
+ controls
5255
5268
  });
5256
5269
  };
5257
- var Video = ({
5270
+ var VideoInner = ({
5258
5271
  src,
5259
5272
  audioStreamIndex,
5260
5273
  className,
@@ -5279,7 +5292,8 @@ var Video = ({
5279
5292
  debugOverlay,
5280
5293
  debugAudioScheduling,
5281
5294
  headless,
5282
- onError
5295
+ onError,
5296
+ controls
5283
5297
  }) => {
5284
5298
  const fallbackLogLevel = Internals22.useLogLevel();
5285
5299
  return /* @__PURE__ */ jsx6(InnerVideo, {
@@ -5307,9 +5321,11 @@ var Video = ({
5307
5321
  debugOverlay: debugOverlay ?? false,
5308
5322
  debugAudioScheduling: debugAudioScheduling ?? false,
5309
5323
  headless: headless ?? false,
5310
- onError
5324
+ onError,
5325
+ controls
5311
5326
  });
5312
5327
  };
5328
+ var Video = Internals22.wrapInSchema(VideoInner, videoSchema);
5313
5329
  Internals22.addSequenceStackTraces(Video);
5314
5330
 
5315
5331
  // src/index.ts
package/dist/index.d.ts CHANGED
@@ -3,11 +3,41 @@ import { Video } from './video/video';
3
3
  /**
4
4
  * @deprecated Now just `Audio`
5
5
  */
6
- export declare const experimental_Audio: import("react").FC<import(".").AudioProps>;
6
+ export declare const experimental_Audio: import("react").ComponentType<import(".").AudioProps>;
7
7
  /**
8
8
  * @deprecated Now just `Video`
9
9
  */
10
- export declare const experimental_Video: import("react").FC<import(".").VideoProps>;
10
+ export declare const experimental_Video: import("react").ComponentType<{
11
+ src: string;
12
+ } & Partial<{
13
+ trimBefore: number | undefined;
14
+ trimAfter: number | undefined;
15
+ }> & Partial<{
16
+ className: string | undefined;
17
+ volume: import("remotion").VolumeProp;
18
+ loopVolumeCurveBehavior: import("remotion").LoopVolumeCurveBehavior;
19
+ name: string | undefined;
20
+ onVideoFrame: import("remotion").OnVideoFrame | undefined;
21
+ playbackRate: number;
22
+ muted: boolean;
23
+ delayRenderRetries: number | null;
24
+ delayRenderTimeoutInMilliseconds: number | null;
25
+ style: import("react").CSSProperties;
26
+ stack: string | undefined;
27
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
28
+ loop: boolean;
29
+ audioStreamIndex: number;
30
+ disallowFallbackToOffthreadVideo: boolean;
31
+ fallbackOffthreadVideoProps: import(".").FallbackOffthreadVideoProps;
32
+ trimAfter: number | undefined;
33
+ trimBefore: number | undefined;
34
+ toneFrequency: number;
35
+ showInTimeline: boolean;
36
+ debugOverlay: boolean;
37
+ debugAudioScheduling: boolean;
38
+ headless: boolean;
39
+ onError: import("./on-error").MediaOnError | undefined;
40
+ }>>;
11
41
  export { AudioForPreview } from './audio/audio-for-preview';
12
42
  export { AudioProps, FallbackHtml5AudioProps } from './audio/props';
13
43
  export { MediaErrorAction } from './on-error';
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { LogLevel, LoopVolumeCurveBehavior, VolumeProp } from 'remotion';
2
+ import type { LogLevel, LoopVolumeCurveBehavior, SequenceControls, VolumeProp } from 'remotion';
3
3
  import { type MediaOnError } from '../on-error';
4
4
  import type { FallbackOffthreadVideoProps } from './props';
5
5
  type VideoForPreviewProps = {
@@ -26,5 +26,7 @@ type VideoForPreviewProps = {
26
26
  readonly headless: boolean;
27
27
  readonly onError: MediaOnError | undefined;
28
28
  };
29
- export declare const VideoForPreview: React.FC<VideoForPreviewProps>;
29
+ export declare const VideoForPreview: React.FC<VideoForPreviewProps & {
30
+ readonly controls: SequenceControls | undefined;
31
+ }>;
30
32
  export {};
@@ -1,3 +1,32 @@
1
1
  import React from 'react';
2
- import type { VideoProps } from './props';
3
- export declare const Video: React.FC<VideoProps>;
2
+ export declare const Video: React.ComponentType<{
3
+ src: string;
4
+ } & Partial<{
5
+ trimBefore: number | undefined;
6
+ trimAfter: number | undefined;
7
+ }> & Partial<{
8
+ className: string | undefined;
9
+ volume: import("remotion").VolumeProp;
10
+ loopVolumeCurveBehavior: import("remotion").LoopVolumeCurveBehavior;
11
+ name: string | undefined;
12
+ onVideoFrame: import("remotion").OnVideoFrame | undefined;
13
+ playbackRate: number;
14
+ muted: boolean;
15
+ delayRenderRetries: number | null;
16
+ delayRenderTimeoutInMilliseconds: number | null;
17
+ style: React.CSSProperties;
18
+ stack: string | undefined;
19
+ logLevel: "error" | "info" | "trace" | "verbose" | "warn";
20
+ loop: boolean;
21
+ audioStreamIndex: number;
22
+ disallowFallbackToOffthreadVideo: boolean;
23
+ fallbackOffthreadVideoProps: import("./props").FallbackOffthreadVideoProps;
24
+ trimAfter: number | undefined;
25
+ trimBefore: number | undefined;
26
+ toneFrequency: number;
27
+ showInTimeline: boolean;
28
+ debugOverlay: boolean;
29
+ debugAudioScheduling: boolean;
30
+ headless: boolean;
31
+ onError: import("../on-error").MediaOnError | undefined;
32
+ }>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/media",
3
- "version": "4.0.432",
3
+ "version": "4.0.434",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -22,8 +22,8 @@
22
22
  "make": "tsgo && bun --env-file=../.env.bundle bundle.ts"
23
23
  },
24
24
  "dependencies": {
25
- "mediabunny": "1.35.1",
26
- "remotion": "4.0.432",
25
+ "mediabunny": "1.37.0",
26
+ "remotion": "4.0.434",
27
27
  "zod": "4.3.6"
28
28
  },
29
29
  "peerDependencies": {
@@ -31,14 +31,14 @@
31
31
  "react-dom": ">=16.8.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@remotion/eslint-config-internal": "4.0.432",
34
+ "@remotion/eslint-config-internal": "4.0.434",
35
35
  "@vitest/browser-webdriverio": "4.0.9",
36
36
  "eslint": "9.19.0",
37
37
  "react": "19.2.3",
38
38
  "react-dom": "19.2.3",
39
39
  "vitest": "4.0.9",
40
40
  "webdriverio": "9.19.2",
41
- "@typescript/native-preview": "7.0.0-dev.20260301.1"
41
+ "@typescript/native-preview": "7.0.0-dev.20260217.1"
42
42
  },
43
43
  "keywords": [],
44
44
  "publishConfig": {
@@ -1,5 +0,0 @@
1
- export declare const calculatePlaybackTime: ({ audioSyncAnchor, currentTime, playbackRate, }: {
2
- audioSyncAnchor: number;
3
- currentTime: number;
4
- playbackRate: number;
5
- }) => number;