cobalt/api/src/stream/stream.js

34 lines
842 B
JavaScript
Raw Normal View History

import stream from "./types.js";
import { closeResponse } from "./shared.js";
import { internalStream } from "./internal.js";
2022-07-08 19:17:56 +01:00
export default async function(res, streamInfo) {
2022-07-08 19:17:56 +01:00
try {
switch (streamInfo.type) {
case "proxy":
return await stream.proxy(streamInfo, res);
2024-04-26 12:53:50 +01:00
case "internal":
return internalStream(streamInfo, res);
case "merge":
return stream.merge(streamInfo, res);
case "remux":
case "mute":
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
}
closeResponse(res);
2024-04-27 13:51:12 +01:00
} catch {
closeResponse(res);
2022-07-08 19:17:56 +01:00
}
}