🎥 Make videos programmatically with React
fix tests
Jonny Burgeree2860e6ec3d
diff --git a/packages/core/src/test/not-all-props-in-media-tags.test.ts b/packages/core/src/test/not-all-props-in-media-tags.test.tsindex 754c9afd36..cbe3873bcb 100644--- a/packages/core/src/test/not-all-props-in-media-tags.test.ts+++ b/packages/core/src/test/not-all-props-in-media-tags.test.ts@@ -13,7 +13,7 @@ test('Should not have disableRemotePlayback props in the <VideoForPreview> compo);const read = fs.readFileSync(file, 'utf-8');expect(read).not.toContain('disableRemotePlayback');- expect(read).toContain('volume-prop');+ expect(read).toContain('./props.js');});test('Should not have disableRemotePlayback props in the <VideoForPreview> component type definition', () => {@@ -26,20 +26,20 @@ test('Should not have disableRemotePlayback props in the <VideoForPreview> compo);const read = fs.readFileSync(file, 'utf-8');expect(read).not.toContain('disableRemotePlayback');- expect(read).toContain('volume-prop');+ expect(read).toContain('./props.js');});-test('Should not have disableRemotePlayback props in the <AudioForDevelopment> component type definition', () => {+test('Should not have disableRemotePlayback props in the <AudioForPreview> component type definition', () => {const file = path.resolve(process.cwd(),'dist','esm','audio',- 'AudioForDevelopment.d.ts',+ 'AudioForPreview.d.ts',);const read = fs.readFileSync(file, 'utf-8');expect(read).not.toContain('aria-disabled');- expect(read).toContain('volume-prop');+ expect(read).toContain('./props.js');});test('Should not have disableRemotePlayback props in the <AudioForRendering> component type definition', () => {diff --git a/packages/core/src/use-buffer-state.ts b/packages/core/src/use-buffer-state.tsindex bfd995d0e7..6a375b5339 100644--- a/packages/core/src/use-buffer-state.ts+++ b/packages/core/src/use-buffer-state.ts@@ -1,32 +1,18 @@import {useContext, useMemo} from 'react';import {BufferingContextReact} from './buffering';-import {CanUseRemotionHooks} from './CanUseRemotionHooks';export const useBufferState = () => {- const canUseRemotionHooks = useContext(CanUseRemotionHooks);-- if (!canUseRemotionHooks) {- if (typeof window !== 'undefined' && window.remotion_isPlayer) {- throw new Error(- `useBufferState() can only be called inside a component that was passed to <Player>. See: https://www.remotion.dev/docs/player/examples`,- );- }-- throw new Error(- `useBufferState() can only be called inside a component that was registered as a composition. See https://www.remotion.dev/docs/the-fundamentals#defining-compositions`,- );- }-const buffer = useContext(BufferingContextReact);- if (!buffer) {- throw new Error(- 'BufferingContextReact was unexpectedly not found. Most likely your Remotion versions are mismatching.',- );- }return useMemo(() => ({delayPlayback: () => {+ if (!buffer) {+ throw new Error(+ 'Tried to enable the buffering state, but a Remotion context was not found. This API can only be called in a component that was passed to the Remotion Player or a <Composition>. Or you might have experienced a version mismatch - run `npx remotion versions` and ensure all packages have the same version. This error is thrown by the buffer state https://remotion.dev/docs/player/buffer-state',+ );+ }+const {unblock} = buffer.addBlock({id: String(Math.random()),});