Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
coder-xiaotian committed Jun 16, 2023
1 parent c85203c commit be66929
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
Binary file added public/图片1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import '@/styles/globals.css'
import { createTheme, CssBaseline, ThemeProvider } from '@mui/material';
import type { AppProps } from 'next/app'
import Head from 'next/head';

const theme = createTheme({
components: {
Expand All @@ -22,6 +23,9 @@ export default function App({ Component, pageProps }: AppProps) {
return (
<ThemeProvider theme={theme}>
<CssBaseline/>
<Head>
<meta name="viewport" content="initial-scale=1, width=device-width" />
</Head>
<Component {...pageProps} />
</ThemeProvider>
)
Expand Down
4 changes: 1 addition & 3 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
return (
<Html lang="en">
<Head>
<meta name="viewport" content="initial-scale=1, width=device-width" />
</Head>
<Head/>
<body>
<Main />
<NextScript />
Expand Down
13 changes: 9 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ffmpeg, fetchFile } from "@/utils/ffmpeg";
import {createFFmpeg, fetchFile} from '@ffmpeg/ffmpeg'
import { getVideoMetadata } from "@/utils/video";
import {
Box,
Expand All @@ -10,9 +10,14 @@ import {
LinearProgress
} from "@mui/material";
import FileUploadIcon from "@mui/icons-material/FileUpload";
import { ChangeEvent, useRef, useState } from "react";
import { ChangeEvent, useEffect, useRef, useState } from "react";
import {saveAs} from "file-saver"

let ffmpeg: any
(async () => {
ffmpeg = createFFmpeg({ log: true, corePath: `${location.protocol + location.host}/ffmpeg-core.js`});
await ffmpeg.load();
})()
export default function Home() {
const [subtitles, setSubtitles] = useState([]);
const audioRef = useRef<File>(null);
Expand Down Expand Up @@ -53,7 +58,7 @@ export default function Home() {
ffmpeg.FS(
"writeFile",
`tmp/fonts`,
await fetchFile("http://localhost:3000/YeZiGongChangChuanQiuShaXingKai-2.ttf")
await fetchFile(`${location.protocol + location.host}/YeZiGongChangChuanQiuShaXingKai-2.ttf`)
);

const files = videoFiles.filter(Boolean)
Expand Down Expand Up @@ -102,7 +107,7 @@ ${subtitles.join("\n")}`;
"output.mp4",
]
);
ffmpeg.setProgress((p) => {
ffmpeg.setProgress((p: any) => {
setProgressValue(p.ratio * (i + 1))
})
await ffmpeg.run(...cmd);
Expand Down
8 changes: 0 additions & 8 deletions src/utils/ffmpeg.ts

This file was deleted.

0 comments on commit be66929

Please sign in to comment.