onvif
    Preparing search index...

    Interface OnvifOptions

    Onvif constructor options. Pass either OnvifOptions.url or OnvifOptions.hostname (not both).

    interface OnvifOptions {
        agent?: boolean | Agent | Agent;
        autoConnect?: boolean;
        defaultMedia?: boolean;
        hostname?: string;
        password?: string;
        path?: string;
        port?: number;
        preserveAddress?: boolean;
        secureOptions?: ConnectionOptions;
        timeout?: number;
        url?: string | URL;
        urn?: string;
        username?: string;
        useSecure?: boolean;
        useWSSecurity?: boolean;
        xaddrs?: URL[];
    }
    Index
    agent?: boolean | Agent | Agent

    Supports things like https://www.npmjs.com/package/proxy-agent which provide SOCKS5 and other connections.

    autoConnect?: boolean

    Set true if the camera should connect automatically, defaults false.

    defaultMedia?: boolean

    Default for Onvif.connect { media } when that option is omitted.

    true
    
    hostname?: string

    Device host. Required when url is omitted.

    password?: string
    path?: string

    Device service path. Defaults to /onvif/device_service.

    port?: number

    Defaults to 80 or 443 from useSecure / url scheme.

    preserveAddress?: boolean

    Rewrite host/port on service and subscription XAddrs to this client's hostname:port (pathname and query kept). Defaults to false.

    Cameras often advertise unreachable XAddrs: 127.0.0.1 behind a vendor proxy, a private LAN IP while you connect through NAT/port-forward, or a different published port than the one you dial. Ordinary SOAP calls (device, media, ...) always TCP to the constructor host/port and take only pathname (+ query) from each XAddr - so they work without this flag. Set preserveAddress: true when the full URL must match the constructor address as well:

    • SOAP a:To / addressing headers built from the XAddr
    • PullMessages / Renew / Unsubscribe, which dial options.url from the subscription Address

    Comparison uses the effective port (scheme defaults 80/443), not the empty URL.port string. Does not rewrite raw RTSP/snapshot URI strings inside Media responses - only URLs passed through Onvif.parseUrl.

    secureOptions?: ConnectionOptions

    Set options for https like ca, cert, ciphers, rejectUnauthorized, secureOptions, secureProtocol, etc.

    timeout?: number

    HTTP socket timeout for ordinary SOAP calls, in milliseconds. Defaults to DEFAULT_TIMEOUT_MS (10 s). PullMessages sets its own longer timeout (pull wait + margin) and is not limited by this value.

    url?: string | URL

    Device service URL (http(s)://host[:port]/path]). Sets hostname, port, path, and useSecure. Must not include userinfo; use username/password.

    urn?: string
    username?: string
    useSecure?: boolean

    Set true if using https protocol, defaults to false. Ignored when url is set.

    useWSSecurity?: boolean

    Use WS-Security SOAP headers

    xaddrs?: URL[]

    All XAddrs from WS-Discovery (set by Discovery). Same role as v0.x cam.xaddrs.