Store meet recordings on Ladill servers via browser upload.
Deploy Ladill Meet / deploy (push) Successful in 53s
Deploy Ladill Meet / deploy (push) Successful in 53s
Capture the meeting in the host browser, upload to Ladill storage on stop, and remove the LiveKit egress placeholder job. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -5,8 +5,9 @@ namespace App\Services\Meet;
|
||||
use App\Models\Recording;
|
||||
use App\Models\Session;
|
||||
use App\Models\User;
|
||||
use App\Jobs\ProcessRecording;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use RuntimeException;
|
||||
|
||||
class RecordingService
|
||||
{
|
||||
@@ -61,26 +62,40 @@ class RecordingService
|
||||
$recording->id,
|
||||
);
|
||||
|
||||
ProcessRecording::dispatch($recording->id);
|
||||
|
||||
return $recording->fresh();
|
||||
}
|
||||
|
||||
public function process(Recording $recording): Recording
|
||||
/** Store a browser-captured recording on Ladill storage (not LiveKit). */
|
||||
public function storeUpload(Recording $recording, UploadedFile $file): Recording
|
||||
{
|
||||
$session = $recording->session;
|
||||
$filename = 'recordings/'.$session->uuid.'/'.$recording->uuid.'.mp4';
|
||||
$disk = Storage::disk(config('meet.recordings.disk', 'local'));
|
||||
if ($recording->status !== 'processing') {
|
||||
return $recording;
|
||||
}
|
||||
|
||||
// Placeholder until LiveKit Egress writes the file; create empty marker for dev.
|
||||
if (! $disk->exists($filename)) {
|
||||
$disk->put($filename, '');
|
||||
$session = $recording->session;
|
||||
$extension = strtolower($file->getClientOriginalExtension() ?: $file->extension() ?: 'webm');
|
||||
if (! in_array($extension, ['webm', 'mp4', 'mkv'], true)) {
|
||||
$extension = 'webm';
|
||||
}
|
||||
|
||||
$filename = 'recordings/'.$session->uuid.'/'.$recording->uuid.'.'.$extension;
|
||||
$disk = Storage::disk(config('meet.recordings.disk', 'local'));
|
||||
$disk->putFileAs(
|
||||
'recordings/'.$session->uuid,
|
||||
$file,
|
||||
$recording->uuid.'.'.$extension,
|
||||
);
|
||||
|
||||
$size = $disk->size($filename) ?: $file->getSize();
|
||||
|
||||
if ($size <= 0) {
|
||||
throw new RuntimeException('Recording upload was empty.');
|
||||
}
|
||||
|
||||
$recording->update([
|
||||
'status' => 'ready',
|
||||
'storage_path' => $filename,
|
||||
'file_size' => $disk->size($filename) ?: null,
|
||||
'file_size' => $size,
|
||||
'thumbnail_path' => null,
|
||||
]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user