OnSample Method

VideoSink.OnSample Method


When overridden in a derived class, is invoked when a video device captures a complete video sample.

Namespace:  System.Windows.Media
Assembly:  System.Windows (in System.Windows.dll)

protected abstract void OnSample(
	long sampleTimeInHundredNanoseconds,
	long frameDurationInHundredNanoseconds,
	byte[] sampleData


Type: System.Int64
The time, in 100-nanosecond units, when the sample was captured.
Type: System.Int64
The duration of the sample, in 100-nanosecond units.
Type: System.Byte[]
A byte stream that contains video data. The byte stream should be processed into samples according to the relevant video format information.

A complete sample is one video frame, with the frame rate reported in VideoFormat.FramesPerSecond for the associated VideoCaptureDevice. To work with the sampleData, you may also need to know other properties as reported in VideoFormat.

Each time a frame is ready from a video capture device, this method is called.


Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

© 2015 Microsoft