cobalt/src/modules/stream/stream.js

31 lines
974 B
JavaScript
Raw Normal View History

import { streamAudioOnly, streamDefault, streamLiveRender, streamVideoOnly, convertToGif } from "./types.js";
2024-04-27 13:51:12 +01:00
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 {
if (streamInfo.isAudioOnly && streamInfo.type !== "bridge") {
streamAudioOnly(streamInfo, res);
return;
}
switch (streamInfo.type) {
2024-04-26 12:53:50 +01:00
case "internal":
return await internalStream(streamInfo, res);
case "render":
await streamLiveRender(streamInfo, res);
break;
case "gif":
convertToGif(streamInfo, res);
break;
case "remux":
case "mute":
streamVideoOnly(streamInfo, res);
break;
default:
await streamDefault(streamInfo, res);
break;
2022-07-08 19:17:56 +01:00
}
2024-04-27 13:51:12 +01:00
} catch {
res.sendStatus(500);
2022-07-08 19:17:56 +01:00
}
}