DCEPhotoListener
The protocol that provide method for capturing photo from the camera.
@protocol DCEPhotoListener <NSObject>
Method | Type | Description |
---|---|---|
photoOutputCallback |
required | The callback method for user to receive the captured photo. |
photoOutputCallback
The callback method for user to receive the captured photo. User can complete the method by adding code to execute with the capture image.
- (void)photoOutputCallback:(NSData *)jpegBytes;
Parameters
jpegBytes
The byte data of the captured image.
Code Snippet
- Objective-C
- Swift
@interface ViewController ()<DCEPhotoListener> - (void)configurationDCE(){ // When you trigger takePhote method, the library firstly capture a photo // When the photo is captured and stored in memory, it will be processed by DBR [_dce takePhoto:self] } - (void)photoOutputCallback:(NSData *)jpegBytes{ // Add your code to execute when photo is captured. // For example, you can use Dynamsoft Barcode Reader (DBR) to decode the byte image. NSArray<iTextResult*> *barcodeResults = [_dbr decodeFileInMemory:jpegBytes error:nil]; }
class ViewController: UIViewController, DCEPhotoListener { func configurationDCE(){ // When you trigger takePhote method, the library firstly capture a photo // When the photo is captured and stored in memory, it will be processed by DBR dce.takePhoto() } func photoOutputCallback(_ jpegByte: Data){ // Add your code to execute when photo is captured. // For example, you can use Dynamsoft Barcode Reader (DBR) to decode the byte image. do{ let barcodeResults = try dbr.decodeFileInMemory(jpegByte) }catch{ // Add your code to deal with the exceptions. } } }