共用方式為


interface ICoreWebView2ScreenCaptureStartingEventArgs

interface ICoreWebView2ScreenCaptureStartingEventArgs
  : public IUnknown

Event args for the ScreenCaptureStarting event.

Summary

Members Descriptions
get_Cancel Gets the Cancel property.
get_Handled Gets the Handled property.
get_OriginalSourceFrameInfo The associated frame information that requests the screen capture permission.
GetDeferral Returns an ICoreWebView2Deferral object.
put_Cancel The host may set this flag to cancel the screen capture.
put_Handled By default, both the ScreenCaptureStarting event handlers on the CoreWebView2Frame and the CoreWebView2 will be invoked, with the CoreWebView2Frame event handlers invoked first.

Applies to

Product Introduced
WebView2 Win32 N/A
WebView2 Win32 Prerelease 1.0.2895

Members

get_Cancel

Gets the Cancel property.

public HRESULT get_Cancel(BOOL * value)

get_Handled

Gets the Handled property.

public HRESULT get_Handled(BOOL * value)

get_OriginalSourceFrameInfo

The associated frame information that requests the screen capture permission.

public HRESULT get_OriginalSourceFrameInfo(ICoreWebView2FrameInfo ** value)

This can be used to get the frame source, name, frameId, and parent frame information.

GetDeferral

Returns an ICoreWebView2Deferral object.

public HRESULT GetDeferral(ICoreWebView2Deferral ** value)

Use this deferral to defer the decision to show the Screen Capture UI. getDisplayMedia() won't call its callbacks until the deferral is completed.

put_Cancel

The host may set this flag to cancel the screen capture.

public HRESULT put_Cancel(BOOL value)

If canceled, the screen capture UI is not displayed regardless of the Handled property. On the script side, it will return with a NotAllowedError as Permission denied.

put_Handled

By default, both the ScreenCaptureStarting event handlers on the CoreWebView2Frame and the CoreWebView2 will be invoked, with the CoreWebView2Frame event handlers invoked first.

public HRESULT put_Handled(BOOL value)

The host may set this flag to TRUE within the CoreWebView2Frame event handlers to prevent the remaining CoreWebView2 event handlers from being invoked. If the flag is set to FALSE within the CoreWebView2Frame event handlers, downstream handlers can update the Cancel property.

If a deferral is taken on the event args, then you must synchronously set Handled to TRUE prior to taking your deferral to prevent the CoreWebView2s event handlers from being invoked.