mirror of
https://github.com/R0m1k3/xtremflow.git
synced 2026-10-11 17:30:00 +02:00
feat: add stop recording button and POST /api/recordings/stop/<id> endpoint to kill FFmpeg process
This commit is contained in:
1 parent
0d2ad322fe
commit
4c2e3ce600
4 files changed
+68
-2
No files matched your search
@@ -186,10 +186,23 @@ class RecordingScheduler {
|
||||
}
|
||||
}
|
||||
|
||||
/// Arrêter un enregistrement en cours (appelé depuis l'API)
|
||||
Future<bool> stopRecording(String id) async {
|
||||
if (_ffmpegProcess != null && _currentRecording?.id == id) {
|
||||
print('[RecordingScheduler] Arrêt demandé pour: ${_currentRecording!.title}');
|
||||
_ffmpegProcess!.kill(ProcessSignal.sigterm);
|
||||
_db.updateRecordingStatus(id, 'completed');
|
||||
_ffmpegProcess = null;
|
||||
_currentRecording = null;
|
||||
return true;
|
||||
}
|
||||
return false; // Pas d'enregistrement actif avec cet ID
|
||||
}
|
||||
|
||||
Future<void> _stopCurrentRecording({String? reason}) async {
|
||||
if (_ffmpegProcess != null && _currentRecording != null) {
|
||||
print('[RecordingScheduler] Arrêt forcé du processus FFmpeg. Raison: ${reason ?? "Fin programmée"}');
|
||||
_ffmpegProcess!.kill(ProcessSignal.sigterm); // Envoyer un signal d'arrêt propre
|
||||
print('[RecordingScheduler] Arrêt auto: ${reason ?? "Fin programmée"}');
|
||||
_ffmpegProcess!.kill(ProcessSignal.sigterm);
|
||||
_db.updateRecordingStatus(_currentRecording!.id, 'completed');
|
||||
_ffmpegProcess = null;
|
||||
_currentRecording = null;
|
||||
|
||||
Reference in new issue
Block a user