MediaStreamSource.SampleRequested 事件

定义

MediaStreamSource 请求指定流的 MediaStreamSample 时发生。

// Register
event_token SampleRequested(TypedEventHandler<MediaStreamSource, MediaStreamSourceSampleRequestedEventArgs const&> const& handler) const;

// Revoke with event_token
void SampleRequested(event_token const* cookie) const;

// Revoke with event_revoker
MediaStreamSource::SampleRequested_revoker SampleRequested(auto_revoke_t, TypedEventHandler<MediaStreamSource, MediaStreamSourceSampleRequestedEventArgs const&> const& handler) const;
public event TypedEventHandler<MediaStreamSource,MediaStreamSourceSampleRequestedEventArgs> SampleRequested;
function onSampleRequested(eventArgs) { /* Your code */ }
mediaStreamSource.addEventListener("samplerequested", onSampleRequested);
mediaStreamSource.removeEventListener("samplerequested", onSampleRequested);
- or -
mediaStreamSource.onsamplerequested = onSampleRequested;
Public Custom Event SampleRequested As TypedEventHandler(Of MediaStreamSource, MediaStreamSourceSampleRequestedEventArgs) 

事件类型

注解

收到此事件后,应用程序应向 MediaStreamSourceSampleRequest 对象的 Sample 属性分配请求流的 MediaStreamSample。

如果应用程序暂时无法传递 MediaStreamSample,它应获取 MediaStreamSourceSampleRequestDeferral 对象并定期调用 ReportSampleProgress,直到它将 MediaStreamSample 分配给 Sample 属性,并在 MediaStreamSourceSampleRequestDeferral 对象上调用 Complete。 每次调用 ReportSampleProgress 之间的建议间隔为 500 毫秒。

如果指定的流没有更多示例,则应用程序应取消分配 Sample 属性或将其设置为 null

适用于

另请参阅