value => new AudioResponseStreamAction($audio), StreamingMethod::NGINX->value => new AudioNginxStreamAction($audio), default => throw new RuntimeException('AUDIO_STREAMING_METHOD must be specified in your .env file'), }; // If the "download" query param is set we want to force the browser to download the file. // Otherwise, it should be shown inline for direct playback. $disposition = $request->has('download') ? 'attachment' : 'inline'; return $action->stream($disposition); } }