Name the Dynamsoft Camera SDK object

By default, the (first) Dynamsoft Camera SDK object is named "dcsObject". You should set it before using any other Dynamsoft Camera SDK’s methods or events. A good place to do this is the built-in function dynamsoft.dcsEnv.init(). For example, in our Hello World sample:

<script type='text/javascript'>
	       var dcsObject, imageViewer;
           
             //Success callback function for dynamsoft.dcsEnv.init()
	       function onInitSuccess(videoViewerId, imageViewerId){
               dcsObject = dynamsoft.dcsEnv.getObject(videoViewerId);
               imageViewer = dcsObject.getImageViewer(imageViewerId);
               /* More code can be added here*/
	       }

           //Failure callback function for dynamsoft.dcsEnv.init()
           function onInitFailure(errorCode, errorString) {
              alert('Init failed: ' + errorString);
           }

           dynamsoft.dcsEnv.init('video-container', 'image-container', onInitSuccess, onInitFailure);
</script>

The div with id ‘video-container’ is the place holder for Dynamsoft camera video viewer and the div with id ‘image-container’ is the place holder for Dynamsoft camera image viewer.

Is this page helpful?

Leave a Reply

Your email address will not be published.