Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix GIFs in Strict Mode #1347

Merged
merged 1 commit into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/babel-loader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"@webhotelier/webpack-fast-refresh": "5.1.0",
"babel-loader": "8.2.2",
"react-refresh": "0.9.0",
"webpack": "5.72.0"
"webpack": "5.74.0"
},
"devDependencies": {
"@jonny/eslint-config": "3.0.266",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"react-refresh": "0.9.0",
"remotion": "3.2.23",
"style-loader": "2.0.0",
"webpack": "5.72.0"
"webpack": "5.74.0"
},
"peerDependencies": {
"react": ">=16.8.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"rimraf": "^3.0.2",
"typescript": "^4.7.0",
"vitest": "^0.18.0",
"webpack": "5.72.0"
"webpack": "5.74.0"
},
"keywords": [
"remotion",
Expand Down
2 changes: 1 addition & 1 deletion packages/gif/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"react": "18.0.0",
"react-dom": "18.0.0",
"typescript": "^4.7.0",
"webpack": "5.72.0"
"webpack": "5.74.0"
},
"peerDependencies": {
"react": ">=16.8.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/gif/src/GifForDevelopment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const GifForDevelopment = forwardRef<
})
.catch((err) => {
if (aborted) {
continueRender(newHandle);
return;
}

Expand Down Expand Up @@ -83,7 +84,7 @@ export const GifForDevelopment = forwardRef<
}

throw new Error(
`Failed to render GIF with source ${src}: "${error.message}". Render with --log=verbose to see the full stack.`
`Failed to render GIF with source ${src}: "${error.message}".`
);
}

Expand Down
1 change: 1 addition & 0 deletions packages/gif/src/GifForRendering.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export const GifForRendering = forwardRef<HTMLCanvasElement, RemotionGifProps>(
})
.catch((err) => {
if (aborted) {
continueRender(newHandle);
return;
}

Expand Down
7 changes: 2 additions & 5 deletions packages/gif/src/react-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,8 @@ export const parseGif = async ({
return generate(raw);
};

let worker: Worker | null = null;

export const parseWithWorker = (src: string) => {
if (!worker) {
worker = makeWorker();
}
const worker = makeWorker();

let handler: ((e: MessageEvent) => void) | null = null;

Expand Down Expand Up @@ -50,6 +46,7 @@ export const parseWithWorker = (src: string) => {
'message',
handler as (e: MessageEvent) => void
);
worker.terminate();
},
};
};
3 changes: 2 additions & 1 deletion packages/player-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"@remotion/eslint-config": "3.2.23",
"@remotion/player": "3.2.23",
"@remotion/preload": "3.2.23",
"@remotion/gif": "3.2.23",
"@types/node": "^12.0.0",
"@types/react": "18.0.1",
"@types/react-dom": "18.0.0",
Expand All @@ -28,7 +29,7 @@
"react-refresh": "^0.11.0",
"remotion": "3.2.23",
"typescript": "^4.7.0",
"webpack": "5.72.0",
"webpack": "5.74.0",
"webpack-dev-server": "^4.6.0"
},
"scripts": {
Expand Down
11 changes: 11 additions & 0 deletions packages/player-example/src/VideoAutoplay.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {preloadAudio, preloadVideo} from '@remotion/preload';
import {Gif} from '@remotion/gif';
import {AbsoluteFill, Audio, Sequence, Series, staticFile} from 'remotion';

preloadVideo(
Expand All @@ -14,6 +15,7 @@ export const VideoautoplayDemo = () => {
backgroundColor: 'red',
}}
>

<Sequence from={20}>
<Audio src={staticFile('sample.mp3')} volume={0.2} />
</Sequence>
Expand All @@ -22,6 +24,15 @@ export const VideoautoplayDemo = () => {
<AbsoluteFill />
</Series.Sequence>
</Series>
<AbsoluteFill>
<Gif
src="https://media.giphy.com/media/xT0GqH01ZyKwd3aT3G/giphy.gif"
fit="cover"
height={200}
width={200}
/>

</AbsoluteFill>
</AbsoluteFill>
);
};
2 changes: 1 addition & 1 deletion packages/player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"react-dom": "^18.0.0",
"ts-jest": "^27.0.5",
"typescript": "^4.7.0",
"webpack": "5.72.0"
"webpack": "5.74.0"
},
"keywords": [
"remotion",
Expand Down