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

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.
nextViewAfterCancel:DcsViewEnum
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 page remains no change.

If it's set to DVE_IMAGEGALLERYVIEW, when the cancel button on the video view page is clicked, the current page 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 page is clicked, the current page 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 page is clicked, the current page redirects to the document editor view.

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

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

nextViewAfterCapture:DcsViewEnum
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 page remains no change.

If it's set to DVE_IMAGEGALLERYVIEW, when the capture button on the video view page is clicked, the current page 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 page is clicked, the current page 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 page is clicked, the current page redirects to the document editor view.

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

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

documentBoundaryColor:UIColor
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.

documentBoundaryThickness:Int
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 boundry of the document remains the same.

If it is set to 0, there are no boundaries 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.

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 boundries 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.

enum DcsCameraPositionEnum

DCPE_BACK=0x0010 Back camera
DCPE_FRONT Front camera
cameraPosition:DcsCameraPositionEnum
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.
capturingSoundEnable:Bool
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.
capturingSoundFile:String
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.

flashOnText:String
Description Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash 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.

flashOffText:String
Description Gets or sets the text showed on the flash tool item on the DcsUIVideoView when the flash 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.

flashAutoText:String
Description Gets or sets the text showed on the flash item on the DcsUIVideoView when the flash is in the auto state.
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.

flashTorchText:String
Description Gets or sets the text 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 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.

flashOnIcon:UIImage
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 showed on the flash tool item when the flash is on.

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

flashOffIcon:UIImage
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.

flashAutoIcon:UIImage
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.

flashTorchIcon:UIImage
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.

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.
flashMode:DcsFlashModeEnum
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.
captureIcon:UIImage
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.

cancelText:String
Description Gets or sets the text showed on the cancel tool item on the DcsUIVideoView.
Remarks If it is set to nil, no text will be showed on the cancel tool.

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

ifAllowDocumentCaptureWhenNotDetected:Bool
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.