共用方式為


VideoSink.OnSample Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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)

Syntax

'Declaration
Protected MustOverride Sub OnSample ( _
    sampleTimeInHundredNanoseconds As Long, _
    frameDurationInHundredNanoseconds As Long, _
    sampleData As Byte() _
)
protected abstract void OnSample(
    long sampleTimeInHundredNanoseconds,
    long frameDurationInHundredNanoseconds,
    byte[] sampleData
)

Parameters

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

Remarks

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.

Version Information

Silverlight

Supported in: 5, 4

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

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