Members
(constant) BASE_URL :string
Base URL for all HTTP API requests.
Due to the various environments in which the SDK can be loaded and the
different ways that a Capture Bridge instance may be configured. The
BASE_URL
variable used for all default HTTP API request can be set in
several ways:
When running the SDK within a web browser the following locations are checked, in order:
- A meta tag containing a url:
<meta name="capturebridge:url" content="proto://fqdn:port" />
- In the global Window object:
window.CAPTURE_BRIDGE_URL
- In the origin in which the SDK is running:
window.location.origin
- The
DEFAULT_URL
constant fromCommon.js
When running the SDK within Node.js the following locations are checked, in order:
- In a
CAPTURE_BRIDGE_URL
environment variable - The
DEFAULT_URL
constant fromCommon.js
Note that each constructor also accepts a baseUrl
parameter that will override
any value for BASE_URL
previously set.
- Source:
- Default Value:
Type:
- string
(constant) DATAURL_GIF :string
data:
prefix for GIF
Data URLs
Type:
- string
(constant) DATAURL_JPEG :string
data:
prefix for JPEG
Data URLs
Type:
- string
(constant) DATAURL_JSON :string
data:
prefix for JSON
Data URLs
Type:
- string
(constant) DATAURL_PNG :string
data:
prefix for PNG
Data URLs
Type:
- string
(constant) DEFAULT_URL :string
Default URL for API requests.
Type:
- string
(constant) DELETE :object
Common Fetch options for making DELETE requests to the API.
Type:
- object
(constant) LOG_LEVELS :Object.<string, number>
Type:
- Object.<string, number>
(constant) POST :object
Type:
- object
(constant) VERSION :string
SDK Version as published on NPM
- Source:
Type:
- string
(constant) base64ToDataURL :string
For a given base64 string, convert it to the appropriate Data URL
Type:
- string
(constant) stripDataUrl :string
Strip the data URL identifier from a string
Type:
- string
Type Definitions
CaptureOptions
Default options for capture operations.
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
rotate |
number |
<nullable> |
Angle, in degrees to rotate the captured object. Must be a value from -359 to 359. A value of 0 will perform no rotation. |
base64 |
boolean |
<nullable> |
Return the captured object as a base64 encoded string. The default behavior is to return the image as binary data. |
kind |
CaptureResponseKind | Specifies how to return the captured
object. Some SDK methods that are designed to only return a particular type,
such as |
|
format |
CaptureResponseFormat | The image format to be returned. |
Type:
- object
CaptureResponseFormat
The image format to be returned.
Valid values:
jpg
tiff
gif
png
If not provided, a plugin or device-specific format will be returned.
Note:
- Some plugins have configuration options for specifying the return format, such configuration options should be used instead of this parameter to prevent unecessary transcoding.
- Web browsers are not typically capable of displaying TIFF images.
Type:
- string
CaptureResponseKind
Specifies the desired return type for a captured object. Valid
values are objecturl
, blob
, buffer
, base64
, or dataurl
.
-
objecturl
will load the captured object into an ObjectURL that can be set directly on an img tag's src attribute. Note that these URLs should be revoked when they are no longer needed. -
buffer
will load the image into an ArrayBuffer -
blob
will return a Blob that can be used with a FileReader. -
base64
will return the image contents as a Base64 encoded string that is suitable for use with JSON serialization. -
dataurl
will return a Data URL that can be set on an img tag's src attribute or loaded as a document location.
Type:
- string
StreamOptions
Default options for stream operations
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
rotate |
number |
<nullable> |
Angle, in degrees to rotate the stream. Must be a value from -359 to 359. A value outside of that range, or a 0 will perform no rotation. |
Type:
- object