Webeecam SDK – How to listen to USB camera events

This blog is aimed at showing you how to listen to external USB camera events using Webeecam SDK.

Pre-requisites:

Android Studio or Eclipse

Webeecam SDK installation.

Valid Webeecam SDK License

References:

Webeecam SDK User Manual

Webeecam SDK Samples

Description: USB Camera application development involves detection of camera device and accessing camera frames at its core. Webeecam SDK makes these core use cases very simple to implement for the camera application developer.

The process involves the following 3 simple steps:

  1. Initialize the Webeecam Library.
  2. Create an instance of Webeecam Listener object.
  3. Hook the created Webeecam listener object into the Webeecam Library Object and wait for events.

The code for the above steps are given below. For the new-comers through-out the Webeecam SDK we have strictly followed our coding guidelines. The result is the three letter prefix for our classes, those are “wcs”. This greatly helps in distinguishing Webeecam SDK classes from framework and other classes that could be in use in a product code.

Some of the examples are: WCSDeviceException, WCSLicenseException.

With that note lets dive into code now.

// Initialize the Webeecam SDK Library

WCS wcs = new WCS();

// Create and register the Webeecam Listener object

wcs.setWCSListener(new WCS.WCSListener() {

//@Override device attachment handler

//@Override device detachment handler

….

….

//@Override frames handler

});

After this code, one could open the camera device using “wcs” instance, set their desired settings and start the camera video stream. Once the camera stream starts, the frames handler of the WCSListener will be called for each frame with frame information. The device attachment and detachment handlers above are called, when a camera is plugged or unplugged. Based on which the SDK user can choose to display UI elements on the device.

If you are interested in our SDK or have any queries, please feel free to reach out to us at support@webeecam.com

Leave a Reply

Your email address will not be published. Required fields are marked *