2024-08-22 12:37:31 +01:00
|
|
|
import stream from "./types.js";
|
|
|
|
|
2024-05-21 20:21:34 +01:00
|
|
|
import { closeResponse } from "./shared.js";
|
2024-08-22 12:37:31 +01:00
|
|
|
import { internalStream } from "./internal.js";
|
2022-07-08 19:17:56 +01:00
|
|
|
|
2023-08-20 15:44:34 +01:00
|
|
|
export default async function(res, streamInfo) {
|
2022-07-08 19:17:56 +01:00
|
|
|
try {
|
2023-02-09 14:45:17 +00:00
|
|
|
switch (streamInfo.type) {
|
2024-08-22 12:37:31 +01:00
|
|
|
case "proxy":
|
|
|
|
return await stream.proxy(streamInfo, res);
|
|
|
|
|
2024-04-26 12:53:50 +01:00
|
|
|
case "internal":
|
2024-08-22 12:37:31 +01:00
|
|
|
return internalStream(streamInfo, res);
|
|
|
|
|
|
|
|
case "merge":
|
|
|
|
return stream.merge(streamInfo, res);
|
|
|
|
|
2023-12-02 14:44:19 +00:00
|
|
|
case "remux":
|
2023-02-09 14:45:17 +00:00
|
|
|
case "mute":
|
2024-08-22 12:37:31 +01:00
|
|
|
return stream.remux(streamInfo, res);
|
|
|
|
|
|
|
|
case "audio":
|
|
|
|
return stream.convertAudio(streamInfo, res);
|
|
|
|
|
|
|
|
case "gif":
|
|
|
|
return stream.convertGif(streamInfo, res);
|
2022-07-08 19:17:56 +01:00
|
|
|
}
|
2024-08-22 12:37:31 +01:00
|
|
|
|
|
|
|
closeResponse(res);
|
2024-04-27 13:51:12 +01:00
|
|
|
} catch {
|
2024-08-22 12:37:31 +01:00
|
|
|
closeResponse(res);
|
2022-07-08 19:17:56 +01:00
|
|
|
}
|
|
|
|
}
|