authorize('viewAudio', $project); $path = $project->stored_audio_path; abort_unless($this->storage->exists($path), 404); $size = $this->storage->size($path); $mimeType = $project->mime_type; return response()->stream(function () use ($path) { $stream = $this->storage->readStream($path); if ($stream) { fpassthru($stream); fclose($stream); } }, 200, [ 'Content-Type' => $mimeType, 'Content-Length' => $size, 'Content-Disposition' => 'inline', 'Cache-Control' => 'no-store, no-cache, private, must-revalidate', 'X-Content-Type-Options' => 'nosniff', 'Accept-Ranges' => 'bytes', ]); } }