Skip to content

🎥 Make videos programmatically with React

`remotion`: Fix useCurrentScale() during rendering

Jonny Burger8a945a9d208d
diff --git a/packages/core/src/use-current-scale.ts b/packages/core/src/use-current-scale.ts
index 875ab47cdf..ad2176e1a3 100644
--- a/packages/core/src/use-current-scale.ts
+++ b/packages/core/src/use-current-scale.ts
@@ -1,4 +1,5 @@
import React, {createContext} from 'react';
+import {getRemotionEnvironment} from './get-remotion-environment';
import {useUnsafeVideoConfig} from './use-unsafe-video-config';
export type CurrentScaleContextType =
@@ -74,6 +75,10 @@ export const useCurrentScale = (options?: Options) => {
return 1;
}
+ if (getRemotionEnvironment().isRendering) {
+ return 1;
+ }
+
throw new Error(
[
'useCurrentScale() was called outside of a Remotion context.',