mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
feat: implement streaming handler with FFmpeg-based HLS transcoding and GPU acceleration support
This commit is contained in:
1 parent
1b4321d84a
commit
099d7da53f
1 file changed
+19
-3
@@ -564,13 +564,29 @@ Handler createRecordingStreamHandler(
|
||||
|
||||
router.get('/<streamId>/playlist.m3u8', (Request request, String streamId) async {
|
||||
final recording = db.getRecordingById(streamId);
|
||||
if (recording == null || recording.filePath == null) {
|
||||
return Response.internalServerError(body: 'DEBUG_ERROR: Recording $streamId or file not found in DB');
|
||||
if (recording == null) {
|
||||
return Response.notFound('Recording not found');
|
||||
}
|
||||
|
||||
// Check recording status - only allow streaming if completed or recording
|
||||
if (recording.status == 'scheduled') {
|
||||
return Response(202, body: 'Recording not yet started');
|
||||
}
|
||||
if (recording.status == 'failed') {
|
||||
return Response(422, body: 'Recording failed: ${recording.errorReason ?? 'unknown error'}');
|
||||
}
|
||||
if (recording.status != 'completed' && recording.status != 'recording') {
|
||||
return Response.internalServerError(body: 'Invalid recording status: ${recording.status}');
|
||||
}
|
||||
|
||||
// Check file path and existence
|
||||
if (recording.filePath == null) {
|
||||
return Response.internalServerError(body: 'Recording file path not set');
|
||||
}
|
||||
|
||||
final targetUrl = recording.filePath!;
|
||||
if (!File(targetUrl).existsSync()) {
|
||||
return Response.internalServerError(body: 'DEBUG_ERROR: Physical recording file $targetUrl DOES NOT EXIST on disk.');
|
||||
return Response.internalServerError(body: 'Physical recording file not found: $targetUrl');
|
||||
}
|
||||
|
||||
final streamDir = Directory('${_hlsTempDir.path}/rec_$streamId');
|
||||
|
||||
Reference in new issue
Block a user