共用方式為


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) 

事件類型

備註

收到此事件時,應用程式應該將要求的資料流程的MediaStreamSample指派給MediaStreamSourceSampleRequest物件的Sample屬性。

如果應用程式暫時無法傳遞MediaStreamSample,它應該取得MediaStreamSourceSampleRequestDeferral物件,並定期叫用ReportSampleProgress,直到將MediaStreamSample指派給Sample屬性,並在MediaStreamSourceSampleRequestDeferral物件上呼叫Complete每次叫用 ReportSampleProgress的建議間隔為 500 毫秒。

如果指定的資料流程沒有更多樣本,應用程式應該將 Sample 屬性保留為未指派,或將其設定為 null

適用於

另請參閱