Skip to content

Commit

Permalink
feat: update export gif and video demo
Browse files Browse the repository at this point in the history
  • Loading branch information
da730 committed Feb 5, 2024
1 parent 3aeb918 commit 1ce087b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
21 changes: 19 additions & 2 deletions packages/vmind/__tests__/browser/src/pages/ChartPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import './index.scss';
import { Button, Input, Card, Space, Modal, Spin } from '@arco-design/web-react';
import VChart from '@visactor/vchart';
import VMind from '../../../../src';
import { createFFmpeg, fetchFile } from '@ffmpeg/ffmpeg';
const TextArea = Input.TextArea;

type IPropsType = {
Expand Down Expand Up @@ -53,7 +54,15 @@ export function ChartPreview(props: IPropsType) {
return;
}
setGenerating(true);
const src = await vmind.exportVideo(spec, time, VChart);
const ffmpeg = createFFmpeg({
log: true
});
await ffmpeg.load();
const src = await vmind.exportVideo(spec, time, {
VChart,
FFmpeg: ffmpeg,
fetchFile
} as any);
setSrc(src);
setOutType('video');
setGenerating(false);
Expand All @@ -65,7 +74,15 @@ export function ChartPreview(props: IPropsType) {
return;
}
setGenerating(true);
const src = await vmind.exportGIF(spec, time, VChart);
const ffmpeg = createFFmpeg({
log: true
});
await ffmpeg.load();
const src = await vmind.exportGIF(spec, time, {
VChart,
FFmpeg: ffmpeg,
fetchFile
} as any);
setSrc(src);
setOutType('gif');
setGenerating(false);
Expand Down
4 changes: 4 additions & 0 deletions packages/vmind/__tests__/browser/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export default defineConfig(({ mode }) => {
server: {
host: '0.0.0.0',
port: 3100,
headers: {
'Cross-Origin-Embedder-Policy': 'require-corp',
'Cross-Origin-Opener-Policy': 'same-origin'
},
...proxyConfig
},
resolve: {
Expand Down

0 comments on commit 1ce087b

Please sign in to comment.