- upload recording of call in chunks - recordings are merged on server side in jobs - improve UI of the recording tab
35 lines
1016 B
PHP
35 lines
1016 B
PHP
<?php
|
|
|
|
namespace App\Actions\Interview;
|
|
|
|
use App\Models\Interview;
|
|
use Illuminate\Http\UploadedFile;
|
|
|
|
class StoreRecordingChunkAction
|
|
{
|
|
/**
|
|
* Store an individual video recording chunk in a temporary session directory.
|
|
*
|
|
* @param Interview $interview
|
|
* @param string $sessionId
|
|
* @param int $chunkIndex
|
|
* @param UploadedFile $file
|
|
* @return string
|
|
*/
|
|
public function execute(Interview $interview, string $sessionId, int $chunkIndex, UploadedFile $file): string
|
|
{
|
|
$safeSessionId = preg_replace('/[^a-zA-Z0-9_\-]/', '', $sessionId);
|
|
$tempBase = config('interview.recordings.temp_folder', 'app/temp_recordings');
|
|
$tempDir = storage_path(trim($tempBase, '/') . '/' . $safeSessionId);
|
|
|
|
if (!file_exists($tempDir)) {
|
|
mkdir($tempDir, 0777, true);
|
|
}
|
|
|
|
$partName = sprintf('part_%06d.webm', $chunkIndex);
|
|
$file->move($tempDir, $partName);
|
|
|
|
return $tempDir . DIRECTORY_SEPARATOR . $partName;
|
|
}
|
|
}
|