Class: Snapshot

Snapshot()

Provide Snapshot functionaity for cameras.

Functions

Snapshot#getSnapshot,

Overview

Use the Snapshot::getSnapshot() method to retrieve a snapshot from the ONVIF-compliant camera.

Constructor

new Snapshot()

Source:

Methods

getSnapshot(callbackopt)

Retrieves a snapshot from the specified camera
Parameters:
Name Type Attributes Description
callback callback <optional>
Optional callback, instead of a Promise.
Source:
Example
const OnvifManager = require('onvif-nvt')
OnvifManager.connect('10.10.1.60', 80, 'username', 'password')
  .then(results => {
    let camera = results
    // calling add method will automatically initialize snapshot
    // with the defaultProfile's snapshotUri
    camera.add('snapshot')
    camera.snapshot.getSnapshot()
      .then(results => {
        let mimeType = results.mimeType
        let rawImage = results.image
        let prefix = 'data:' + mimeType + ';base64,'
        let base64Image = Buffer.from(rawImage, 'binary').toString('base64')
        let image = prefix + base64Image
        // 'image' is now ready to be displayed on a web page
        // ...
      })
    }
  })