public function stream($filename) { $path = 'items/audio/' . $filename; if (!Storage::disk('public')->exists($path)) { abort(404); } $fullPath = Storage::disk('public')->path($path); $size = filesize($fullPath); $stream = fopen($fullPath, 'rb'); $headers = [ 'Content-Type' => 'audio/mp4', // Adjust based on file type if needed 'Content-Length' => $size, 'Accept-Ranges' => 'bytes', ]; return response()->stream(function () use ($stream) { fpassthru($stream); }, 200, $headers); } }