mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
The commit refactors the chunked upload system to support a transformation pipeline. Key changes include: - Replace SSE field names for consistency (sseChannelId, sseUrl) - Fix progress reporting structure with state and percent fields - Add transformation handlers (a-dash, mq-hls, img-compress, video-compress) - Create new Upload class with clear separation of concerns - Improve file processing workflow with better directory structure - Fix typo in UploadButton component (progess → progress) - Remove deprecated file processing services
51 lines
972 B
JavaScript
51 lines
972 B
JavaScript
import path from "node:path"
|
|
import MultiqualityHLSJob from "@shared-classes/MultiqualityHLSJob"
|
|
|
|
export default async ({ filePath, workPath, onProgress }) => {
|
|
return new Promise(async (resolve, reject) => {
|
|
const outputDir = path.resolve(workPath, "mqhls")
|
|
|
|
const job = new MultiqualityHLSJob({
|
|
input: filePath,
|
|
outputDir: outputDir,
|
|
|
|
// set default
|
|
outputMasterName: "master.m3u8",
|
|
levels: [
|
|
{
|
|
original: true,
|
|
codec: "libx264",
|
|
bitrate: "10M",
|
|
preset: "ultrafast",
|
|
},
|
|
{
|
|
codec: "libx264",
|
|
width: 1280,
|
|
bitrate: "3M",
|
|
preset: "ultrafast",
|
|
},
|
|
],
|
|
})
|
|
|
|
job.on("start", () => {
|
|
console.log("A-DASH started")
|
|
})
|
|
|
|
job.on("end", (data) => {
|
|
console.log("A-DASH completed", data)
|
|
resolve(data)
|
|
})
|
|
|
|
job.on("progress", (progress) => {
|
|
if (typeof onProgress === "function") {
|
|
onProgress({
|
|
percent: progress,
|
|
state: "transmuxing",
|
|
})
|
|
}
|
|
})
|
|
|
|
job.run()
|
|
})
|
|
}
|