DcsUIVideoView

Description

This class displays the video and controls the camera, inheriting UIView. It supports real-time document detection, capturing images and documents.

Members

Member Type Member Name Description
Property DcsViewEnum nextViewAfterCancel Gets or sets the view to navigate to when the cancel tool item is tapped. The default value is DEV_IMAGEGALLERYVIEW.
Property DcsViewEnum nextViewAfterCapture Gets or sets the view to navigate to when the capture tool item is tapped. The default value is DEV_VIDEOVIEW.
Property UIColor * documentBoundaryColor Gets or sets the document border color. The default is #5eb7e4.
Property NSInteger documentBoundaryThickness Gets or sets the document border thickness. The default is 6px.
Property DcsModeEnum mode Gets or sets the view mode. The default is DME_IMAGE.
Property DcsCameraPositionEnum cameraPosition Gets or sets the current camera position. The default is DCPE_BACK.
Property BOOL capturingSoundEnable Gets or sets whether there is a sound when capturing an image or a document. The default is NO.
Property NSString * capturingSoundFile Gets or sets the audio file to play when capturing an image or a document.
Property BOOL showFlashToolItem Gets or sets whether to display the flash tool item. The default value is "YES".
Property BOOL showCaptureToolItem Gets or sets whether to display the capture tool item. The default value is "YES".
Property BOOL showCancelToolItem Gets or sets whether to display the cancel tool item. The default value is "YES".
Property NSString * cancelText Gets or sets the text showed on the cancel tool item on the DcsUIVideoView. The default value is "Cancel".
Property NSString * flashOnText Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash is on. The default value is "On".
Property NSString * flashOffText Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash is off. The default value is "Off".
Property NSString * flashAutoText Gets or sets the text showed on the flash item on the DcsUIVideoView when the flash is in the auto state. The default value is "Auto".
Property NSString * flashTorchText Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash is in the torch state. The default value is "Torch".
Property UIImage * flashOnIcon Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is on.
Property UIImage * flashOffIcon Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is off.
Property UIImage * flashAutoIcon Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is in the auto state.
Property UIImage * flashTorchIcon Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is in the torch state.
Property DcsFlashModeEnum flashMode Gets or sets the flash mode. The default is DFME_OFF.
Property UIImage * captureIcon Gets or set the icon showed on the capture tool item on the DcsUIVideoView.
Property BOOL ifAllowDocumentCaptureWhenNotDetected Gets or sets whether to disable document capture function when no document is detected. The default value is NO.
delegate (void) onDocumentDetected: (id)sender
document: (DcsDocument*) document
This event is fired when a document is detected.
delegate (void) onCancelTapped: (id) sender The event is fired when the cancel tool item is clicked.
delegate (void) onCaptureTapped: (id) sender The event is fired when the capture tool item is clicked.
Method (void) preview Opens the video.
Method (void) stopPreview Stops the video.
delegate (BOOL) onPreCapture: (id) sender This event is fired before an image or a document is captured.
delegate (void) onPostCapture: (id) sender This event is fired after an image or a document is captured. At this time, the image/document is already in the buffer.
delegate (void) onCaptureFailure: (id)sender
exception: (DcsException *) exception
This event is fired when it fails to capture an image or a document.
Method (void) captureImage Captures an image.
Method (void) captureDocument Captures a document.

typedef enum DcsViewEnum

DVE_VIDEOVIEW=0x0010 Video view
DVE_IMAGEGALLERYVIEW Image gallery view
DVE_EDITORVIEW Edit view. When the data you operate with is a document, it displays the document editor. If it's an image, then it displays the image editor.
(nonatomic, assign) DcsViewEnum nextViewAfterCancel
Description Gets or sets the view to navigate to when the cancel tool item is tapped. The default value is DEV_IMAGEGALLERYVIEW.
Remarks If it's set to DVE_VIDEOVIEW, when the cancel button is clicked, the current view remains the same.

If it's set to DVE_IMAGEGALLERYVIEW, when the cancel button on the video view is clicked, the current view redirects to the image gallery view.

If it's set to DVE_EDITORVIEW and the capture mode is DME_IMAGE, when the cancel button on the video view is clicked, the current view redirects to the image editor view.

If it's set to DVE_EDITORVIEW and the capture mode is DME_DOCUMENT, when the cancel button on the video view is clicked, the current view redirects to the document editor view.

If it's not set to DVE_VIDEOVIEW, DVE_IMAGEGALLERYVIEW or DVE_EDITORVIEW, the exception DcsValueOutOfRangeException will be thrown.

If the value equals nil, it means the set fails, the exception DcsValueOutOfRangeException will be thrown.

(nonatomic, assign) DcsViewEnum nextViewAfterCapture
Description Gets or sets the view to navigate to when the capture tool item is tapped. The default value is DEV_VIDEOVIEW.
Remarks If it's set to DVE_VIDEOVIEW, when the capture button is clicked, the current view remains the same.

If it's set to DVE_IMAGEGALLERYVIEW, when the capture button on the video view is clicked, the current view redirects to the image gallery view.

If it's set to DVE_EDITORVIEW and the capture mode is DME_IMAGE, when the capture button on the video view is clicked, the current view redirects to the image editor view.

If it's set to DVE_EDITORVIEW and the capture mode is DME_DOCUMENT, when the capture button on the video view is clicked, the current view redirects to the document editor view.

If it's not set to DVE_VIDEOVIEW, DVE_IMAGEGALLERYVIEW or DVE_EDITORVIEW, the exception DcsValueOutOfRangeException will be thrown.

If the value equals nil, it means the set fails, the exception DcsValueOutOfRangeException will be thrown.

(nonatomic, strong) UIColor * documentBoundaryColor
Description Gets or sets the document border color. The default is #5eb7e4.
Remarks If it's set to a non UIColor object, the exception DcsTypeNotValidException will be thrown.

the value equals nil, it means the set fails, the exception DcsTypeNotValidException will be thrown.

(nonatomic, assign) NSInteger documentBoundaryThickness
Description Gets or sets the document border thickness. The default is 6px.
Remarks If the value you set is below 0, the set fails and the boundary of the document remains the same.

If it is set to 0, there is no boundary shown.

The maximum value is half of the width of the document. If the value you set exceeds the maximum value, it will be set to half of the width of the document.

If the value of the property is nil, it is treated as 0.

typedef enum DcsModeEnum

DME_IMAGE Displays the video stream and captures images.
DME_DOCUMENT Displays the video stream, detects documents in real time and captures documents.
(nonatomic, assign) DcsModeEnum mode
Description Gets or sets the view mode. The default is DME_IMAGE.
Remarks If it is set to DME_DOCUMENT, it will detect documents in real time and draw the boundaries of documents according to the value of property documentBoundaryColor and documentBoundaryThickness. When a document is detected, the event onDocumentDetected will be fired.

If the value is neither DME_DOCUMENT nor DME_IMAGE, the exception DcsValueOutOfRangeException will be thrown.

typedef enum DcsCameraPositionEnum

DCPE_BACK=0x0010 Back camera
DCPE_FRONT Front camera
(nonatomic, assign) DcsCameraPositionEnum cameraPosition
Description Gets or sets the current camera position. The default is DCPE_BACK.
Remarks If the value is neither DCPE_BACK nor DCPE_FRONT, the exception DcsValueOutOfRangeException will be thrown.
(nonatomic, assign) BOOL capturingSoundEnable
Description Gets or sets whether there is a sound when capturing an image or a document. The default is NO.
Remarks YES means there is a sound when a document or an image is captured. NO indicates there is no sound when a document or an image is captured.
(nonatomic, strong) NSString * capturingSoundFile
Description Gets or sets the audio file to play when capturing an image or a document.
Remarks The audio file should be a caf file. If nil, it's treated as success and the system's audio file will be used.

If the audio file does not exist, the exception DcsFileNotFound will be thrown.

If the audio file is not a caf file, no sound is played.

If the value is not the NSString type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) NSString * flashOnText
Description Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash is on. The default value is "On".
Remarks If it is set to nil, no text will be showed on the flash tool item when flash is on.

If the value is not the NSString type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) NSString * flashOffText
Description Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash is off. The default value is "Off".
Remarks If it is set to nil, no text will be showed on the flash tool item when flash is off.

If the value is not the NSString type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) NSString * flashAutoText
Description Gets or sets the text showed on the flash item on the DcsUIVideoView when the flash is in the auto state. The default value is "Auto".
Remarks If it is set to nil, no text will be showed on the flash tool item when flash is in the auto state.

If the value is not the NSString type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) NSString * flashTorchText
Description Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash is in the torch state. The default value is "Torch".
Remarks If it is set to nil, no text will be showed on the flash tool item when flash is in the torch state.

If the value is not the NSString type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) UIImage * flashOnIcon
Description Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is on.
Remarks If it is set to nil, no icon will be shown on the flash tool item when the flash is on.

If the value is not the UIImage type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) UIImage * flashOffIcon
Description Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is off.
Remarks If it is set to nil, no icon will be showed on the flash tool item when the flash is off.

If the value is not the UIImage type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) UIImage * flashAutoIcon
Description Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is in the auto state.
Remarks If it is set to nil, no icon will be showed on the flash tool item when the flash is in the auto state.

If the value is not the UIImage type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) UIImage * flashTorchIcon
Description Gets or sets the icon showed on the flash tool item on the DcsUIVideoView when the flash is in the torch state.
Remarks If it is set to nil, no icon will be showed on the flash tool item when the flash is in the torch state.

If the value is not the UIImage type, the exception DcsTypeNotValidException will be thrown.

typedef enum DcsFlashModeEnum

DFME_ON=0x0100 Shine once when an image or a document is captured.
DFME_OFF The flash is off.
DFME_AUTO Let the environment decide whether to shine once when an image or a document is captured.
DFME_TORCH The flash is always open.
(nonatomic, assign) DcsFlashModeEnum flashMode
Description Gets or sets the flash mode. The default is DFME_OFF.
Remarks If the value is not DFME_ON, DFME_OFF, DFME_TORCH or DFME_AUTO, the exception DcsValueOutOfRangeException will be thrown.
(nonatomic, strong) UIImage * captureIcon
Description Gets or set the icon showed on the capture tool item on the DcsUIVideoView.
Remarks If it is set to nil, no icon will be showed on the capture tool item and it may cause the size of the capture tool item to be 0, so the capture tool item can’t be touched. If you want to hide the capture tool item, please set property showCaptureToolItem to NO.

If the value is not the UIImage type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, strong) NSString * cancelText
Description Gets or sets the text showed on the cancel tool item on the DcsUIVideoView. The default value is "Cancel".
Remarks If it is set to nil, no text will be shown on the cancel tool.

If the value is not the NSString type, the exception DcsTypeNotValidException will be thrown.

(nonatomic, assign) BOOL ifAllowDocumentCaptureWhenNotDetected
Description Gets or sets whether to disable document capture function when no document is detected. The default value is NO.
Remarks When ifAllowDocumentCaptureWhenNotDetected is NO, you can’t capture documents when no document is detected. If you try to call captureDocument() or click the capture tool item on the UI to capture documents in that case, the event onCaptureFailure will be fired, and the exception DcsDocumentNotDetectedException will be thrown.
Is this page helpful?

Leave a Reply

Your email address will not be published.