cobalt/api/src/stream/stream.js

34 lines
877 B
JavaScript
Raw Normal View History

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