π₯ Make videos programmatically with React
removing setInterval
Bankkc98943a9b6ca
diff --git a/packages/player/src/license-blacklist.tsx b/packages/player/src/license-blacklist.tsxindex 7454b5754d..5a10e2d9c2 100644--- a/packages/player/src/license-blacklist.tsx+++ b/packages/player/src/license-blacklist.tsx@@ -65,36 +65,33 @@ export const RenderWarningIfBlacklist: React.FC = () => {}, []);useEffect(() => {- if (!unlicensed) return;-- const ensureBanner = () => {- const banner = document.querySelector('.warning-banner');- if (!banner) {- const div = document.createElement('div');- div.className = 'warning-banner';- Object.assign(div.style, style, { zIndex: '9999', cssText: `${style.cssText} !important;` });- div.innerHTML = `- <a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">- Remotion Unlicensed β Contact [email protected]- </a>- `;- document.body.appendChild(div);- }- };-- // Check every second to ensure the banner is present- const interval = setInterval(ensureBanner, 1000);-- // Optional: MutationObserver for immediate detection- const observer = new MutationObserver(() => ensureBanner());- observer.observe(document.body, { childList: true, subtree: true });-- return () => {- clearInterval(interval);- observer.disconnect();- };+ if (!unlicensed) return;++ const ensureBanner = () => {+ const banner = document.querySelector('.warning-banner');+ if (!banner) {+ const div = document.createElement('div');+ div.className = 'warning-banner';+ Object.assign(div.style, style, { zIndex: '9999', cssText: `${style.cssText} !important;` });+ div.innerHTML = `+ <a href="https://github.com/remotion-dev/remotion/pull/4589" style="color: white;">+ Remotion Unlicensed β Contact [email protected]+ </a>+ `;+ document.body.appendChild(div);+ }+ };++ // Using MutationObserver to watch for changes+ const observer = new MutationObserver(() => ensureBanner());+ observer.observe(document.body, { childList: true, subtree: true });++ return () => {+ observer.disconnect();+ };}, [unlicensed]);+if (!unlicensed) {return null;}