π₯ Make videos programmatically with React
`@remotion/player`: Show banner on sites that do not respect license
Jonny Burgerf5b2ee606b55
diff --git a/packages/player/src/PlayerUI.tsx b/packages/player/src/PlayerUI.tsxindex d437b39782..fc4455d4c0 100644--- a/packages/player/src/PlayerUI.tsx+++ b/packages/player/src/PlayerUI.tsx@@ -26,6 +26,7 @@ import {calculateOuterStyle,} from './calculate-scale.js';import {ErrorBoundary} from './error-boundary.js';+import {RenderWarningIfBlacklist} from './license-blacklist.js';import {playerCssClassname} from './player-css-classname.js';import type {PlayerMethods, PlayerRef} from './player-methods.js';import type {RenderVolumeSlider} from './render-volume-slider.js';@@ -650,6 +651,7 @@ const PlayerUI: React.ForwardRefRenderFunction<</div>) : null}</div>+ <RenderWarningIfBlacklist /></div>{shouldShowPoster && posterFillMode === 'player-size' ? (<divdiff --git a/packages/player/src/license-blacklist.tsx b/packages/player/src/license-blacklist.tsxnew file mode 100644index 0000000000..3c55ede64e--- /dev/null+++ b/packages/player/src/license-blacklist.tsx@@ -0,0 +1,39 @@+import React from 'react';++export const getHashOfDomain = async (): Promise<string | null> => {+ if (typeof window === 'undefined') {+ return null;+ }++ if (typeof window.crypto === 'undefined') {+ return null;+ }++ if (typeof window.crypto.subtle === 'undefined') {+ return null;+ }++ try {+ const hashBuffer = await crypto.subtle.digest(+ 'SHA-256',+ new TextEncoder().encode(window.location.hostname),+ );++ return Array.from(new Uint8Array(hashBuffer))+ .map((b) => b.toString(16).padStart(2, '0'))+ .join('');+ } catch {+ return null;+ }+};++const style: React.CSSProperties = {+ backgroundColor: 'red',+ position: 'absolute',+ padding: 12,+ fontFamily: 'Arial',+};++export const RenderWarningIfBlacklist: React.FC = () => {+ return <div style={style}>Remotion Unlicensed β Contact [email protected]</div>;+};