@remotion/media 4.0.468 → 4.0.470

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.
@@ -2060,14 +2060,14 @@ var useCommonEffects = ({
2060
2060
  }, [durationInFrames, mediaPlayerReady, mediaPlayerRef, currentTimeRef]);
2061
2061
  useLayoutEffect(() => {
2062
2062
  const mediaPlayer = mediaPlayerRef.current;
2063
- if (!mediaPlayer || !mediaPlayerReady) {
2063
+ if (!mediaPlayer) {
2064
2064
  return;
2065
2065
  }
2066
2066
  mediaPlayer.setIsPremounting(isPremounting);
2067
2067
  }, [isPremounting, mediaPlayerReady, mediaPlayerRef]);
2068
2068
  useLayoutEffect(() => {
2069
2069
  const mediaPlayer = mediaPlayerRef.current;
2070
- if (!mediaPlayer || !mediaPlayerReady) {
2070
+ if (!mediaPlayer) {
2071
2071
  return;
2072
2072
  }
2073
2073
  mediaPlayer.setIsPostmounting(isPostmounting);
@@ -4665,9 +4665,11 @@ Internals16.addSequenceStackTraces(Audio);
4665
4665
  // src/video/video.tsx
4666
4666
  import { useMemo as useMemo6, useState as useState6 } from "react";
4667
4667
  import {
4668
+ Internals as Internals20,
4669
+ Sequence as Sequence2,
4670
+ useRemotionEnvironment as useRemotionEnvironment4,
4668
4671
  useVideoConfig as useVideoConfig5
4669
4672
  } from "remotion";
4670
- import { Internals as Internals20, Sequence as Sequence2, useRemotionEnvironment as useRemotionEnvironment4 } from "remotion";
4671
4673
 
4672
4674
  // src/video/video-for-preview.tsx
4673
4675
  import {
@@ -5161,7 +5163,8 @@ var VideoForRendering = ({
5161
5163
  onError,
5162
5164
  credentials,
5163
5165
  requestInit,
5164
- objectFit: objectFitProp
5166
+ objectFit: objectFitProp,
5167
+ effects
5165
5168
  }) => {
5166
5169
  if (!src) {
5167
5170
  throw new TypeError("No `src` was passed to <Video>.");
@@ -5186,6 +5189,7 @@ var VideoForRendering = ({
5186
5189
  const audioEnabled = Internals19.useAudioEnabled();
5187
5190
  const videoEnabled = Internals19.useVideoEnabled();
5188
5191
  const maxCacheSize = useMaxMediaCacheSize(logLevel);
5192
+ const effectChainState = Internals19.useEffectChainState();
5189
5193
  const [error, setError] = useState5(null);
5190
5194
  if (error) {
5191
5195
  throw error;
@@ -5232,7 +5236,7 @@ var VideoForRendering = ({
5232
5236
  maxCacheSize,
5233
5237
  credentials,
5234
5238
  requestInit: initialRequestInit
5235
- }).then((result) => {
5239
+ }).then(async (result) => {
5236
5240
  const handleError = (err, clientSideError, fallbackMessage, mediaDurationInSeconds) => {
5237
5241
  if (environment.isClientSideRendering) {
5238
5242
  cancelRender3(clientSideError);
@@ -5287,6 +5291,20 @@ var VideoForRendering = ({
5287
5291
  context.canvas.height = imageBitmap.height;
5288
5292
  context.canvas.style.aspectRatio = `${context.canvas.width} / ${context.canvas.height}`;
5289
5293
  context.drawImage(imageBitmap, 0, 0);
5294
+ if (effects.length > 0) {
5295
+ const completed = await Internals19.runEffectChain({
5296
+ state: effectChainState.get(imageBitmap.width, imageBitmap.height),
5297
+ source: context.canvas,
5298
+ effects,
5299
+ output: context.canvas,
5300
+ width: imageBitmap.width,
5301
+ height: imageBitmap.height
5302
+ });
5303
+ if (!completed) {
5304
+ imageBitmap.close();
5305
+ return;
5306
+ }
5307
+ }
5290
5308
  }
5291
5309
  imageBitmap.close();
5292
5310
  } else if (videoEnabled) {
@@ -5365,6 +5383,8 @@ var VideoForRendering = ({
5365
5383
  headless,
5366
5384
  onError,
5367
5385
  credentials,
5386
+ effectChainState,
5387
+ effects,
5368
5388
  initialRequestInit
5369
5389
  ]);
5370
5390
  warnAboutObjectFitInStyleOrClassName({ style, className, logLevel });
@@ -5541,7 +5561,8 @@ var InnerVideo = ({
5541
5561
  onError,
5542
5562
  credentials,
5543
5563
  requestInit,
5544
- objectFit
5564
+ objectFit,
5565
+ effects
5545
5566
  });
5546
5567
  }
5547
5568
  return /* @__PURE__ */ jsx6(VideoForPreview, {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import type { LogLevel, LoopVolumeCurveBehavior, OnVideoFrame, VolumeProp } from 'remotion';
2
+ import type { EffectDefinitionAndStack, LogLevel, LoopVolumeCurveBehavior, OnVideoFrame, VolumeProp } from 'remotion';
3
3
  import { type MediaOnError } from '../on-error';
4
4
  import type { MediaRequestInit } from '../request-init';
5
5
  import type { FallbackOffthreadVideoProps, VideoObjectFit } from './props';
@@ -28,6 +28,7 @@ type InnerVideoProps = {
28
28
  readonly credentials: RequestCredentials | undefined;
29
29
  readonly requestInit: MediaRequestInit | undefined;
30
30
  readonly objectFit: VideoObjectFit;
31
+ readonly effects: EffectDefinitionAndStack<unknown>[];
31
32
  };
32
33
  export declare const VideoForRendering: React.FC<InnerVideoProps>;
33
34
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/media",
3
- "version": "4.0.468",
3
+ "version": "4.0.470",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "module": "dist/esm/index.mjs",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "mediabunny": "1.45.0",
26
- "remotion": "4.0.468",
26
+ "remotion": "4.0.470",
27
27
  "zod": "4.3.6"
28
28
  },
29
29
  "peerDependencies": {
@@ -31,7 +31,7 @@
31
31
  "react-dom": ">=16.8.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@remotion/eslint-config-internal": "4.0.468",
34
+ "@remotion/eslint-config-internal": "4.0.470",
35
35
  "@vitest/browser-webdriverio": "4.0.9",
36
36
  "eslint": "9.19.0",
37
37
  "react": "19.2.3",