mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
fix(server): add direct .ts proxy route for recordings and fix Cascade fall-through
This commit is contained in:
1 parent
2f7d709fe6
commit
a9a1127d6b
2 files changed
+29
-2
No files matched your search
@@ -212,6 +212,33 @@ Handler createLiveStreamHandler(
|
||||
});
|
||||
});
|
||||
|
||||
// Route: /api/live/{streamId}.ts (Direct Proxy for internal recordings or raw playback)
|
||||
router.get('/<streamId>.ts', (Request request, String streamId) async {
|
||||
final playlist = await getPlaylist(request);
|
||||
if (playlist == null) return Response.forbidden('No playlist');
|
||||
|
||||
final targetUrl =
|
||||
'${playlist.dns}/live/${playlist.username}/${playlist.password}/$streamId.ts';
|
||||
print('[Live Proxy] Forwarding $streamId: $targetUrl');
|
||||
|
||||
final client = http.Client();
|
||||
final proxyRequest = http.Request('GET', Uri.parse(targetUrl));
|
||||
proxyRequest.headers['User-Agent'] = 'VLC/3.0.18 LibVLC/3.0.18';
|
||||
proxyRequest.headers['Accept'] = '*/*';
|
||||
|
||||
final response = await client.send(proxyRequest);
|
||||
|
||||
return Response(
|
||||
response.statusCode,
|
||||
body: response.stream,
|
||||
headers: {
|
||||
'Content-Type': 'video/mp2t',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Connection': 'keep-alive',
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
// Route: /api/live/{streamId}/{segment}
|
||||
router.get('/<streamId>/<segment>',
|
||||
(Request request, String streamId, String segment) async {
|
||||
|
||||
Reference in new issue
Block a user