value => new VideoResponseStreamAction($video), StreamingMethod::NGINX->value => new VideoNginxStreamAction($video), default => throw new RuntimeException('VIDEO_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); } }