Skip to content

Commit

Permalink
feat: 视频格式转换
Browse files Browse the repository at this point in the history
  • Loading branch information
KuaiYu95 committed Jan 19, 2024
1 parent 5df3a3d commit 88d73f7
Show file tree
Hide file tree
Showing 5 changed files with 465 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/components/Dynamic/Video2Gif.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ dayjs.extend(duration);

const _C = () => {
const [video, setVideo] = useState<File>();
const [duration, setDuration] = useState<number>(0);
const [startTime, setStartTime] = useState<number>(0);
const [transformTime, setTransformTime] = useState<number>(3);
const [gif, setGif] = useState<string>('');

const [loadFile, setLoadFile] = useState(false);
const [loadConfig, setLoadingConfig] = useState(false);
const [loadTransform, setLoadTransform] = useState(false);

Expand All @@ -27,17 +25,6 @@ const _C = () => {
videoInput?.click();
};

const download = () => {
setLoadFile(true);
const link = document.createElement('a');
link.href = gif;
link.download = 'output.gif';
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
setLoadFile(false);
};

const transform = async () => {
try {
setGif('');
Expand Down Expand Up @@ -84,14 +71,6 @@ const _C = () => {
setLoadingConfig(false);
};

useEffect(() => {
const videoEl = document.getElementById('videoEl') as HTMLVideoElement;
videoEl?.addEventListener('loadeddata', () => {
const duration = videoEl?.duration || 0;
setDuration(duration);
});
}, [video]);

useEffect(() => {
loadPlugin();
}, []);
Expand Down
Loading

0 comments on commit 88d73f7

Please sign in to comment.