CameraEnhancer - Create and Destroy Instances
Name | Description |
---|---|
static createInstance() |
Initializes a new instance of the CameraEnhancer class. |
dispose() | Releases all resources used by the CameraEnhancer instance. |
disposed | Returns whether the CameraEnhancer instance has been disposed of. |
createInstance
Initializes a new instance of the CameraEnhancer
class.
static createInstance(cameraView?: CameraView): Promise<CameraEnhancer>;
Parameters
cameraView
: [Optional] specifies a CameraView
instance to be used by the CameraEnhancer
instance.
Return value
A promise that resolves with the initialized CameraEnhancer
instance.
Code Snippet
(async () => {
let cameraView = await Dynamsoft.DCE.CameraView.createInstance();
let cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance(cameraView);
})();
See also
dispose
Releases all resources used by the CameraEnhancer
instance. Subsequently, the instance retains only the disposed
property, set to true.
dispose(): void;
Parameters
None.
Return value
None.
Code Snippet
let cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
// Use the object to perform some tasks
//...
cameraEnhancer.dispose();
See also
disposed
Returns whether the CameraEnhancer
instance has been disposed of.
readonly disposed: boolean;
Return value
Boolean indicating whether the CameraEnhancer
instance has been disposed of.
Code Snippet
let cameraEnhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
//...
let flag = cameraEnhancer.disposed;
See also
onWarning
Event triggered when the running environment is not ideal.
static onWarning: (warning: Warning) => {};
In this version, it may get triggered in two scenarios:
- If the page is opened from the disk;
- The page is hosted in a HTTP site without SSL;
The following two warnings are returned respectively:
{
id: 1,
message: "The page is opened over file:// and Dynamsoft Camera Enhancer may not work properly. Please open the page via https://."
}
{
id: 2,
message: "Dynamsoft Camera Enhancer may not work properly in a non-secure context. Please open the page via https://."
}
Code Snippet
Dynamsoft.DCE.CameraEnhancer.onWarning = warning => console.log(warning);
See also