cobalt/src/modules/stream/stream.js

25 lines
770 B
JavaScript
Raw Normal View History

import { streamAudioOnly, streamDefault, streamLiveRender, streamVideoOnly } from "./types.js";
2022-07-08 19:17:56 +01:00
2023-06-27 15:46:51 +01:00
export default 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) {
case "render":
streamLiveRender(streamInfo, res);
break;
case "videoM3U8":
case "mute":
streamVideoOnly(streamInfo, res);
break;
default:
streamDefault(streamInfo, res);
break;
2022-07-08 19:17:56 +01:00
}
} catch (e) {
2022-09-01 14:51:18 +01:00
res.status(500).json({ status: "error", text: "Internal Server Error" });
2022-07-08 19:17:56 +01:00
}
}