RadWebCam
Represents a web cam control that displays the stream provided by a web cam.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.RadWebCam.dll
Syntax:
[TelerikToolboxCategory("Data Controls")]
public class RadWebCam : RadControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, INotifyPropertyChanged, ISupportInitializeNotification, ISupportInitialize, IComponentTreeHandler, ILayoutHandler, IAnalyticsProvider, IMediaFoundationRenderSurface
Inheritance: objectMarshalByRefObjectComponentControlScrollableControlRadControlRadWebCam...
Implements:
Inherited Members
Constructors
Initializes a new instance of the RadWebCam class with default settings. The control will automatically start the first detected webcam when loaded.
public RadWebCam()
Properties
Gets or sets whether the control will automatically start the first webcam it finds when the control is loaded.
public bool AutoStart { get; set; }
Gets the element representing the border of the camera.
public LightVisualElement CameraBorderElement { get; }
Gets or sets the height of the panel with the camera controls.
public int ControlPanelHeight { get; set; }
Gets the default size of the control.
protected override Size DefaultSize { get; }
Overrides:
Gets a value indicating whether the camera is in a state where something is preventing normal operation.
public bool HasError { get; protected set; }
Gets or sets a value indicating whether the control is in snapshot preview mode.
public bool IsPreviewingSnapshot { get; set; }
Gets or sets a value indicating whether the source content is being recorded to a file.
public bool IsRecording { get; set; }
Gets or sets whether the control will go into preview mode when a snapshot is taken.
public bool PreviewSnapshots { get; set; }
Gets or sets the file path where video files are saved when recording from the webcam. Must be set before calling StartRecording() method.
public string RecordingFilePath { get; set; }
Gets the element used to display snapshot previews or error messages.
public LightVisualElement SnapshotPreviewElement { get; }
Gets or sets the format string for displaying elapsed time during video recording. Uses standard DateTime format strings.
public string VideoRecordingElapsedTimeFormat { get; set; }
Gets the main web cam control element.
public RadWebCamElement WebCamElement { get; }
Methods
Creates the camera border element.
Creates and initializes the child elements of the RadWebCam control.
protected override void CreateChildItems(RadElement parent)
The root element of the control's element tree.
Overrides:
Creates the root RadElement of the control.
Creates the snapshot preview element.
Creates the main RadWebCam element.
Creates the root element of RadWebCam.
Discards the taken snapshot when the control is in preview snapshot mode.
public virtual void DiscardSnapshot()
Releases the unmanaged resources used by the RadWebCam control and its child controls and optionally releases the managed resources.
protected override void Dispose(bool disposing)
true to release both managed and unmanaged resources; false to release only unmanaged resources.
Overrides:
Gets a list with all the available audio capture devices on the system.
public static ReadOnlyCollection<MediaFoundationDeviceInfo> GetAudioCaptureDevices()
ReadOnlyCollection<MediaFoundationDeviceInfo>
A read-only collection of audio capture devices available on the system.
Gets a list with all the available video capture devices (webcams) on the system.
public static ReadOnlyCollection<MediaFoundationDeviceInfo> GetVideoCaptureDevices()
ReadOnlyCollection<MediaFoundationDeviceInfo>
A read-only collection of video capture devices available on the system.
Gets a list with all the available video file formats for the provided capture device.
public static ReadOnlyCollection<MediaFoundationVideoFormatInfo> GetVideoFormats(MediaFoundationDeviceInfo device, bool recordingFormatsOnly = false)
The device for which to get the available formats.
recordingFormatsOnlyboolIf set to true - only formats that allow saving to a video file will be returned.
Returns:ReadOnlyCollection<MediaFoundationVideoFormatInfo>
A read-only collection of video formats supported by the specified device.
Starts up the video pipeline and displays the video from the source inside of the control with audio support.
public virtual void Initialize(MediaFoundationDeviceInfo videoDevice, MediaFoundationVideoFormatInfo videoFormat, MediaFoundationDeviceInfo audioDevice)
The device to use as a video source.
videoFormatMediaFoundationVideoFormatInfoThe format from the video source.
audioDeviceMediaFoundationDeviceInfoThe device to use as an audio source.
Exceptions:Thrown when videoDevice or videoFormat is null.
Starts up the video pipeline and displays the video from the source inside of the control.
public virtual void Initialize(MediaFoundationDeviceInfo videoDevice, MediaFoundationVideoFormatInfo videoFormat)
The device to use as a video source.
videoFormatMediaFoundationVideoFormatInfoThe format from the video source.
Fires the CameraError event.
protected virtual void OnCameraError(CameraErrorEventArgs e)
The event arguments.
Notifies that the control is about to be visualized and initializes the webcam position.
protected override void OnLoad(Size desiredSize)
The desired size of the control.
Overrides:
Fires the RecordingEnded event.
Fires the RecordingStarted event.
protected virtual void OnRecordingStarted(CancelEventArgs e)
The event arguments.
Fires the SettingsDialogShowing event.
protected virtual void OnSettingsDialogShowing(CameraSettingsDialogShowingEventArgs e)
The event arguments.
Fires the SnapshotTaken event.
protected virtual void OnSnapshotTaken(SnapshotTakenEventArgs e)
The event arguments.
Pauses the video pipeline and pauses displaying the video feed.
public virtual void Pause()
Triggers the SnapshotTaken event when the control is in preview snapshot mode.
public virtual void SaveSnapshot()
Performs the work of setting the specified bounds of this control and updates the webcam stream position.
protected override void SetBoundsCore(int x, int y, int width, int height, BoundsSpecified specified)
The new x-coordinate of the control.
yintThe new y-coordinate of the control.
widthintThe new width of the control.
heightintThe new height of the control.
specifiedBoundsSpecifiedA bitwise combination of BoundsSpecified values.
Overrides:
Shows the camera settings dialog which allows configuring camera properties. The SettingsDialogShowing event can be used to customize or cancel the dialog.
public virtual void ShowSettingsDialog()
Shuts down the video pipeline.
public virtual void ShutDown()
Starts the video pipeline and starts displaying the video feed.
public virtual void Start()
Starts capturing the media source(s) to a file. The RecordingFilePath property must be set before calling this method.
public virtual void StartRecording()
Stops the video pipeline and stops displaying the video feed.
public virtual void Stop()
Stops the file capture.
public virtual void StopRecording()
Takes a snapshot from the currently displayed webcam video feed. If PreviewSnapshots is true, the snapshot will be displayed for preview before firing the SnapshotTaken event. Otherwise, the SnapshotTaken event will be fired immediately.
public virtual void TakeSnapshot()
Events
Occurs when an error is preventing the camera from operating normally.
public event EventHandler<CameraErrorEventArgs> CameraError
Occurs when video recording has ended.
public event EventHandler RecordingEnded
Occurs when video recording is started.
public event EventHandler<CancelEventArgs> RecordingStarted
Occurs when the settings dialog is about to be shown.
public event EventHandler<CameraSettingsDialogShowingEventArgs> SettingsDialogShowing
Occurs when a snapshot is taken from the webcam. If PreviewSnapshots is set to true, the event is fired only when the SaveSnapshot() method is called.
public event EventHandler<SnapshotTakenEventArgs> SnapshotTaken