2024-01-17 05:38:51 +00:00
|
|
|
import { streamAudioOnly, streamDefault, streamLiveRender, streamVideoOnly, convertToGif } from "./types.js";
|
2024-04-27 13:51:12 +01:00
|
|
|
import { internalStream } from './internal.js';
|
2024-05-21 20:21:34 +01:00
|
|
|
import { closeResponse } from "./shared.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) {
|
2024-04-26 12:53:50 +01:00
|
|
|
case "internal":
|
|
|
|
return await internalStream(streamInfo, res);
|
2023-02-09 14:45:17 +00:00
|
|
|
case "render":
|
2023-08-20 15:44:34 +01:00
|
|
|
await streamLiveRender(streamInfo, res);
|
2023-02-09 14:45:17 +00:00
|
|
|
break;
|
2024-01-17 05:38:51 +00:00
|
|
|
case "gif":
|
|
|
|
convertToGif(streamInfo, res);
|
|
|
|
break;
|
2023-12-02 14:44:19 +00:00
|
|
|
case "remux":
|
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
|
|
|
}
|
2024-04-27 13:51:12 +01:00
|
|
|
} catch {
|
2024-05-21 20:21:34 +01:00
|
|
|
closeResponse(res)
|
2022-07-08 19:17:56 +01:00
|
|
|
}
|
|
|
|
}
|