• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Class (ScreenCaptureHandler)
2
3Implements the **ScreenCaptureHandler** object for accepting or rejecting a screen capture request. For details about the sample code, see [onScreenCaptureRequest](./arkts-basic-components-web-events.md#onscreencapturerequest10).
4
5> **NOTE**
6>
7> - The initial APIs of this component are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
8>
9> - The initial APIs of this class are supported since API version 9.
10>
11> - You can preview how this component looks on a real device, but not in DevEco Studio Previewer.
12
13## constructor<sup>10+</sup>
14
15constructor()
16
17Constructs a **ScreenCaptureHandler** object.
18
19**System capability**: SystemCapability.Web.Webview.Core
20
21## deny<sup>10+</sup>
22
23deny(): void
24
25Rejects this screen capture request.
26
27**System capability**: SystemCapability.Web.Webview.Core
28
29## getOrigin<sup>10+</sup>
30
31getOrigin(): string
32
33Obtains the origin of this web page.
34
35**System capability**: SystemCapability.Web.Webview.Core
36
37**Return value**
38
39| Type    | Description          |
40| ------ | ------------ |
41| string | Origin of the web page that requests the permission.|
42
43## grant<sup>10+</sup>
44
45grant(config: ScreenCaptureConfig): void
46
47Grants the screen capture permission.
48
49> **NOTE**
50>
51> The **ohos.permission.MICROPHONE** permission must be declared.
52
53**System capability**: SystemCapability.Web.Webview.Core
54
55**Parameters**
56
57| Name   | Type                                    | Mandatory  | Description   |
58| ------ | ---------------------------------------- | ---- | ------- |
59| config | [ScreenCaptureConfig](./arkts-basic-components-web-ScreenCaptureHandler.md) | Yes  | Screen capture configuration.|
60