次の方法で共有


ICameraCaptureSampleSink::OnSampleAvailable method for Windows Phone 8

July 21, 2014

Applies to: Windows Phone 8 and Windows Phone Silverlight 8.1 only

Performs caller-implemented actions each time an encoded audio or video sample is captured.

VOID OnSampleAvailable(
   [in]    ULONGLONG hnsPresentationTime,
   [in]    ULONGLONG hnsSampleDuration,
   [in]    DWORD cbSample,
   [in]    BYTE* pSample
);

Parameters

  • hnsPresentationTime [in]
    Type: ULONGLONG

    The start time of the sample in units of hundred-nanoseconds.

  • hnsSampleDuration [in]
    Type: ULONGLONG

    The duration of the sample in units of hundred-nanoseconds.

  • cbSample [in]
    Type: DWORD

    The size of the sample in bytes.

  • pSample [in]
    Type: BYTE*

    A pointer to the sample data.

Return value

This method does not return a value.

Remarks

Use this sink by calling the IAudioVideoCaptureDeviceNative::SetAudioSampleSink method for Windows Phone 8 or the IAudioVideoCaptureDeviceNative::SetVideoSampleSink method for Windows Phone 8.

This sink only receives samples while the AudioVideoCaptureDevice object is recording. Recording starts when the StartRecordingToSinkAsync method is called and ends after StopRecordingAsync is called. Specify the audio and video encoding formats with the AudioEncodingFormat and VideoEncodingFormat properties, respectively.

Whether AudioVideoCaptureDevice captures audio or video is determined by which open method is used to create the capture device. Use the OpenAsync method for video samples with audio, OpenForAudioOnlyAsync for audio samples, and OpenForVideoOnlyAsync for video samples without audio.

Requirements

Minimum supported phone

Windows Phone 8

Header

Windows.Phone.Media.Capture.Native.h

Namespace

Windows::Phone::Media::Capture

See Also

Other Resources

Advanced photo capture for Windows Phone 8

Advanced capture properties for Windows Phone 8