diff options
Diffstat (limited to 'src/client/views/nodes/RecordingBox/RecordingView.tsx')
-rw-r--r-- | src/client/views/nodes/RecordingBox/RecordingView.tsx | 50 |
1 files changed, 38 insertions, 12 deletions
diff --git a/src/client/views/nodes/RecordingBox/RecordingView.tsx b/src/client/views/nodes/RecordingBox/RecordingView.tsx index 994111bd4..3fd062483 100644 --- a/src/client/views/nodes/RecordingBox/RecordingView.tsx +++ b/src/client/views/nodes/RecordingBox/RecordingView.tsx @@ -7,9 +7,9 @@ import { FaCheckCircle } from 'react-icons/fa'; import { IconContext } from "react-icons"; import { Networking } from '../../../Network'; import { Upload } from '../../../../server/SharedMediaTypes'; -const ffmpeg = require("fluent-ffmpeg"); import { RecordingApi } from '../../../util/RecordingApi'; +import { DashUploadUtils } from '../../../../server/DashUploadUtils'; interface MediaSegment { videoChunks: any[], @@ -61,24 +61,50 @@ export function RecordingView(props: IRecordingViewProps) { if (finished) { (async () => { const inputPaths: string[] = []; + const videoFiles: File[] = [] videos.forEach(async (vid, i) => { const videoFile = new File(vid.videoChunks, `segvideo${i}.mkv`, { type: vid.videoChunks[0].type, lastModified: Date.now() }); + videoFiles.push(videoFile); + const { name } = videoFile; - ffmpeg(name) inputPaths.push(name) }); - - + + + + // const inputListName = 'order.txt'; + // fs.writeFileSync(inputListName, inputPaths.join('\n')); + + // var merge = ffmpeg(); + // merge.input(inputListName) + // .inputOptions(['-f concat', '-safe 0']) + // .outputOptions('-c copy') + // .save('output.mp4') + + // fs.unlinkSync(inputListName); + + const combined = await DashUploadUtils.combineSegments(videoFiles, inputPaths) + console.log('combined', combined) + + // const outputFile = new File(['output.mp4'], 'output.mp4', { type: 'video/mp4', lastModified: Date.now() }); + + const data = await Networking.UploadFilesToServer(combined) + const result = data[0].result + if (!(result instanceof Error)) { // convert this screenshotBox into normal videoBox + props.setResult(result, trackScreen) + } else { + alert("video conversion failed"); + } - if (format.includes("x-matroska")) { - await new Promise(res => ffmpeg(file.path) - .videoCodec("copy") // this will copy the data instead of reencode it - .save(file.path.replace(".mkv", ".mp4")) - .on('end', res)); - file.path = file.path.replace(".mkv", ".mp4"); - format = ".mp4"; - } + // if (format.includes("x-matroska")) { + // await new Promise(res => ffmpeg(file.path) + // .videoCodec("copy") // this will copy the data instead of reencode it + // .save(file.path.replace(".mkv", ".mp4")) + // .on('end', res)); + // file.path = file.path.replace(".mkv", ".mp4"); + // format = ".mp4"; + // } // console.log('crossOriginIsolated', crossOriginIsolated) // props.setDuration(recordingTimer * 100) |