🎥 Make videos programmatically with React
Revert "`remotion`: Add `isReadOnlyStudio` field to `getRemotionEnvironment()`"
Jonny Burger120f28ab7708
diff --git a/packages/core/src/get-remotion-environment.ts b/packages/core/src/get-remotion-environment.tsindex 4f369b767b..f2eca95ec3 100644--- a/packages/core/src/get-remotion-environment.ts+++ b/packages/core/src/get-remotion-environment.ts@@ -2,7 +2,6 @@ export type RemotionEnvironment = {isStudio: boolean;isRendering: boolean;isPlayer: boolean;- isReadOnlyStudio: boolean;};// Avoid VITE obfuscation@@ -29,13 +28,10 @@ export const getRemotionEnvironment = (): RemotionEnvironment => {typeof window !== 'undefined' &&typeof window.remotion_puppeteerTimeout !== 'undefined'));const isStudio = typeof window !== 'undefined' && window.remotion_isStudio;- const isReadOnlyStudio =- typeof window !== 'undefined' && window.remotion_isReadOnlyStudio;return {isStudio,isRendering,isPlayer,- isReadOnlyStudio,};};diff --git a/packages/docs/docs/get-remotion-environment.mdx b/packages/docs/docs/get-remotion-environment.mdxindex c0f5a59cab..982352b5c6 100644--- a/packages/docs/docs/get-remotion-environment.mdx+++ b/packages/docs/docs/get-remotion-environment.mdx@@ -2,7 +2,7 @@image: /generated/articles-docs-get-remotion-environment.pngtitle: getRemotionEnvironment()id: get-remotion-environment-crumb: 'API'+crumb: "API"---# getRemotionEnvironment()<AvailableFrom v="4.0.25" />@@ -13,18 +13,17 @@ It returns an object with the following properties:- `isStudio`: Whether the function got called in the [Remotion Studio](/docs/cli/studio).- `isRendering`: Whether the function got called in a render.- `isPlayer`: Whether a [`<Player>`](/docs/player) is mounted on the current page.-- `isReadOnlyStudio`: Whether in a [statically deployed studio](https://www.remotion.dev/docs/studio/deploy-static), where the [`@remotion/studio`](/docs/studio/api) APIs cannot be used (_available from v4.0.238_)This can be useful if you want components or functions to behave differently depending on the environment.### Example```tsx twoslash-import React from 'react';-import {getRemotionEnvironment} from 'remotion';+import React from "react";+import { getRemotionEnvironment } from "remotion";export const MyComp: React.FC = () => {- const {isStudio, isPlayer, isRendering} = getRemotionEnvironment();+ const { isStudio, isPlayer, isRendering } = getRemotionEnvironment();if (isStudio) {return <div>I'm in the Studio!</div>;diff --git a/packages/template-code-hike/src/ReloadOnCodeChange.tsx b/packages/template-code-hike/src/ReloadOnCodeChange.tsxindex c57ec86abf..741effb9bb 100644--- a/packages/template-code-hike/src/ReloadOnCodeChange.tsx+++ b/packages/template-code-hike/src/ReloadOnCodeChange.tsx@@ -2,7 +2,6 @@ import { getStaticFiles, reevaluateComposition } from "@remotion/studio";import { useState } from "react";import React, { useEffect } from "react";import { watchPublicFolder } from "@remotion/studio";-import { getRemotionEnvironment } from "remotion";const getCurrentHash = () => {const files = getStaticFiles();@@ -15,10 +14,6 @@ export const RefreshOnCodeChange: React.FC = () => {const [files, setFiles] = useState(getCurrentHash());useEffect(() => {- if (getRemotionEnvironment().isReadOnlyStudio) {- return;- }-const { cancel } = watchPublicFolder(() => {const hash = getCurrentHash();if (hash !== files) {