2022-12-17 11:09:49 +00:00
|
|
|
import { streamAudioOnly, streamDefault, streamLiveRender, streamVideoOnly } from "./types.js";
|
2022-07-08 19:17:56 +01:00
|
|
|
|
2023-08-20 15:44:34 +01:00
|
|
|
export default async function(res, streamInfo) {
|
2022-07-08 19:17:56 +01:00
|
|
|
try {
|
2023-02-09 14:45:17 +00:00
|
|
|
if (streamInfo.isAudioOnly && streamInfo.type !== "bridge") {
|
|
|
|
streamAudioOnly(streamInfo, res);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
switch (streamInfo.type) {
|
|
|
|
case "render":
|
2023-08-20 15:44:34 +01:00
|
|
|
await streamLiveRender(streamInfo, res);
|
2023-02-09 14:45:17 +00:00
|
|
|
break;
|
2023-03-15 16:18:31 +00:00
|
|
|
case "videoM3U8":
|
2023-02-09 14:45:17 +00:00
|
|
|
case "mute":
|
|
|
|
streamVideoOnly(streamInfo, res);
|
|
|
|
break;
|
|
|
|
default:
|
2023-08-20 15:44:34 +01:00
|
|
|
await streamDefault(streamInfo, res);
|
2023-02-09 14:45:17 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
}
|