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