Camera
Namespace: Wisej.Web.Ext.Camera
Assembly: Wisej.Web.Ext.Camera
The Camera component makes it possible to take pictures with the device's camera and upload them to the server.
- C#
- VB.NET
public class Camera : Control, IWisejHandler
Public Class Camera
Inherits Control
Implements IWisejHandler
Constructors
Camera()
Initializes a new instance of the Camera class.
Properties
Audio
Boolean: Specifies whether audio should be recorded. (Default: False)
BorderStyle
BorderStyle: Indicates the border style for the control. (Default: Solid)
DeviceName
String: Specifies the video device to use. (Default: "")
If not specified or invalid it will use the first device returned by the browser.
FacingMode
VideoFacingMode: Specifies whether the video is front-facing (mobile-only). (Default: True)
HeightCapture
Int32: Video capture resolution - Height (Default: True)
Mirror
Boolean: Specifies whether the media should be mirrored. (Default: False)
ObjectFit
ObjectFit: Specifies the object-fit to apply to the video. (Default: True)
See css3_object-fit.
Video
Boolean: Specifies whether video should be recorded. (Default: True)
VideoFilter
String: Returns or sets the filter (filter) to apply to the video. (Default: null)
WidthCapture
Int32: Video capture resolution - Width (Default: True)
Methods
GetDevices(callback)
Returns the names of the available video devices.
| Parameter | Type | Description |
|---|---|---|
| callback | Action<String[]> | Callback method to receive the device names. |
Throws:
- ArgumentNullException callback is null.
GetDevices(refresh, callback)
Returns the names of the available video devices.
| Parameter | Type | Description |
|---|---|---|
| refresh | Boolean | Refreshes the list of devices from the browser. |
| callback | Action<String[]> | Callback method to receive the device names. |
Throws:
- ArgumentNullException callback is null.
GetDevicesAsync(refresh)
Returns the names of the available video devices.
| Parameter | Type | Description |
|---|---|---|
| refresh | Boolean | Refreshes the list of devices from the browser. Default is false. |
Returns: Task<String[]>. An awaitable Task.
GetImage(callback)
Returns the current image from the camera.
| Parameter | Type | Description |
|---|---|---|
| callback | Action<Image> | Callback method to receive the Image or null. |
Throws:
- ArgumentNullException callback is null.
GetImageAsync()
Returns the current image from the camera asynchronously.
Returns: Task<Image>. An awaitable Task.
StartRecording(format, bitsPerSecond, updateInterval)
Starts recording.
| Parameter | Type | Description |
|---|---|---|
| format | String | The video encoding mime type format, MIME_types. |
| bitsPerSecond | Int32 | Audio and video bits per second. MediaRecorder. |
| updateInterval | Int32 | Update interval in seconds. The default is zero causing the video to be uploaded on StopRecording. |
You must call StopRecordingto end recording.
StopRecording()
Stops recording and uploads the recorded stream to the Uploaded event.
Events
Error
CameraErrorHandler Fired when an error occurs in the camera setup or usage.
Progress
UploadProgressEventHandler Fired while the Camera control receives the recording stream being uploaded.
This event fires only if there is an handler attached to it. A simple overload of the On[Event] method in a derived class will not be invoked unless there is at least one handler attached to the event.
Uploaded
UploadedEventHandler Fired when the current recording is available for download.