1e41f4b71Sopenharmony_ci# AVScreenCapture 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ci## Overview 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ciThe AVScreenCapture module provides APIs for screen capture. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci**Since**: 10 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci## Summary 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ci### Files 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci| Name| Description| 19e41f4b71Sopenharmony_ci| -------- | -------- | 20e41f4b71Sopenharmony_ci| [native_avscreen_capture.h](native__avscreen__capture_8h.md) | Declares the APIs used to create an **OH_AVScreenCapture** instance.| 21e41f4b71Sopenharmony_ci| [native_avscreen_capture_base.h](native__avscreen__capture__base_8h.md) | Declares the common structs, character constants, and enums used for running screen capture.| 22e41f4b71Sopenharmony_ci| [native_avscreen_capture_errors.h](native__avscreen__capture__errors_8h.md) | Declares the error codes generated during screen capture.| 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci### Structs 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci| Name| Description| 28e41f4b71Sopenharmony_ci| -------- | -------- | 29e41f4b71Sopenharmony_ci| struct [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) | Describes the audio capture information.| 30e41f4b71Sopenharmony_ci| struct [OH_AudioEncInfo](_o_h___audio_enc_info.md) | Describes the audio encoding information.| 31e41f4b71Sopenharmony_ci| struct [OH_AudioInfo](_o_h___audio_info.md) | Describes the audio information.| 32e41f4b71Sopenharmony_ci| struct [OH_VideoCaptureInfo](_o_h___video_capture_info.md) | Describes the video capture information.| 33e41f4b71Sopenharmony_ci| struct [OH_VideoEncInfo](_o_h___video_enc_info.md) | Describes the video encoding information.| 34e41f4b71Sopenharmony_ci| struct [OH_VideoInfo](_o_h___video_info.md) |Describes the video information.| 35e41f4b71Sopenharmony_ci| struct [OH_RecorderInfo](_o_h___recorder_info.md) | Describes the recording file information.| 36e41f4b71Sopenharmony_ci| struct [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) | Describes the screen capture configuration.| 37e41f4b71Sopenharmony_ci| struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) | Describes all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance.| 38e41f4b71Sopenharmony_ci| struct [OH_Rect](_o_h___rect.md) | Describes the width, height, and image information of the rectangle used for screen capture.| 39e41f4b71Sopenharmony_ci| struct [OH_AudioBuffer](_o_h___audio_buffer.md) | Describes the configuration such as the size, type, and timestamp of audio data.| 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci### Types 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci| Name| Description| 45e41f4b71Sopenharmony_ci| -------- | -------- | 46e41f4b71Sopenharmony_ci| typedef struct [OH_NativeBuffer](#oh_nativebuffer) [OH_NativeBuffer](#oh_nativebuffer) | Defines the native video stream class for screen capture.| 47e41f4b71Sopenharmony_ci| typedef struct [OH_AVScreenCapture](#oh_avscreencapture) [OH_AVScreenCapture](#oh_avscreencapture) | Defines a screen capture instance used to obtain original video and audio streams.| 48e41f4b71Sopenharmony_ci| typedef struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) | Defines a struct for the filter used to filter audio and video content.| 49e41f4b71Sopenharmony_ci| typedef enum [OH_CaptureMode](#oh_capturemode-1) [OH_CaptureMode](#oh_capturemode) | Defines an enum for the screen capture modes.| 50e41f4b71Sopenharmony_ci| typedef enum [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype-1) [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) | Defines an enum for the audio source types during screen capture.| 51e41f4b71Sopenharmony_ci| typedef enum [OH_AudioCodecFormat](#oh_audiocodecformat-1) [OH_AudioCodecFormat](#oh_audiocodecformat) | Defines an enum for the audio encoding formats.| 52e41f4b71Sopenharmony_ci| typedef enum [OH_VideoCodecFormat](#oh_videocodecformat-1) [OH_VideoCodecFormat](#oh_videocodecformat) | Defines an enum for the video encoding formats.| 53e41f4b71Sopenharmony_ci| typedef enum [OH_DataType](#oh_datatype-1) [OH_DataType](#oh_datatype) | Defines an enum for the data types of screen capture streams.| 54e41f4b71Sopenharmony_ci| typedef enum [OH_VideoSourceType](#oh_videosourcetype-1) [OH_VideoSourceType](#oh_videosourcetype) | Defines an enum for the video source formats.| 55e41f4b71Sopenharmony_ci| typedef enum [OH_ContainerFormatType](#oh_containerformattype-1) [OH_ContainerFormatType](#oh_containerformattype) | Defines an enum for the types of files generated during screen capture.| 56e41f4b71Sopenharmony_ci| typedef struct [OH_AudioCaptureInfo](_o_h___audio_capture_info.md) [OH_AudioCaptureInfo](#oh_audiocaptureinfo) | Defines a struct for the audio capture information.| 57e41f4b71Sopenharmony_ci| typedef struct [OH_AudioEncInfo](_o_h___audio_enc_info.md) [OH_AudioEncInfo](#oh_audioencinfo) | Defines a struct for the audio encoding information.| 58e41f4b71Sopenharmony_ci| typedef struct [OH_AudioInfo](_o_h___audio_info.md) [OH_AudioInfo](#oh_audioinfo) | Defines a struct for the audio information.| 59e41f4b71Sopenharmony_ci| typedef struct [OH_VideoCaptureInfo](_o_h___video_capture_info.md) [OH_VideoCaptureInfo](#oh_videocaptureinfo) | Defines a struct for the video capture information.| 60e41f4b71Sopenharmony_ci| typedef struct [OH_VideoEncInfo](_o_h___video_enc_info.md) [OH_VideoEncInfo](#oh_videoencinfo) | Defines a struct for the video encoding information.| 61e41f4b71Sopenharmony_ci| typedef struct [OH_VideoInfo](_o_h___video_info.md) [OH_VideoInfo](#oh_videoinfo) | Defines a struct for the video information.| 62e41f4b71Sopenharmony_ci| typedef struct [OH_RecorderInfo](_o_h___recorder_info.md) [OH_RecorderInfo](#oh_recorderinfo) | Defines a struct for the recording file information.| 63e41f4b71Sopenharmony_ci| typedef struct [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) [OH_AVScreenCaptureConfig](#oh_avscreencaptureconfig) | Defines a struct for the screen capture configuration.| 64e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t errorCode) | Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance.| 65e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isReady, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | Defines a pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance.| 66e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isReady) | Defines a pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance.| 67e41f4b71Sopenharmony_ci| typedef struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) [OH_AVScreenCaptureCallback](#oh_avscreencapturecallback) | Defines a struct for all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance.| 68e41f4b71Sopenharmony_ci| typedef struct [OH_Rect](_o_h___rect.md) [OH_Rect](#oh_rect) | Defines a struct for the width, height, and image information of the rectangle used for screen capture.| 69e41f4b71Sopenharmony_ci| typedef struct [OH_AudioBuffer](_o_h___audio_buffer.md) [OH_AudioBuffer](#oh_audiobuffer) | Defines a struct for the configuration such as the size, type, and timestamp of audio data.| 70e41f4b71Sopenharmony_ci| typedef enum [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode-1) [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode) | Defines an enum for the screen capture states.| 71e41f4b71Sopenharmony_ci| typedef enum [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype-1) [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype) | Defines an enum for the buffer types.| 72e41f4b71Sopenharmony_ci| typedef enum [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent-1) [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent) | Defines an enum for the types of audio that can be added to a content filter.| 73e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange)) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode) stateCode, void \*userData) | Defines a pointer to a callback function that is called when the state changes during the running of an **OH_AVScreenCapture** instance.| 74e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t errorCode, void \*userData) | Defines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance.| 75e41f4b71Sopenharmony_ci| typedef void(\* [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable)) ([OH_AVScreenCapture](#oh_avscreencapture) \*capture, OH_AVBuffer \*buffer, [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype) bufferType, int64_t timestamp, void \*userData) | Defines a pointer to a callback function that is called when an audio or a video buffer is available during the running of an **OH_AVScreenCapture** instance.| 76e41f4b71Sopenharmony_ci| typedef enum [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1) [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) | Defines an enum for the error codes generated during screen recording.| 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci### Enums 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci| Name| Description| 82e41f4b71Sopenharmony_ci| -------- | -------- | 83e41f4b71Sopenharmony_ci| [OH_CaptureMode](#oh_capturemode-1) {<br>OH_CAPTURE_HOME_SCREEN = 0,<br>OH_CAPTURE_SPECIFIED_SCREEN = 1,<br>OH_CAPTURE_SPECIFIED_WINDOW = 2,<br>OH_CAPTURE_INVAILD = -1<br>} | Enumerates the screen capture modes.| 84e41f4b71Sopenharmony_ci| [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype-1) {<br>OH_SOURCE_INVALID = -1,<br>OH_SOURCE_DEFAULT = 0,<br>OH_MIC = 1,<br>OH_ALL_PLAYBACK = 2,<br>OH_APP_PLAYBACK = 3<br>} | Enumerates the audio source types during screen capture.| 85e41f4b71Sopenharmony_ci| [OH_AudioCodecFormat](#oh_audiocodecformat-1) {<br>OH_AUDIO_DEFAULT = 0,<br>OH_AAC_LC = 3,<br>OH_AUDIO_CODEC_FORMAT_BUTT<br>} | Enumerates the audio encoding formats.| 86e41f4b71Sopenharmony_ci| [OH_VideoCodecFormat](#oh_videocodecformat-1) {<br>OH_VIDEO_DEFAULT = 0,<br>OH_H264 = 2,<br>OH_H265 = 4,<br>OH_MPEG4 = 6,<br>OH_VP8 = 8,<br>OH_VP9 = 10,<br>OH_VIDEO_CODEC_FORMAT_BUTT<br>} | Enumerates the video encoding formats.| 87e41f4b71Sopenharmony_ci| [OH_DataType](#oh_datatype-1) {<br>OH_ORIGINAL_STREAM = 0,<br>OH_ENCODED_STREAM = 1,<br>OH_CAPTURE_FILE = 2,<br>OH_INVAILD = -1<br>} | Enumerates the data types of screen capture streams.| 88e41f4b71Sopenharmony_ci| [OH_VideoSourceType](#oh_videosourcetype-1) {<br>OH_VIDEO_SOURCE_SURFACE_YUV = 0,<br>OH_VIDEO_SOURCE_SURFACE_ES,<br>OH_VIDEO_SOURCE_SURFACE_RGBA,<br>OH_VIDEO_SOURCE_BUTT<br>} | Enumerates the video source formats.| 89e41f4b71Sopenharmony_ci| [OH_ContainerFormatType](#oh_containerformattype) {<br>CFT_MPEG_4A = 0,<br>CFT_MPEG_4 = 1<br>} | Enumerates the types of files generated during screen capture.| 90e41f4b71Sopenharmony_ci| [OH_AVScreenCaptureStateCode](#oh_avscreencapturestatecode-1) {<br>OH_SCREEN_CAPTURE_STATE_STARTED = 0,<br>OH_SCREEN_CAPTURE_STATE_CANCELED = 1,<br>OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER = 2,<br>OH_SCREEN_CAPTURE_STATE_INTERRUPTED_BY_OTHER = 3,<br>OH_SCREEN_CAPTURE_STATE_STOPPED_BY_CALL = 4,<br>OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE = 5,<br>OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER = 6,<br>OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_USER = 7,<br>OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE = 8,<br>OH_SCREEN_CAPTURE_STATE_EXIT_PRIVATE_SCENE = 9<br>OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER_SWITCHES = 10<br>} | Enumerates the screen capture states.| 91e41f4b71Sopenharmony_ci| [OH_AVScreenCaptureBufferType](#oh_avscreencapturebuffertype-1) {<br>OH_SCREEN_CAPTURE_BUFFERTYPE_VIDEO = 0,<br>OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_INNER = 1,<br>OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_MIC = 2<br>} | Enumerates the buffer types.| 92e41f4b71Sopenharmony_ci| [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent-1) {<br>OH_SCREEN_CAPTURE_NOTIFICATION_AUDIO = 0, <br>OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO = 1 <br>} | Enumerates the types of audio that can be added to a content filter. | 93e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1) {<br>AV_SCREEN_CAPTURE_ERR_BASE = 0,<br>AV_SCREEN_CAPTURE_ERR_OK = AV_SCREEN_CAPTURE_ERR_BASE,<br>AV_SCREEN_CAPTURE_ERR_NO_MEMORY = AV_SCREEN_CAPTURE_ERR_BASE + 1,<br>AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT = AV_SCREEN_CAPTURE_ERR_BASE + 2,<br>AV_SCREEN_CAPTURE_ERR_INVALID_VAL = AV_SCREEN_CAPTURE_ERR_BASE + 3,<br>AV_SCREEN_CAPTURE_ERR_IO = AV_SCREEN_CAPTURE_ERR_BASE + 4,<br>AV_SCREEN_CAPTURE_ERR_TIMEOUT = AV_SCREEN_CAPTURE_ERR_BASE + 5,<br>AV_SCREEN_CAPTURE_ERR_UNKNOWN = AV_SCREEN_CAPTURE_ERR_BASE + 6,<br>AV_SCREEN_CAPTURE_ERR_SERVICE_DIED = AV_SCREEN_CAPTURE_ERR_BASE + 7,<br>AV_SCREEN_CAPTURE_ERR_INVALID_STATE = AV_SCREEN_CAPTURE_ERR_BASE + 8,<br>AV_SCREEN_CAPTURE_ERR_UNSUPPORT = AV_SCREEN_CAPTURE_ERR_BASE + 9,<br>AV_SCREEN_CAPTURE_ERR_EXTEND_START = AV_SCREEN_CAPTURE_ERR_BASE + 100<br>} | Enumerates the error codes generated during screen recording.| 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ci### Functions 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci| Name| Description| 99e41f4b71Sopenharmony_ci| -------- | -------- | 100e41f4b71Sopenharmony_ci| struct [OH_AVScreenCapture](#oh_avscreencapture) \* [OH_AVScreenCapture_Create](#oh_avscreencapture_create) (void) | Creates an **OH_AVScreenCapture** instance. | 101e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_Init](#oh_avscreencapture_init) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCaptureConfig](_o_h___a_v_screen_capture_config.md) config) | Initializes parameters related to an **OH_AVScreenCapture** instance, including audio sampling parameters for external capture using microphones (optional), audio sampling parameters for internal capture, and video resolution parameters. | 102e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Starts screen capture and collects original streams. | 103e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenCaptureWithSurface](#oh_avscreencapture_startscreencapturewithsurface) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, OHNativeWindow \*window) | Starts screen capture in surface mode. | 104e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StopScreenCapture](#oh_avscreencapture_stopscreencapture) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Stops screen capture. This function is used in pair with **OH_AVScreenCapture_StartScreenCapture**. | 105e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StartScreenRecording](#oh_avscreencapture_startscreenrecording) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Starts screen recording, with recordings saved in files. | 106e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_StopScreenRecording](#oh_avscreencapture_stopscreenrecording) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Stops screen recording. This function is used in pair with **OH_AVScreenCapture_StartScreenRecording**.| 107e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AudioBuffer](_o_h___audio_buffer.md) \*\*audiobuffer, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | Obtains an audio buffer. When calling this function, the application must allocate the memory of the corresponding struct size to the audio buffer. | 108e41f4b71Sopenharmony_ci| [OH_NativeBuffer](#oh_nativebuffer) \* [OH_AVScreenCapture_AcquireVideoBuffer](#oh_avscreencapture_acquirevideobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t \*fence, int64_t \*timestamp, struct [OH_Rect](_o_h___rect.md) \*region) | Obtains a video buffer. An application can call this function to obtain information such as the video buffer and timestamp. | 109e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseAudioBuffer](#oh_avscreencapture_releaseaudiobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype) type) | Releases an audio buffer. | 110e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Releases a video buffer. After the video buffer is no longer needed, call this function to release it. | 111e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, struct [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) callback) | Sets a callback to listen for available video buffers and audio buffers and errors that occur during the function calling. | 112e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_Release](#oh_avscreencapture_release) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture) | Releases an **OH_AVScreenCapture** instance. This function is used in pair with **OH_AVScreenCapture_Create**. | 113e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetMicrophoneEnabled](#oh_avscreencapture_setmicrophoneenabled) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool isMicrophone) | Enables or disables the microphone. | 114e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetStateCallback](#oh_avscreencapture_setstatecallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange) callback, void \*userData) | Sets a state change callback. This function must be called before screen capture starts. | 115e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetDataCallback](#oh_avscreencapture_setdatacallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) callback, void \*userData) | Sets a data processing callback. This function must be called before screen capture starts. | 116e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetErrorCallback](#oh_avscreencapture_seterrorcallback) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) callback, void \*userData) | Sets an error processing callback. This function must be called before screen capture starts. | 117e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SetCanvasRotation](#oh_avscreencapture_setcanvasrotation) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, bool canvasRotation) | Sets canvas rotation for screen capture. | 118e41f4b71Sopenharmony_ci| struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \* [OH_AVScreenCapture_CreateContentFilter](#oh_avscreencapture_createcontentfilter) (void) | Creates a content filter. | 119e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ReleaseContentFilter](#oh_avscreencapture_releasecontentfilter) (struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter) | Releases a content filter. | 120e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ContentFilter_AddAudioContent](#oh_avscreencapture_contentfilter_addaudiocontent) (struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter, [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent) content) | Adds audio content to a content filter. | 121e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ExcludeContent](#oh_avscreencapture_excludecontent) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter) | Sets a content filter for an **OH_AVScreenCapture** instance. | 122e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ContentFilter_AddWindowContent](#oh_avscreencapture_contentfilter_addwindowcontent) (struct [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) \*filter, int32_t \*windowIDs, int32_t windowCount) | Adds a list of window IDs to a **ContentFilter** instance. | 123e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_ResizeCanvas](#oh_avscreencapture_resizecanvas) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t width, int32_t height) | Adjusts the screen resolution. | 124e41f4b71Sopenharmony_ci| [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode) [OH_AVScreenCapture_SkipPrivacyMode](#oh_avscreencapture_skipprivacymode) (struct [OH_AVScreenCapture](#oh_avscreencapture) \*capture, int32_t \*windowIDs, int32_t windowCount) | Exempts privacy windows during screen capture. | 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ci## Type Description 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci### OH_AudioBuffer 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci``` 133e41f4b71Sopenharmony_citypedef struct OH_AudioBuffer OH_AudioBuffer 134e41f4b71Sopenharmony_ci``` 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci**Description** 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ciDefines a struct for the configuration such as the size, type, and timestamp of audio data. 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 141e41f4b71Sopenharmony_ci 142e41f4b71Sopenharmony_ci**Since**: 10 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_ci### OH_AudioCaptureInfo 146e41f4b71Sopenharmony_ci 147e41f4b71Sopenharmony_ci``` 148e41f4b71Sopenharmony_citypedef struct OH_AudioCaptureInfo OH_AudioCaptureInfo 149e41f4b71Sopenharmony_ci``` 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci**Description** 152e41f4b71Sopenharmony_ci 153e41f4b71Sopenharmony_ciDefines a struct for the audio capture information. 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ciWhen both **audioSampleRate** and **audioChannels** are **0**, the audio-related parameters are ignored and the audio data is not recorded. 156e41f4b71Sopenharmony_ci 157e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 158e41f4b71Sopenharmony_ci 159e41f4b71Sopenharmony_ci**Since**: 10 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ci### OH_AudioCaptureSourceType 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci``` 165e41f4b71Sopenharmony_citypedef enum OH_AudioCaptureSourceType OH_AudioCaptureSourceType 166e41f4b71Sopenharmony_ci``` 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_ci**Description** 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ciDefines an enum for the audio source types during screen capture. 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ci**Since**: 10 175e41f4b71Sopenharmony_ci 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci### OH_AudioCodecFormat 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ci``` 180e41f4b71Sopenharmony_citypedef enum OH_AudioCodecFormat OH_AudioCodecFormat 181e41f4b71Sopenharmony_ci``` 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ci**Description** 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ciDefines an enum for the audio encoding formats. 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci**Since**: 10 190e41f4b71Sopenharmony_ci 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ci### OH_AudioEncInfo 193e41f4b71Sopenharmony_ci 194e41f4b71Sopenharmony_ci``` 195e41f4b71Sopenharmony_citypedef struct OH_AudioEncInfo OH_AudioEncInfo 196e41f4b71Sopenharmony_ci``` 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ci**Description** 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_ciDefines a struct for the audio encoding information. 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci**Since**: 10 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ci 207e41f4b71Sopenharmony_ci### OH_AudioInfo 208e41f4b71Sopenharmony_ci 209e41f4b71Sopenharmony_ci``` 210e41f4b71Sopenharmony_citypedef struct OH_AudioInfo OH_AudioInfo 211e41f4b71Sopenharmony_ci``` 212e41f4b71Sopenharmony_ci 213e41f4b71Sopenharmony_ci**Description** 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ciDefines a struct for the audio information. 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ciTo perform both external capture (using microphones) and internal capture, **audioSampleRate** and **audioChannels** must be the same for both audio channels. 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 220e41f4b71Sopenharmony_ci 221e41f4b71Sopenharmony_ci**Since**: 10 222e41f4b71Sopenharmony_ci 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_ci### OH_AVSCREEN_CAPTURE_ErrCode 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ci``` 227e41f4b71Sopenharmony_citypedef enum OH_AVSCREEN_CAPTURE_ErrCode OH_AVSCREEN_CAPTURE_ErrCode 228e41f4b71Sopenharmony_ci``` 229e41f4b71Sopenharmony_ci 230e41f4b71Sopenharmony_ci**Description** 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ciDefines an enum for the error codes generated during screen recording. 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ci**Since**: 10 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ci 239e41f4b71Sopenharmony_ci### OH_AVScreenCapture 240e41f4b71Sopenharmony_ci 241e41f4b71Sopenharmony_ci``` 242e41f4b71Sopenharmony_citypedef struct OH_AVScreenCaptureOH_AVScreenCapture 243e41f4b71Sopenharmony_ci``` 244e41f4b71Sopenharmony_ci 245e41f4b71Sopenharmony_ci**Description** 246e41f4b71Sopenharmony_ci 247e41f4b71Sopenharmony_ciDefines a screen capture instance used to obtain original video and audio streams. 248e41f4b71Sopenharmony_ci 249e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 250e41f4b71Sopenharmony_ci 251e41f4b71Sopenharmony_ci**Since**: 10 252e41f4b71Sopenharmony_ci 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ContentFilter 255e41f4b71Sopenharmony_ci 256e41f4b71Sopenharmony_ci``` 257e41f4b71Sopenharmony_citypedef struct OH_AVScreenCapture_ContentFilterOH_AVScreenCapture_ContentFilter 258e41f4b71Sopenharmony_ci``` 259e41f4b71Sopenharmony_ci 260e41f4b71Sopenharmony_ci**Description** 261e41f4b71Sopenharmony_ci 262e41f4b71Sopenharmony_ciDefines a struct for the filter used to filter audio and video content. 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ci**Since**: 12 267e41f4b71Sopenharmony_ci 268e41f4b71Sopenharmony_ci 269e41f4b71Sopenharmony_ci### OH_AVScreenCapture_OnBufferAvailable 270e41f4b71Sopenharmony_ci 271e41f4b71Sopenharmony_ci``` 272e41f4b71Sopenharmony_citypedef void(* OH_AVScreenCapture_OnBufferAvailable) (OH_AVScreenCapture *capture, OH_AVBuffer *buffer, OH_AVScreenCaptureBufferType bufferType, int64_t timestamp, void *userData) 273e41f4b71Sopenharmony_ci``` 274e41f4b71Sopenharmony_ci 275e41f4b71Sopenharmony_ci**Description** 276e41f4b71Sopenharmony_ci 277e41f4b71Sopenharmony_ciDefines a pointer to a callback function that is called when an audio or a video buffer is available during the running of an **OH_AVScreenCapture** instance. 278e41f4b71Sopenharmony_ci 279e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 280e41f4b71Sopenharmony_ci 281e41f4b71Sopenharmony_ci**Since**: 12 282e41f4b71Sopenharmony_ci 283e41f4b71Sopenharmony_ci**Parameters** 284e41f4b71Sopenharmony_ci 285e41f4b71Sopenharmony_ci| Name| Description| 286e41f4b71Sopenharmony_ci| -------- | -------- | 287e41f4b71Sopenharmony_ci| capture | Pointer to an **OH_AVScreenCapture** instance. | 288e41f4b71Sopenharmony_ci| buffer | Pointer to the **OH_AVBuffer** instance. After the callback is triggered, the buffer is no longer valid. | 289e41f4b71Sopenharmony_ci| bufferType | Type of the buffer. | 290e41f4b71Sopenharmony_ci| timestamp | Timestamp, in nanoseconds. | 291e41f4b71Sopenharmony_ci| userData | Pointer to the user-defined data carried in the function.| 292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ci 294e41f4b71Sopenharmony_ci### OH_AVScreenCapture_OnError 295e41f4b71Sopenharmony_ci 296e41f4b71Sopenharmony_ci``` 297e41f4b71Sopenharmony_citypedef void(* OH_AVScreenCapture_OnError) (OH_AVScreenCapture *capture, int32_t errorCode, void *userData) 298e41f4b71Sopenharmony_ci``` 299e41f4b71Sopenharmony_ci 300e41f4b71Sopenharmony_ci**Description** 301e41f4b71Sopenharmony_ci 302e41f4b71Sopenharmony_ciDefines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. 303e41f4b71Sopenharmony_ci 304e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 305e41f4b71Sopenharmony_ci 306e41f4b71Sopenharmony_ci**Since**: 12 307e41f4b71Sopenharmony_ci 308e41f4b71Sopenharmony_ci**Parameters** 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ci| Name| Description| 311e41f4b71Sopenharmony_ci| -------- | -------- | 312e41f4b71Sopenharmony_ci| capture | Pointer to an **OH_AVScreenCapture** instance. | 313e41f4b71Sopenharmony_ci| errorCode | Error code. | 314e41f4b71Sopenharmony_ci| userData | Pointer to the user-defined data carried in the function.| 315e41f4b71Sopenharmony_ci 316e41f4b71Sopenharmony_ci 317e41f4b71Sopenharmony_ci### OH_AVScreenCapture_OnStateChange 318e41f4b71Sopenharmony_ci 319e41f4b71Sopenharmony_ci``` 320e41f4b71Sopenharmony_citypedef void(* OH_AVScreenCapture_OnStateChange) (struct OH_AVScreenCapture *capture, OH_AVScreenCaptureStateCode stateCode, void *userData) 321e41f4b71Sopenharmony_ci``` 322e41f4b71Sopenharmony_ci 323e41f4b71Sopenharmony_ci**Description** 324e41f4b71Sopenharmony_ci 325e41f4b71Sopenharmony_ciDefines a pointer to a callback function that is called when the state changes during the running of an **OH_AVScreenCapture** instance. 326e41f4b71Sopenharmony_ci 327e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 328e41f4b71Sopenharmony_ci 329e41f4b71Sopenharmony_ci**Since**: 12 330e41f4b71Sopenharmony_ci 331e41f4b71Sopenharmony_ci**Parameters** 332e41f4b71Sopenharmony_ci 333e41f4b71Sopenharmony_ci| Name| Description| 334e41f4b71Sopenharmony_ci| -------- | -------- | 335e41f4b71Sopenharmony_ci| capture | Pointer to an **OH_AVScreenCapture** instance. | 336e41f4b71Sopenharmony_ci| stateCode | Status code. | 337e41f4b71Sopenharmony_ci| userData | Pointer to the user-defined data carried in the function.| 338e41f4b71Sopenharmony_ci 339e41f4b71Sopenharmony_ci 340e41f4b71Sopenharmony_ci### OH_AVScreenCaptureBufferType 341e41f4b71Sopenharmony_ci 342e41f4b71Sopenharmony_ci``` 343e41f4b71Sopenharmony_citypedef enum OH_AVScreenCaptureBufferTypeOH_AVScreenCaptureBufferType 344e41f4b71Sopenharmony_ci``` 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci**Description** 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ciDefines an enum for the buffer types. 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ci**Since**: 12 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ci 355e41f4b71Sopenharmony_ci### OH_AVScreenCaptureCallback 356e41f4b71Sopenharmony_ci 357e41f4b71Sopenharmony_ci``` 358e41f4b71Sopenharmony_citypedef struct OH_AVScreenCaptureCallback OH_AVScreenCaptureCallback 359e41f4b71Sopenharmony_ci``` 360e41f4b71Sopenharmony_ci 361e41f4b71Sopenharmony_ci**Description** 362e41f4b71Sopenharmony_ci 363e41f4b71Sopenharmony_ciDefines a struct for all the asynchronous callback function pointers of an **OH_AVScreenCapture** instance. To ensure the normal running of **OH_AVScreenCapture**, you must register the instance of this struct with the **OH_AVScreenCapture** instance and process the information reported by the callback functions. 364e41f4b71Sopenharmony_ci 365e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 366e41f4b71Sopenharmony_ci 367e41f4b71Sopenharmony_ci**Since**: 10 368e41f4b71Sopenharmony_ci 369e41f4b71Sopenharmony_ci**Deprecated from**: 12 370e41f4b71Sopenharmony_ci 371e41f4b71Sopenharmony_ci**Substitute APIs** 372e41f4b71Sopenharmony_ci 373e41f4b71Sopenharmony_ci[OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) and [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 374e41f4b71Sopenharmony_ci 375e41f4b71Sopenharmony_ci**Parameters** 376e41f4b71Sopenharmony_ci 377e41f4b71Sopenharmony_ci| Name| Description| 378e41f4b71Sopenharmony_ci| -------- | -------- | 379e41f4b71Sopenharmony_ci| onError | Pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror).| 380e41f4b71Sopenharmony_ci| onAudioBufferAvailable | Pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable).| 381e41f4b71Sopenharmony_ci| onVideoBufferAvailable | Pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance. For details, see [OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable).| 382e41f4b71Sopenharmony_ci 383e41f4b71Sopenharmony_ci 384e41f4b71Sopenharmony_ci### OH_AVScreenCaptureConfig 385e41f4b71Sopenharmony_ci 386e41f4b71Sopenharmony_ci``` 387e41f4b71Sopenharmony_citypedef struct OH_AVScreenCaptureConfig OH_AVScreenCaptureConfig 388e41f4b71Sopenharmony_ci``` 389e41f4b71Sopenharmony_ci 390e41f4b71Sopenharmony_ci**Description** 391e41f4b71Sopenharmony_ci 392e41f4b71Sopenharmony_ciDefines a struct for the screen capture configuration. 393e41f4b71Sopenharmony_ci 394e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 395e41f4b71Sopenharmony_ci 396e41f4b71Sopenharmony_ci**Since**: 10 397e41f4b71Sopenharmony_ci 398e41f4b71Sopenharmony_ci 399e41f4b71Sopenharmony_ci### OH_AVScreenCaptureFilterableAudioContent 400e41f4b71Sopenharmony_ci 401e41f4b71Sopenharmony_ci``` 402e41f4b71Sopenharmony_citypedef enum OH_AVScreenCaptureFilterableAudioContent OH_AVScreenCaptureFilterableAudioContent 403e41f4b71Sopenharmony_ci``` 404e41f4b71Sopenharmony_ci 405e41f4b71Sopenharmony_ci**Description** 406e41f4b71Sopenharmony_ci 407e41f4b71Sopenharmony_ciDefines an enum for the types of audio that can be added to a content filter. 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 410e41f4b71Sopenharmony_ci 411e41f4b71Sopenharmony_ci**Since**: 12 412e41f4b71Sopenharmony_ci 413e41f4b71Sopenharmony_ci 414e41f4b71Sopenharmony_ci### OH_AVScreenCaptureOnAudioBufferAvailable 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci``` 417e41f4b71Sopenharmony_citypedef void(* OH_AVScreenCaptureOnAudioBufferAvailable) (OH_AVScreenCapture *capture, bool isReady, OH_AudioCaptureSourceType type) 418e41f4b71Sopenharmony_ci``` 419e41f4b71Sopenharmony_ci 420e41f4b71Sopenharmony_ci**Description** 421e41f4b71Sopenharmony_ci 422e41f4b71Sopenharmony_ciDefines a pointer to a callback function that is called when an audio buffer is available during the running of an **OH_AVScreenCapture** instance. 423e41f4b71Sopenharmony_ci 424e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 425e41f4b71Sopenharmony_ci 426e41f4b71Sopenharmony_ci**Since**: 10 427e41f4b71Sopenharmony_ci 428e41f4b71Sopenharmony_ci**Deprecated from**: 12 429e41f4b71Sopenharmony_ci 430e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 431e41f4b71Sopenharmony_ci 432e41f4b71Sopenharmony_ci**Parameters** 433e41f4b71Sopenharmony_ci 434e41f4b71Sopenharmony_ci| Name| Description| 435e41f4b71Sopenharmony_ci| -------- | -------- | 436e41f4b71Sopenharmony_ci| capture | Pointer to an **OH_AVScreenCapture** instance. | 437e41f4b71Sopenharmony_ci| isReady | Whether the audio buffer is available. | 438e41f4b71Sopenharmony_ci| type | Audio source type.| 439e41f4b71Sopenharmony_ci 440e41f4b71Sopenharmony_ci 441e41f4b71Sopenharmony_ci### OH_AVScreenCaptureOnError 442e41f4b71Sopenharmony_ci 443e41f4b71Sopenharmony_ci``` 444e41f4b71Sopenharmony_citypedef void(* OH_AVScreenCaptureOnError) (OH_AVScreenCapture *capture, int32_t errorCode) 445e41f4b71Sopenharmony_ci``` 446e41f4b71Sopenharmony_ci 447e41f4b71Sopenharmony_ci**Description** 448e41f4b71Sopenharmony_ci 449e41f4b71Sopenharmony_ciDefines a pointer to a callback function that is called when an error occurs during the running of an **OH_AVScreenCapture** instance. 450e41f4b71Sopenharmony_ci 451e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 452e41f4b71Sopenharmony_ci 453e41f4b71Sopenharmony_ci**Since**: 10 454e41f4b71Sopenharmony_ci 455e41f4b71Sopenharmony_ci**Deprecated from**: 12 456e41f4b71Sopenharmony_ci 457e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) 458e41f4b71Sopenharmony_ci 459e41f4b71Sopenharmony_ci**Parameters** 460e41f4b71Sopenharmony_ci 461e41f4b71Sopenharmony_ci| Name| Description| 462e41f4b71Sopenharmony_ci| -------- | -------- | 463e41f4b71Sopenharmony_ci| capture | Pointer to an **OH_AVScreenCapture** instance. | 464e41f4b71Sopenharmony_ci| errorCode | Error code.| 465e41f4b71Sopenharmony_ci 466e41f4b71Sopenharmony_ci 467e41f4b71Sopenharmony_ci### OH_AVScreenCaptureOnVideoBufferAvailable 468e41f4b71Sopenharmony_ci 469e41f4b71Sopenharmony_ci``` 470e41f4b71Sopenharmony_citypedef void(* OH_AVScreenCaptureOnVideoBufferAvailable) (OH_AVScreenCapture *capture, bool isReady) 471e41f4b71Sopenharmony_ci``` 472e41f4b71Sopenharmony_ci 473e41f4b71Sopenharmony_ci**Description** 474e41f4b71Sopenharmony_ci 475e41f4b71Sopenharmony_ciDefines a pointer to a callback function that is called when a video buffer is available during the running of an **OH_AVScreenCapture** instance. 476e41f4b71Sopenharmony_ci 477e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 478e41f4b71Sopenharmony_ci 479e41f4b71Sopenharmony_ci**Since**: 10 480e41f4b71Sopenharmony_ci 481e41f4b71Sopenharmony_ci**Deprecated from**: 12 482e41f4b71Sopenharmony_ci 483e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 484e41f4b71Sopenharmony_ci 485e41f4b71Sopenharmony_ci**Parameters** 486e41f4b71Sopenharmony_ci 487e41f4b71Sopenharmony_ci| Name| Description| 488e41f4b71Sopenharmony_ci| -------- | -------- | 489e41f4b71Sopenharmony_ci| capture | Pointer to an **OH_AVScreenCapture** instance. | 490e41f4b71Sopenharmony_ci| isReady | Whether the video buffer is available.| 491e41f4b71Sopenharmony_ci 492e41f4b71Sopenharmony_ci 493e41f4b71Sopenharmony_ci### OH_AVScreenCaptureStateCode 494e41f4b71Sopenharmony_ci 495e41f4b71Sopenharmony_ci``` 496e41f4b71Sopenharmony_citypedef enum OH_AVScreenCaptureStateCode OH_AVScreenCaptureStateCode 497e41f4b71Sopenharmony_ci``` 498e41f4b71Sopenharmony_ci 499e41f4b71Sopenharmony_ci**Description** 500e41f4b71Sopenharmony_ci 501e41f4b71Sopenharmony_ciDefines an enum for the screen capture states. 502e41f4b71Sopenharmony_ci 503e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 504e41f4b71Sopenharmony_ci 505e41f4b71Sopenharmony_ci**Since**: 12 506e41f4b71Sopenharmony_ci 507e41f4b71Sopenharmony_ci 508e41f4b71Sopenharmony_ci### OH_CaptureMode 509e41f4b71Sopenharmony_ci 510e41f4b71Sopenharmony_ci``` 511e41f4b71Sopenharmony_citypedef enum OH_CaptureMode OH_CaptureMode 512e41f4b71Sopenharmony_ci``` 513e41f4b71Sopenharmony_ci 514e41f4b71Sopenharmony_ci**Description** 515e41f4b71Sopenharmony_ci 516e41f4b71Sopenharmony_ciDefines an enum for the screen capture modes. 517e41f4b71Sopenharmony_ci 518e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 519e41f4b71Sopenharmony_ci 520e41f4b71Sopenharmony_ci**Since**: 10 521e41f4b71Sopenharmony_ci 522e41f4b71Sopenharmony_ci 523e41f4b71Sopenharmony_ci### OH_ContainerFormatType 524e41f4b71Sopenharmony_ci 525e41f4b71Sopenharmony_ci``` 526e41f4b71Sopenharmony_citypedef enum OH_ContainerFormatType OH_ContainerFormatType 527e41f4b71Sopenharmony_ci``` 528e41f4b71Sopenharmony_ci 529e41f4b71Sopenharmony_ci**Description** 530e41f4b71Sopenharmony_ci 531e41f4b71Sopenharmony_ciDefines an enum for the types of files generated during screen capture. 532e41f4b71Sopenharmony_ci 533e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 534e41f4b71Sopenharmony_ci 535e41f4b71Sopenharmony_ci**Since**: 10 536e41f4b71Sopenharmony_ci 537e41f4b71Sopenharmony_ci 538e41f4b71Sopenharmony_ci### OH_DataType 539e41f4b71Sopenharmony_ci 540e41f4b71Sopenharmony_ci``` 541e41f4b71Sopenharmony_citypedef enum OH_DataType OH_DataType 542e41f4b71Sopenharmony_ci``` 543e41f4b71Sopenharmony_ci 544e41f4b71Sopenharmony_ci**Description** 545e41f4b71Sopenharmony_ci 546e41f4b71Sopenharmony_ciDefines an enum for the data types of screen capture streams. 547e41f4b71Sopenharmony_ci 548e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 549e41f4b71Sopenharmony_ci 550e41f4b71Sopenharmony_ci**Since**: 10 551e41f4b71Sopenharmony_ci 552e41f4b71Sopenharmony_ci 553e41f4b71Sopenharmony_ci### OH_NativeBuffer 554e41f4b71Sopenharmony_ci 555e41f4b71Sopenharmony_ci``` 556e41f4b71Sopenharmony_citypedef struct OH_NativeBuffer OH_NativeBuffer 557e41f4b71Sopenharmony_ci``` 558e41f4b71Sopenharmony_ci 559e41f4b71Sopenharmony_ci**Description** 560e41f4b71Sopenharmony_ci 561e41f4b71Sopenharmony_ciDefines the native video stream class for screen capture. 562e41f4b71Sopenharmony_ci 563e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 564e41f4b71Sopenharmony_ci 565e41f4b71Sopenharmony_ci**Since**: 10 566e41f4b71Sopenharmony_ci 567e41f4b71Sopenharmony_ci 568e41f4b71Sopenharmony_ci### OH_RecorderInfo 569e41f4b71Sopenharmony_ci 570e41f4b71Sopenharmony_ci``` 571e41f4b71Sopenharmony_citypedef struct OH_RecorderInfo OH_RecorderInfo 572e41f4b71Sopenharmony_ci``` 573e41f4b71Sopenharmony_ci 574e41f4b71Sopenharmony_ci**Description** 575e41f4b71Sopenharmony_ci 576e41f4b71Sopenharmony_ciDefines a struct for the recording file information. 577e41f4b71Sopenharmony_ci 578e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 579e41f4b71Sopenharmony_ci 580e41f4b71Sopenharmony_ci**Since**: 10 581e41f4b71Sopenharmony_ci 582e41f4b71Sopenharmony_ci 583e41f4b71Sopenharmony_ci### OH_Rect 584e41f4b71Sopenharmony_ci 585e41f4b71Sopenharmony_ci``` 586e41f4b71Sopenharmony_citypedef struct OH_Rect OH_Rect 587e41f4b71Sopenharmony_ci``` 588e41f4b71Sopenharmony_ci 589e41f4b71Sopenharmony_ci**Description** 590e41f4b71Sopenharmony_ci 591e41f4b71Sopenharmony_ciDefines a struct for the width, height, and image information of the rectangle used for screen capture. 592e41f4b71Sopenharmony_ci 593e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 594e41f4b71Sopenharmony_ci 595e41f4b71Sopenharmony_ci**Since**: 10 596e41f4b71Sopenharmony_ci 597e41f4b71Sopenharmony_ci 598e41f4b71Sopenharmony_ci### OH_VideoCaptureInfo 599e41f4b71Sopenharmony_ci 600e41f4b71Sopenharmony_ci``` 601e41f4b71Sopenharmony_citypedef struct OH_VideoCaptureInfo OH_VideoCaptureInfo 602e41f4b71Sopenharmony_ci``` 603e41f4b71Sopenharmony_ci 604e41f4b71Sopenharmony_ci**Description** 605e41f4b71Sopenharmony_ci 606e41f4b71Sopenharmony_ciDefines a struct for the video capture information. 607e41f4b71Sopenharmony_ci 608e41f4b71Sopenharmony_ciWhen **videoFrameWidth** and **videoFrameHeight** are both **0**, video-related parameters are ignored and screen data is not recorded. 609e41f4b71Sopenharmony_ci 610e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 611e41f4b71Sopenharmony_ci 612e41f4b71Sopenharmony_ci**Since**: 10 613e41f4b71Sopenharmony_ci 614e41f4b71Sopenharmony_ci 615e41f4b71Sopenharmony_ci### OH_VideoCodecFormat 616e41f4b71Sopenharmony_ci 617e41f4b71Sopenharmony_ci``` 618e41f4b71Sopenharmony_citypedef enum OH_VideoCodecFormat OH_VideoCodecFormat 619e41f4b71Sopenharmony_ci``` 620e41f4b71Sopenharmony_ci 621e41f4b71Sopenharmony_ci**Description** 622e41f4b71Sopenharmony_ci 623e41f4b71Sopenharmony_ciDefines an enum for the video encoding formats. 624e41f4b71Sopenharmony_ci 625e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 626e41f4b71Sopenharmony_ci 627e41f4b71Sopenharmony_ci**Since**: 10 628e41f4b71Sopenharmony_ci 629e41f4b71Sopenharmony_ci 630e41f4b71Sopenharmony_ci### OH_VideoEncInfo 631e41f4b71Sopenharmony_ci 632e41f4b71Sopenharmony_ci``` 633e41f4b71Sopenharmony_citypedef struct OH_VideoEncInfo OH_VideoEncInfo 634e41f4b71Sopenharmony_ci``` 635e41f4b71Sopenharmony_ci 636e41f4b71Sopenharmony_ci**Description** 637e41f4b71Sopenharmony_ci 638e41f4b71Sopenharmony_ciDefines a struct for the video encoding information. 639e41f4b71Sopenharmony_ci 640e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 641e41f4b71Sopenharmony_ci 642e41f4b71Sopenharmony_ci**Since**: 10 643e41f4b71Sopenharmony_ci 644e41f4b71Sopenharmony_ci 645e41f4b71Sopenharmony_ci### OH_VideoInfo 646e41f4b71Sopenharmony_ci 647e41f4b71Sopenharmony_ci``` 648e41f4b71Sopenharmony_citypedef struct OH_VideoInfo OH_VideoInfo 649e41f4b71Sopenharmony_ci``` 650e41f4b71Sopenharmony_ci 651e41f4b71Sopenharmony_ci**Description** 652e41f4b71Sopenharmony_ci 653e41f4b71Sopenharmony_ciDefines a struct for the video information. 654e41f4b71Sopenharmony_ci 655e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 656e41f4b71Sopenharmony_ci 657e41f4b71Sopenharmony_ci**Since**: 10 658e41f4b71Sopenharmony_ci 659e41f4b71Sopenharmony_ci 660e41f4b71Sopenharmony_ci### OH_VideoSourceType 661e41f4b71Sopenharmony_ci 662e41f4b71Sopenharmony_ci``` 663e41f4b71Sopenharmony_citypedef enum OH_VideoSourceType OH_VideoSourceType 664e41f4b71Sopenharmony_ci``` 665e41f4b71Sopenharmony_ci 666e41f4b71Sopenharmony_ci**Description** 667e41f4b71Sopenharmony_ci 668e41f4b71Sopenharmony_ciDefines an enum for the video source formats. 669e41f4b71Sopenharmony_ci 670e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 671e41f4b71Sopenharmony_ci 672e41f4b71Sopenharmony_ci**Since**: 10 673e41f4b71Sopenharmony_ci 674e41f4b71Sopenharmony_ci 675e41f4b71Sopenharmony_ci## Enum Description 676e41f4b71Sopenharmony_ci 677e41f4b71Sopenharmony_ci 678e41f4b71Sopenharmony_ci### OH_AudioCaptureSourceType 679e41f4b71Sopenharmony_ci 680e41f4b71Sopenharmony_ci``` 681e41f4b71Sopenharmony_cienum OH_AudioCaptureSourceType 682e41f4b71Sopenharmony_ci``` 683e41f4b71Sopenharmony_ci 684e41f4b71Sopenharmony_ci**Description** 685e41f4b71Sopenharmony_ci 686e41f4b71Sopenharmony_ciEnumerates the audio source types during screen capture. 687e41f4b71Sopenharmony_ci 688e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 689e41f4b71Sopenharmony_ci 690e41f4b71Sopenharmony_ci**Since**: 10 691e41f4b71Sopenharmony_ci 692e41f4b71Sopenharmony_ci| Value| Description| 693e41f4b71Sopenharmony_ci| -------- | -------- | 694e41f4b71Sopenharmony_ci| OH_SOURCE_INVALID | Invalid audio source. | 695e41f4b71Sopenharmony_ci| OH_SOURCE_DEFAULT | Default audio source. The default value is **MIC**. | 696e41f4b71Sopenharmony_ci| OH_MIC | External audio streams recorded by the microphone. | 697e41f4b71Sopenharmony_ci| OH_ALL_PLAYBACK | All internal audio streams played by the system. | 698e41f4b71Sopenharmony_ci| OH_APP_PLAYBACK | Internal audio streams played by a specified application. | 699e41f4b71Sopenharmony_ci 700e41f4b71Sopenharmony_ci 701e41f4b71Sopenharmony_ci### OH_AudioCodecFormat 702e41f4b71Sopenharmony_ci 703e41f4b71Sopenharmony_ci``` 704e41f4b71Sopenharmony_cienum OH_AudioCodecFormat 705e41f4b71Sopenharmony_ci``` 706e41f4b71Sopenharmony_ci 707e41f4b71Sopenharmony_ci**Description** 708e41f4b71Sopenharmony_ci 709e41f4b71Sopenharmony_ciEnumerates the audio encoding formats. 710e41f4b71Sopenharmony_ci 711e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 712e41f4b71Sopenharmony_ci 713e41f4b71Sopenharmony_ci**Since**: 10 714e41f4b71Sopenharmony_ci 715e41f4b71Sopenharmony_ci| Value| Description| 716e41f4b71Sopenharmony_ci| -------- | -------- | 717e41f4b71Sopenharmony_ci| OH_AUDIO_DEFAULT | Default audio encoding format. The default value is **AAC_LC**. | 718e41f4b71Sopenharmony_ci| OH_AAC_LC | AAC_LC audio encoding. | 719e41f4b71Sopenharmony_ci| OH_AUDIO_CODEC_FORMAT_BUTT | Invalid format. | 720e41f4b71Sopenharmony_ci 721e41f4b71Sopenharmony_ci 722e41f4b71Sopenharmony_ci### OH_AVSCREEN_CAPTURE_ErrCode 723e41f4b71Sopenharmony_ci 724e41f4b71Sopenharmony_ci``` 725e41f4b71Sopenharmony_cienum OH_AVSCREEN_CAPTURE_ErrCode 726e41f4b71Sopenharmony_ci``` 727e41f4b71Sopenharmony_ci 728e41f4b71Sopenharmony_ci**Description** 729e41f4b71Sopenharmony_ci 730e41f4b71Sopenharmony_ciEnumerates the error codes generated during screen recording. 731e41f4b71Sopenharmony_ci 732e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 733e41f4b71Sopenharmony_ci 734e41f4b71Sopenharmony_ci**Since**: 10 735e41f4b71Sopenharmony_ci 736e41f4b71Sopenharmony_ci| Value| Description| 737e41f4b71Sopenharmony_ci| -------- | -------- | 738e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_BASE | Basic value returned when an API call error occurs.| 739e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_OK | Operation successful.| 740e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_NO_MEMORY | Memory insufficient.| 741e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT | Operation not allowed.| 742e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_INVALID_VAL | Invalid parameter.| 743e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_IO | Abnormal input and output streams.| 744e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_TIMEOUT | Network timeout.| 745e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_UNKNOWN | Unknown error.| 746e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_SERVICE_DIED | Media service terminated.| 747e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_INVALID_STATE | Unsupported operation in this state.| 748e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_UNSUPPORT | Unsupported interface.| 749e41f4b71Sopenharmony_ci| AV_SCREEN_CAPTURE_ERR_EXTEND_START | Unexpected error.| 750e41f4b71Sopenharmony_ci 751e41f4b71Sopenharmony_ci 752e41f4b71Sopenharmony_ci### OH_AVScreenCaptureBufferType 753e41f4b71Sopenharmony_ci 754e41f4b71Sopenharmony_ci``` 755e41f4b71Sopenharmony_cienum OH_AVScreenCaptureBufferType 756e41f4b71Sopenharmony_ci``` 757e41f4b71Sopenharmony_ci 758e41f4b71Sopenharmony_ci**Description** 759e41f4b71Sopenharmony_ci 760e41f4b71Sopenharmony_ciEnumerates the buffer types. 761e41f4b71Sopenharmony_ci 762e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 763e41f4b71Sopenharmony_ci 764e41f4b71Sopenharmony_ci**Since**: 12 765e41f4b71Sopenharmony_ci 766e41f4b71Sopenharmony_ci| Value| Description| 767e41f4b71Sopenharmony_ci| -------- | -------- | 768e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_BUFFERTYPE_VIDEO | Video data. | 769e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_INNER | Internal audio capture data. | 770e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_BUFFERTYPE_AUDIO_MIC | Microphone audio data. | 771e41f4b71Sopenharmony_ci 772e41f4b71Sopenharmony_ci 773e41f4b71Sopenharmony_ci### OH_AVScreenCaptureFilterableAudioContent 774e41f4b71Sopenharmony_ci 775e41f4b71Sopenharmony_ci``` 776e41f4b71Sopenharmony_cienum OH_AVScreenCaptureFilterableAudioContent 777e41f4b71Sopenharmony_ci``` 778e41f4b71Sopenharmony_ci 779e41f4b71Sopenharmony_ci**Description** 780e41f4b71Sopenharmony_ci 781e41f4b71Sopenharmony_ciEnumerates the types of audio that can be added to a content filter. 782e41f4b71Sopenharmony_ci 783e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 784e41f4b71Sopenharmony_ci 785e41f4b71Sopenharmony_ci**Since**: 12 786e41f4b71Sopenharmony_ci 787e41f4b71Sopenharmony_ci| Value| Description| 788e41f4b71Sopenharmony_ci| -------- | -------- | 789e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_NOTIFICATION_AUDIO | Notification tone. | 790e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO | Sound of the application itself. | 791e41f4b71Sopenharmony_ci 792e41f4b71Sopenharmony_ci 793e41f4b71Sopenharmony_ci### OH_AVScreenCaptureStateCode 794e41f4b71Sopenharmony_ci 795e41f4b71Sopenharmony_ci``` 796e41f4b71Sopenharmony_cienum OH_AVScreenCaptureStateCode 797e41f4b71Sopenharmony_ci``` 798e41f4b71Sopenharmony_ci 799e41f4b71Sopenharmony_ci**Description** 800e41f4b71Sopenharmony_ci 801e41f4b71Sopenharmony_ciEnumerates the screen capture states. 802e41f4b71Sopenharmony_ci 803e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 804e41f4b71Sopenharmony_ci 805e41f4b71Sopenharmony_ci**Since**: 12 806e41f4b71Sopenharmony_ci 807e41f4b71Sopenharmony_ci| Value| Description| 808e41f4b71Sopenharmony_ci| -------- | -------- | 809e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_STARTED | Screen capture is started. | 810e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_CANCELED | Screen capture is canceled. | 811e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER | Screen capture is stopped. | 812e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_INTERRUPTED_BY_OTHER | Screen capture is interrupted by another screen capture. | 813e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_STOPPED_BY_CALL | Screen capture is interrupted by a call. | 814e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE | The microphone is unavailable. | 815e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_MIC_MUTED_BY_USER | The microphone is muted. | 816e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_MIC_UNMUTED_BY_USER | The microphone is unmuted. | 817e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_ENTER_PRIVATE_SCENE | The system enters a privacy dialog box. | 818e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_EXIT_PRIVATE_SCENE | The system exits a privacy dialog box. | 819e41f4b71Sopenharmony_ci| OH_SCREEN_CAPTURE_STATE_STOPPED_BY_USER_SWITCHES | Screen capture is interrupted by system user switching.| 820e41f4b71Sopenharmony_ci 821e41f4b71Sopenharmony_ci 822e41f4b71Sopenharmony_ci### OH_CaptureMode 823e41f4b71Sopenharmony_ci 824e41f4b71Sopenharmony_ci``` 825e41f4b71Sopenharmony_cienum OH_CaptureMode 826e41f4b71Sopenharmony_ci``` 827e41f4b71Sopenharmony_ci 828e41f4b71Sopenharmony_ci**Description** 829e41f4b71Sopenharmony_ci 830e41f4b71Sopenharmony_ciEnumerates the screen capture modes. 831e41f4b71Sopenharmony_ci 832e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 833e41f4b71Sopenharmony_ci 834e41f4b71Sopenharmony_ci**Since**: 10 835e41f4b71Sopenharmony_ci 836e41f4b71Sopenharmony_ci| Value| Description| 837e41f4b71Sopenharmony_ci| -------- | -------- | 838e41f4b71Sopenharmony_ci| OH_CAPTURE_HOME_SCREEN | Captures the home screen. | 839e41f4b71Sopenharmony_ci| OH_CAPTURE_SPECIFIED_SCREEN | Captures a specified screen. | 840e41f4b71Sopenharmony_ci| OH_CAPTURE_SPECIFIED_WINDOW | Captures a specified window. | 841e41f4b71Sopenharmony_ci| OH_CAPTURE_INVAILD | Invalid mode. | 842e41f4b71Sopenharmony_ci 843e41f4b71Sopenharmony_ci 844e41f4b71Sopenharmony_ci### OH_ContainerFormatType 845e41f4b71Sopenharmony_ci 846e41f4b71Sopenharmony_ci``` 847e41f4b71Sopenharmony_cienum OH_ContainerFormatType 848e41f4b71Sopenharmony_ci``` 849e41f4b71Sopenharmony_ci 850e41f4b71Sopenharmony_ci**Description** 851e41f4b71Sopenharmony_ci 852e41f4b71Sopenharmony_ciEnumerates the types of files generated during screen capture. 853e41f4b71Sopenharmony_ci 854e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 855e41f4b71Sopenharmony_ci 856e41f4b71Sopenharmony_ci**Since**: 10 857e41f4b71Sopenharmony_ci 858e41f4b71Sopenharmony_ci| Value| Description| 859e41f4b71Sopenharmony_ci| -------- | -------- | 860e41f4b71Sopenharmony_ci| CFT_MPEG_4A | Audio format M4A. | 861e41f4b71Sopenharmony_ci| CFT_MPEG_4 | Video format MP4. | 862e41f4b71Sopenharmony_ci 863e41f4b71Sopenharmony_ci 864e41f4b71Sopenharmony_ci### OH_DataType 865e41f4b71Sopenharmony_ci 866e41f4b71Sopenharmony_ci``` 867e41f4b71Sopenharmony_cienum OH_DataType 868e41f4b71Sopenharmony_ci``` 869e41f4b71Sopenharmony_ci 870e41f4b71Sopenharmony_ci**Description** 871e41f4b71Sopenharmony_ci 872e41f4b71Sopenharmony_ciEnumerates the data types of screen capture streams. 873e41f4b71Sopenharmony_ci 874e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 875e41f4b71Sopenharmony_ci 876e41f4b71Sopenharmony_ci**Since**: 10 877e41f4b71Sopenharmony_ci 878e41f4b71Sopenharmony_ci| Value| Description| 879e41f4b71Sopenharmony_ci| -------- | -------- | 880e41f4b71Sopenharmony_ci| OH_ORIGINAL_STREAM | Original stream format, such as YUV, RGBA, and PCM. | 881e41f4b71Sopenharmony_ci| OH_ENCODED_STREAM | Encoded stream format, such as H.264 and AAC. This value is not supported yet. | 882e41f4b71Sopenharmony_ci| OH_CAPTURE_FILE | Format of the recording file. The value can be **mp4**. | 883e41f4b71Sopenharmony_ci| OH_INVAILD | Invalid format. | 884e41f4b71Sopenharmony_ci 885e41f4b71Sopenharmony_ci 886e41f4b71Sopenharmony_ci### OH_VideoCodecFormat 887e41f4b71Sopenharmony_ci 888e41f4b71Sopenharmony_ci``` 889e41f4b71Sopenharmony_cienum OH_VideoCodecFormat 890e41f4b71Sopenharmony_ci``` 891e41f4b71Sopenharmony_ci 892e41f4b71Sopenharmony_ci**Description** 893e41f4b71Sopenharmony_ci 894e41f4b71Sopenharmony_ciEnumerates the video encoding formats. 895e41f4b71Sopenharmony_ci 896e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 897e41f4b71Sopenharmony_ci 898e41f4b71Sopenharmony_ci**Since**: 10 899e41f4b71Sopenharmony_ci 900e41f4b71Sopenharmony_ci| Value| Description| 901e41f4b71Sopenharmony_ci| -------- | -------- | 902e41f4b71Sopenharmony_ci| OH_VIDEO_DEFAULT | Default video encoding format. The default value is **H.264**.| 903e41f4b71Sopenharmony_ci| OH_H264 | H.264.| 904e41f4b71Sopenharmony_ci| OH_H265 | H.265/HEVC.| 905e41f4b71Sopenharmony_ci| OH_MPEG4 | MPEG4.| 906e41f4b71Sopenharmony_ci| OH_VP8 | VP8.| 907e41f4b71Sopenharmony_ci| OH_VP9 | VP9.| 908e41f4b71Sopenharmony_ci| OH_VIDEO_CODEC_FORMAT_BUTT | Invalid format.| 909e41f4b71Sopenharmony_ci 910e41f4b71Sopenharmony_ci 911e41f4b71Sopenharmony_ci### OH_VideoSourceType 912e41f4b71Sopenharmony_ci 913e41f4b71Sopenharmony_ci``` 914e41f4b71Sopenharmony_cienum OH_VideoSourceType 915e41f4b71Sopenharmony_ci``` 916e41f4b71Sopenharmony_ci 917e41f4b71Sopenharmony_ci**Description** 918e41f4b71Sopenharmony_ci 919e41f4b71Sopenharmony_ciEnumerates the video source formats. 920e41f4b71Sopenharmony_ci 921e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 922e41f4b71Sopenharmony_ci 923e41f4b71Sopenharmony_ci**Since**: 10 924e41f4b71Sopenharmony_ci 925e41f4b71Sopenharmony_ci| Value| Description| 926e41f4b71Sopenharmony_ci| -------- | -------- | 927e41f4b71Sopenharmony_ci| OH_VIDEO_SOURCE_SURFACE_YUV | YUV format. | 928e41f4b71Sopenharmony_ci| OH_VIDEO_SOURCE_SURFACE_ES | Raw format. | 929e41f4b71Sopenharmony_ci| OH_VIDEO_SOURCE_SURFACE_RGBA | RGBA format. | 930e41f4b71Sopenharmony_ci| OH_VIDEO_SOURCE_BUTT | Invalid format. | 931e41f4b71Sopenharmony_ci 932e41f4b71Sopenharmony_ci 933e41f4b71Sopenharmony_ci## Function Description 934e41f4b71Sopenharmony_ci 935e41f4b71Sopenharmony_ci 936e41f4b71Sopenharmony_ci### OH_AVScreenCapture_AcquireAudioBuffer() 937e41f4b71Sopenharmony_ci 938e41f4b71Sopenharmony_ci``` 939e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_AcquireAudioBuffer (struct OH_AVScreenCapture * capture, OH_AudioBuffer ** audiobuffer, OH_AudioCaptureSourceType type ) 940e41f4b71Sopenharmony_ci``` 941e41f4b71Sopenharmony_ci 942e41f4b71Sopenharmony_ci**Description** 943e41f4b71Sopenharmony_ci 944e41f4b71Sopenharmony_ciObtains an audio buffer. When calling this function, the application must allocate the memory of the corresponding struct size to the audio buffer. 945e41f4b71Sopenharmony_ci 946e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 947e41f4b71Sopenharmony_ci 948e41f4b71Sopenharmony_ci**Since**: 10 949e41f4b71Sopenharmony_ci 950e41f4b71Sopenharmony_ci**Deprecated from**: 12 951e41f4b71Sopenharmony_ci 952e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 953e41f4b71Sopenharmony_ci 954e41f4b71Sopenharmony_ci**Parameters** 955e41f4b71Sopenharmony_ci 956e41f4b71Sopenharmony_ci| Name| Description| 957e41f4b71Sopenharmony_ci| -------- | -------- | 958e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 959e41f4b71Sopenharmony_ci| audiobuffer | Pointer to the struct for storing the audio buffer. This struct is used to obtain the information about the audio buffer and the timestamp of the buffer.| 960e41f4b71Sopenharmony_ci| type | Type of the audio buffer, which is used to distinguish external streams recorded by the microphone from internal streams played by the system. For details, see [OH_AudioCaptureSourceType](#oh_audiocapturesourcetype).| 961e41f4b71Sopenharmony_ci 962e41f4b71Sopenharmony_ci**Returns** 963e41f4b71Sopenharmony_ci 964e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 965e41f4b71Sopenharmony_ci 966e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 967e41f4b71Sopenharmony_ci 968e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **audiobuffer** is a null pointer. 969e41f4b71Sopenharmony_ci 970e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The audio buffer fails to be allocated due to insufficient memory. 971e41f4b71Sopenharmony_ci 972e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or the audio buffer fails to be obtained. 973e41f4b71Sopenharmony_ci 974e41f4b71Sopenharmony_ci 975e41f4b71Sopenharmony_ci 976e41f4b71Sopenharmony_ci### OH_AVScreenCapture_AcquireVideoBuffer() 977e41f4b71Sopenharmony_ci 978e41f4b71Sopenharmony_ci``` 979e41f4b71Sopenharmony_ciOH_NativeBuffer* OH_AVScreenCapture_AcquireVideoBuffer (struct OH_AVScreenCapture * capture, int32_t * fence, int64_t * timestamp, struct OH_Rect * region ) 980e41f4b71Sopenharmony_ci``` 981e41f4b71Sopenharmony_ci 982e41f4b71Sopenharmony_ci**Description** 983e41f4b71Sopenharmony_ci 984e41f4b71Sopenharmony_ciObtains a video buffer. An application can call this function to obtain information such as the video buffer and timestamp. After the buffer is no longer needed, call [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer) to release it. 985e41f4b71Sopenharmony_ci 986e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 987e41f4b71Sopenharmony_ci 988e41f4b71Sopenharmony_ci**Since**: 10 989e41f4b71Sopenharmony_ci 990e41f4b71Sopenharmony_ci**Deprecated from**: 12 991e41f4b71Sopenharmony_ci 992e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 993e41f4b71Sopenharmony_ci 994e41f4b71Sopenharmony_ci**Parameters** 995e41f4b71Sopenharmony_ci 996e41f4b71Sopenharmony_ci| Name| Description| 997e41f4b71Sopenharmony_ci| -------- | -------- | 998e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance. | 999e41f4b71Sopenharmony_ci| fence | Pointer to parameters for synchronization display. | 1000e41f4b71Sopenharmony_ci| timestamp | Pointer to the timestamp of the video frame. | 1001e41f4b71Sopenharmony_ci| region | Pointer to the coordinates related to video display. | 1002e41f4b71Sopenharmony_ci 1003e41f4b71Sopenharmony_ci**Returns** 1004e41f4b71Sopenharmony_ci 1005e41f4b71Sopenharmony_ciReturns an **OH_NativeBuffer** object if the operation is successful. The application can call the APIs provided by the **OH_NativeBuffer** object to obtain information such as the video buffer and resolution. 1006e41f4b71Sopenharmony_ci 1007e41f4b71Sopenharmony_ci 1008e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ContentFilter_AddAudioContent() 1009e41f4b71Sopenharmony_ci 1010e41f4b71Sopenharmony_ci``` 1011e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddAudioContent (struct OH_AVScreenCapture_ContentFilter * filter, OH_AVScreenCaptureFilterableAudioContent content ) 1012e41f4b71Sopenharmony_ci``` 1013e41f4b71Sopenharmony_ci 1014e41f4b71Sopenharmony_ci**Description** 1015e41f4b71Sopenharmony_ci 1016e41f4b71Sopenharmony_ciAdds audio content to a content filter. 1017e41f4b71Sopenharmony_ci 1018e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1019e41f4b71Sopenharmony_ci 1020e41f4b71Sopenharmony_ci**Since**: 12 1021e41f4b71Sopenharmony_ci 1022e41f4b71Sopenharmony_ci**Parameters** 1023e41f4b71Sopenharmony_ci 1024e41f4b71Sopenharmony_ci| Name| Description| 1025e41f4b71Sopenharmony_ci| -------- | -------- | 1026e41f4b71Sopenharmony_ci| filter | Pointer to an [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) instance.| 1027e41f4b71Sopenharmony_ci| content | [OH_AVScreenCaptureFilterableAudioContent](#oh_avscreencapturefilterableaudiocontent) instance.| 1028e41f4b71Sopenharmony_ci 1029e41f4b71Sopenharmony_ci**Returns** 1030e41f4b71Sopenharmony_ci 1031e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1032e41f4b71Sopenharmony_ci 1033e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1034e41f4b71Sopenharmony_ci 1035e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **filter** is a null pointer or the input parameter **content** is invalid. 1036e41f4b71Sopenharmony_ci 1037e41f4b71Sopenharmony_ci 1038e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ContentFilter_AddWindowContent() 1039e41f4b71Sopenharmony_ci 1040e41f4b71Sopenharmony_ci``` 1041e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ContentFilter_AddWindowContent (struct OH_AVScreenCapture_ContentFilter *filter, int32_t *windowIDs, int32_t windowCount) 1042e41f4b71Sopenharmony_ci``` 1043e41f4b71Sopenharmony_ci 1044e41f4b71Sopenharmony_ci**Description** 1045e41f4b71Sopenharmony_ci 1046e41f4b71Sopenharmony_ciAdds a list of window IDs to a **ContentFilter** instance. 1047e41f4b71Sopenharmony_ci 1048e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1049e41f4b71Sopenharmony_ci 1050e41f4b71Sopenharmony_ci**Since**: 12 1051e41f4b71Sopenharmony_ci 1052e41f4b71Sopenharmony_ci**Parameters** 1053e41f4b71Sopenharmony_ci 1054e41f4b71Sopenharmony_ci| Name| Description| 1055e41f4b71Sopenharmony_ci| -------- | -------- | 1056e41f4b71Sopenharmony_ci| filter | Pointer to an **OH_AVScreenCapture_ContentFilter** instance. | 1057e41f4b71Sopenharmony_ci| windowIDs | Pointer to the window IDs. | 1058e41f4b71Sopenharmony_ci| windowCount | Length of the window ID list. | 1059e41f4b71Sopenharmony_ci 1060e41f4b71Sopenharmony_ci**Returns** 1061e41f4b71Sopenharmony_ci 1062e41f4b71Sopenharmony_ciReturns **AV_SCREEN_CAPTURE_ERR_OK** if the operation is successful; returns an error code defined in [OH_AVSCREEN_CAPTURE_ErrCode](#oh_avscreen_capture_errcode-1) otherwise. 1063e41f4b71Sopenharmony_ci 1064e41f4b71Sopenharmony_ci 1065e41f4b71Sopenharmony_ci### OH_AVScreenCapture_Create() 1066e41f4b71Sopenharmony_ci 1067e41f4b71Sopenharmony_ci``` 1068e41f4b71Sopenharmony_cistruct OH_AVScreenCapture* OH_AVScreenCapture_Create (void ) 1069e41f4b71Sopenharmony_ci``` 1070e41f4b71Sopenharmony_ci 1071e41f4b71Sopenharmony_ci**Description** 1072e41f4b71Sopenharmony_ci 1073e41f4b71Sopenharmony_ciCreates an **OH_AVScreenCapture** instance. You can release the instance by calling [OH_AVScreenCapture_Release](#oh_avscreencapture_release). 1074e41f4b71Sopenharmony_ci 1075e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1076e41f4b71Sopenharmony_ci 1077e41f4b71Sopenharmony_ci**Since**: 10 1078e41f4b71Sopenharmony_ci 1079e41f4b71Sopenharmony_ci**Returns** 1080e41f4b71Sopenharmony_ci 1081e41f4b71Sopenharmony_ciReturns the pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance. 1082e41f4b71Sopenharmony_ci 1083e41f4b71Sopenharmony_ci 1084e41f4b71Sopenharmony_ci### OH_AVScreenCapture_CreateContentFilter() 1085e41f4b71Sopenharmony_ci 1086e41f4b71Sopenharmony_ci``` 1087e41f4b71Sopenharmony_cistruct OH_AVScreenCapture_ContentFilter* OH_AVScreenCapture_CreateContentFilter (void ) 1088e41f4b71Sopenharmony_ci``` 1089e41f4b71Sopenharmony_ci 1090e41f4b71Sopenharmony_ci**Description** 1091e41f4b71Sopenharmony_ci 1092e41f4b71Sopenharmony_ciCreates a content filter. 1093e41f4b71Sopenharmony_ci 1094e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1095e41f4b71Sopenharmony_ci 1096e41f4b71Sopenharmony_ci**Since**: 12 1097e41f4b71Sopenharmony_ci 1098e41f4b71Sopenharmony_ci**Returns** 1099e41f4b71Sopenharmony_ci 1100e41f4b71Sopenharmony_ciReturns [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) if the operation is successful; returns a null pointer otherwise. 1101e41f4b71Sopenharmony_ci 1102e41f4b71Sopenharmony_ci 1103e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ExcludeContent() 1104e41f4b71Sopenharmony_ci 1105e41f4b71Sopenharmony_ci``` 1106e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ExcludeContent (struct OH_AVScreenCapture * capture, struct OH_AVScreenCapture_ContentFilter * filter ) 1107e41f4b71Sopenharmony_ci``` 1108e41f4b71Sopenharmony_ci 1109e41f4b71Sopenharmony_ci**Description** 1110e41f4b71Sopenharmony_ci 1111e41f4b71Sopenharmony_ciSets a content filter for an **OH_AVScreenCapture** instance. 1112e41f4b71Sopenharmony_ci 1113e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1114e41f4b71Sopenharmony_ci 1115e41f4b71Sopenharmony_ci**Since**: 12 1116e41f4b71Sopenharmony_ci 1117e41f4b71Sopenharmony_ci**Parameters** 1118e41f4b71Sopenharmony_ci 1119e41f4b71Sopenharmony_ci| Name| Description| 1120e41f4b71Sopenharmony_ci| -------- | -------- | 1121e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1122e41f4b71Sopenharmony_ci| filter | Pointer to an [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) instance.| 1123e41f4b71Sopenharmony_ci 1124e41f4b71Sopenharmony_ci**Returns** 1125e41f4b71Sopenharmony_ci 1126e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1127e41f4b71Sopenharmony_ci 1128e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1129e41f4b71Sopenharmony_ci 1130e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **filter** is a null pointer. 1131e41f4b71Sopenharmony_ci 1132e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_UNSUPPORT**: The operation is not supported. For streams, the **AudioCapturer** API must be called for the operation to take effect during the start. For captured files, the **AudioRecorder** API must be called for the operation to take effect during the start. 1133e41f4b71Sopenharmony_ci 1134e41f4b71Sopenharmony_ci 1135e41f4b71Sopenharmony_ci### OH_AVScreenCapture_Init() 1136e41f4b71Sopenharmony_ci 1137e41f4b71Sopenharmony_ci``` 1138e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Init (struct OH_AVScreenCapture * capture, OH_AVScreenCaptureConfig config ) 1139e41f4b71Sopenharmony_ci``` 1140e41f4b71Sopenharmony_ci 1141e41f4b71Sopenharmony_ci**Description** 1142e41f4b71Sopenharmony_ci 1143e41f4b71Sopenharmony_ciInitializes parameters related to an [OH_AVScreenCapture](#oh_avscreencapture) instance, including audio sampling parameters for external capture using microphones (optional), audio sampling parameters for internal capture, and video resolution parameters. 1144e41f4b71Sopenharmony_ci 1145e41f4b71Sopenharmony_ciIn the scenario where screen recording files are stored, the application must ensure that the video encoding parameters, video sampling parameters, audio encoding parameters, audio sampling parameters for internal capture, and audio sampling parameters for external capture using microphones (optional) are valid. 1146e41f4b71Sopenharmony_ci 1147e41f4b71Sopenharmony_ciIn the scenario where screen capture streams are generated, the application must ensure that either audio sampling parameters for internal capture or video sampling parameters are valid, or both are valid, and audio sampling parameters for external capture using microphones are valid (optional). 1148e41f4b71Sopenharmony_ci 1149e41f4b71Sopenharmony_ciThe members of the struct variables are not initialized during initialization. Therefore, the application must correctly set the parameters based on the use scenario. You are advised to 1150e41f4b71Sopenharmony_ciset all memory bytes of the OH_AVScreenCaptureConfig struct variables to **0**, and then set valid parameters based on the screen capture scenario. 1151e41f4b71Sopenharmony_ci 1152e41f4b71Sopenharmony_ciIf both **audioSampleRate** and **audioChannels** in the [OH_AudioCaptureInfo](#oh_audiocaptureinfo) struct are **0**, 1153e41f4b71Sopenharmony_cithe **OH_AVScreenCapture** instance ignores the audio parameters of this type and does not collect the audio data of this type. 1154e41f4b71Sopenharmony_ci 1155e41f4b71Sopenharmony_ciIf both **videoFrameWidth** and **videoFrameHeight** in the [OH_AudioCaptureInfo](#oh_audiocaptureinfo) struct are **0**, 1156e41f4b71Sopenharmony_cithe **OH_AVScreenCapture** instance ignores the corresponding video parameters and does not collect screen data. 1157e41f4b71Sopenharmony_ci 1158e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1159e41f4b71Sopenharmony_ci 1160e41f4b71Sopenharmony_ci**Since**: 10 1161e41f4b71Sopenharmony_ci 1162e41f4b71Sopenharmony_ci**Parameters** 1163e41f4b71Sopenharmony_ci 1164e41f4b71Sopenharmony_ci| Name| Description| 1165e41f4b71Sopenharmony_ci| -------- | -------- | 1166e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1167e41f4b71Sopenharmony_ci| config | Parameters related to screen capture initialization.| 1168e41f4b71Sopenharmony_ci 1169e41f4b71Sopenharmony_ci**Returns** 1170e41f4b71Sopenharmony_ci 1171e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1172e41f4b71Sopenharmony_ci 1173e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1174e41f4b71Sopenharmony_ci 1175e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1176e41f4b71Sopenharmony_ci 1177e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The configuration fails to be initialized. 1178e41f4b71Sopenharmony_ci 1179e41f4b71Sopenharmony_ci 1180e41f4b71Sopenharmony_ci### OH_AVScreenCapture_Release() 1181e41f4b71Sopenharmony_ci 1182e41f4b71Sopenharmony_ci``` 1183e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_Release (struct OH_AVScreenCapture * capture) 1184e41f4b71Sopenharmony_ci``` 1185e41f4b71Sopenharmony_ci 1186e41f4b71Sopenharmony_ci**Description** 1187e41f4b71Sopenharmony_ci 1188e41f4b71Sopenharmony_ciReleases an **OH_AVScreenCapture** instance. This function is used in pair with [OH_AVScreenCapture_Create](#oh_avscreencapture_create). 1189e41f4b71Sopenharmony_ci 1190e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1191e41f4b71Sopenharmony_ci 1192e41f4b71Sopenharmony_ci**Since**: 10 1193e41f4b71Sopenharmony_ci 1194e41f4b71Sopenharmony_ci**Parameters** 1195e41f4b71Sopenharmony_ci 1196e41f4b71Sopenharmony_ci| Name| Description| 1197e41f4b71Sopenharmony_ci| -------- | -------- | 1198e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1199e41f4b71Sopenharmony_ci 1200e41f4b71Sopenharmony_ci**Returns** 1201e41f4b71Sopenharmony_ci 1202e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1203e41f4b71Sopenharmony_ci 1204e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1205e41f4b71Sopenharmony_ci 1206e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1207e41f4b71Sopenharmony_ci 1208e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The **OH_AVScreenCapture** instance fails to be released. 1209e41f4b71Sopenharmony_ci 1210e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ReleaseAudioBuffer() 1211e41f4b71Sopenharmony_ci 1212e41f4b71Sopenharmony_ci``` 1213e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseAudioBuffer (struct OH_AVScreenCapture * capture, OH_AudioCaptureSourceType type ) 1214e41f4b71Sopenharmony_ci``` 1215e41f4b71Sopenharmony_ci 1216e41f4b71Sopenharmony_ci**Description** 1217e41f4b71Sopenharmony_ci 1218e41f4b71Sopenharmony_ciReleases an audio buffer. After the audio buffer is no longer needed, call this function to release it. 1219e41f4b71Sopenharmony_ci 1220e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1221e41f4b71Sopenharmony_ci 1222e41f4b71Sopenharmony_ci**Since**: 10 1223e41f4b71Sopenharmony_ci 1224e41f4b71Sopenharmony_ci**Deprecated from**: 12 1225e41f4b71Sopenharmony_ci 1226e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 1227e41f4b71Sopenharmony_ci 1228e41f4b71Sopenharmony_ci**Parameters** 1229e41f4b71Sopenharmony_ci 1230e41f4b71Sopenharmony_ci| Name| Description| 1231e41f4b71Sopenharmony_ci| -------- | -------- | 1232e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1233e41f4b71Sopenharmony_ci| type | Type of the audio buffer, which is used to distinguish external streams recorded by the microphone from internal streams played by the system.| 1234e41f4b71Sopenharmony_ci 1235e41f4b71Sopenharmony_ci**Returns** 1236e41f4b71Sopenharmony_ci 1237e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1238e41f4b71Sopenharmony_ci 1239e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1240e41f4b71Sopenharmony_ci 1241e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1242e41f4b71Sopenharmony_ci 1243e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The data callback has been set or the audio buffer fails to be released. 1244e41f4b71Sopenharmony_ci 1245e41f4b71Sopenharmony_ci 1246e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ReleaseContentFilter() 1247e41f4b71Sopenharmony_ci 1248e41f4b71Sopenharmony_ci``` 1249e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseContentFilter (struct OH_AVScreenCapture_ContentFilter * filter) 1250e41f4b71Sopenharmony_ci``` 1251e41f4b71Sopenharmony_ci 1252e41f4b71Sopenharmony_ci**Description** 1253e41f4b71Sopenharmony_ci 1254e41f4b71Sopenharmony_ciReleases a content filter. 1255e41f4b71Sopenharmony_ci 1256e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1257e41f4b71Sopenharmony_ci 1258e41f4b71Sopenharmony_ci**Since**: 12 1259e41f4b71Sopenharmony_ci 1260e41f4b71Sopenharmony_ci**Parameters** 1261e41f4b71Sopenharmony_ci 1262e41f4b71Sopenharmony_ci| Name| Description| 1263e41f4b71Sopenharmony_ci| -------- | -------- | 1264e41f4b71Sopenharmony_ci| filter | Pointer to an [OH_AVScreenCapture_ContentFilter](#oh_avscreencapture_contentfilter) instance.| 1265e41f4b71Sopenharmony_ci 1266e41f4b71Sopenharmony_ci**Returns** 1267e41f4b71Sopenharmony_ci 1268e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1269e41f4b71Sopenharmony_ci 1270e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1271e41f4b71Sopenharmony_ci 1272e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **filter** is a null pointer. 1273e41f4b71Sopenharmony_ci 1274e41f4b71Sopenharmony_ci 1275e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ReleaseVideoBuffer() 1276e41f4b71Sopenharmony_ci 1277e41f4b71Sopenharmony_ci``` 1278e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ReleaseVideoBuffer (struct OH_AVScreenCapture * capture) 1279e41f4b71Sopenharmony_ci``` 1280e41f4b71Sopenharmony_ci 1281e41f4b71Sopenharmony_ci**Description** 1282e41f4b71Sopenharmony_ci 1283e41f4b71Sopenharmony_ciReleases a video buffer. After the video buffer is no longer needed, call this function to release it. 1284e41f4b71Sopenharmony_ci 1285e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1286e41f4b71Sopenharmony_ci 1287e41f4b71Sopenharmony_ci**Since**: 10 1288e41f4b71Sopenharmony_ci 1289e41f4b71Sopenharmony_ci**Deprecated from**: 12 1290e41f4b71Sopenharmony_ci 1291e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable) 1292e41f4b71Sopenharmony_ci 1293e41f4b71Sopenharmony_ci**Parameters** 1294e41f4b71Sopenharmony_ci 1295e41f4b71Sopenharmony_ci| Name| Description| 1296e41f4b71Sopenharmony_ci| -------- | -------- | 1297e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1298e41f4b71Sopenharmony_ci 1299e41f4b71Sopenharmony_ci**Returns** 1300e41f4b71Sopenharmony_ci 1301e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1302e41f4b71Sopenharmony_ci 1303e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1304e41f4b71Sopenharmony_ci 1305e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1306e41f4b71Sopenharmony_ci 1307e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The data callback has been set or the video buffer fails to be released. 1308e41f4b71Sopenharmony_ci 1309e41f4b71Sopenharmony_ci 1310e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SetCallback() 1311e41f4b71Sopenharmony_ci 1312e41f4b71Sopenharmony_ci``` 1313e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCallback (struct OH_AVScreenCapture * capture, struct OH_AVScreenCaptureCallback callback ) 1314e41f4b71Sopenharmony_ci``` 1315e41f4b71Sopenharmony_ci 1316e41f4b71Sopenharmony_ci**Description** 1317e41f4b71Sopenharmony_ci 1318e41f4b71Sopenharmony_ciSets a callback to listen for available video buffers and audio buffers and errors that occur during the function calling. 1319e41f4b71Sopenharmony_ci 1320e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1321e41f4b71Sopenharmony_ci 1322e41f4b71Sopenharmony_ci**Since**: 10 1323e41f4b71Sopenharmony_ci 1324e41f4b71Sopenharmony_ci**Deprecated from**: 12 1325e41f4b71Sopenharmony_ci 1326e41f4b71Sopenharmony_ci**Substitute API**: [OH_AVScreenCapture_SetErrorCallback](#oh_avscreencapture_seterrorcallback) and [OH_AVScreenCapture_SetDataCallback](#oh_avscreencapture_setdatacallback) 1327e41f4b71Sopenharmony_ci 1328e41f4b71Sopenharmony_ci**Parameters** 1329e41f4b71Sopenharmony_ci 1330e41f4b71Sopenharmony_ci| Name| Description| 1331e41f4b71Sopenharmony_ci| -------- | -------- | 1332e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1333e41f4b71Sopenharmony_ci| callback | [OH_AVScreenCaptureCallback](_o_h___a_v_screen_capture_callback.md) struct, which stores related callback function pointers.| 1334e41f4b71Sopenharmony_ci 1335e41f4b71Sopenharmony_ci**Returns** 1336e41f4b71Sopenharmony_ci 1337e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1338e41f4b71Sopenharmony_ci 1339e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1340e41f4b71Sopenharmony_ci 1341e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. 1342e41f4b71Sopenharmony_ci 1343e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The callback fails to be set. 1344e41f4b71Sopenharmony_ci 1345e41f4b71Sopenharmony_ci 1346e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SetCanvasRotation() 1347e41f4b71Sopenharmony_ci 1348e41f4b71Sopenharmony_ci``` 1349e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCanvasRotation (struct OH_AVScreenCapture * capture, bool canvasRotation ) 1350e41f4b71Sopenharmony_ci``` 1351e41f4b71Sopenharmony_ci 1352e41f4b71Sopenharmony_ci**Description** 1353e41f4b71Sopenharmony_ci 1354e41f4b71Sopenharmony_ciSets canvas rotation for screen capture. 1355e41f4b71Sopenharmony_ci 1356e41f4b71Sopenharmony_ciYou can call this function to set whether to rotate the recorded screen data. When **canvasRotation** is set to **true**, screen capture rotation is enabled and the recorded screen data remains positive. 1357e41f4b71Sopenharmony_ci 1358e41f4b71Sopenharmony_ciThe default value is **false**. 1359e41f4b71Sopenharmony_ci 1360e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1361e41f4b71Sopenharmony_ci 1362e41f4b71Sopenharmony_ci**Since**: 12 1363e41f4b71Sopenharmony_ci 1364e41f4b71Sopenharmony_ci**Parameters** 1365e41f4b71Sopenharmony_ci 1366e41f4b71Sopenharmony_ci| Name| Description| 1367e41f4b71Sopenharmony_ci| -------- | -------- | 1368e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1369e41f4b71Sopenharmony_ci| canvasRotation | Whether to enable screen data rotation.| 1370e41f4b71Sopenharmony_ci 1371e41f4b71Sopenharmony_ci**Returns** 1372e41f4b71Sopenharmony_ci 1373e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1374e41f4b71Sopenharmony_ci 1375e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1376e41f4b71Sopenharmony_ci 1377e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1378e41f4b71Sopenharmony_ci 1379e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. Canvas rotation fails to be set for screen capture. 1380e41f4b71Sopenharmony_ci 1381e41f4b71Sopenharmony_ci 1382e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SetDataCallback() 1383e41f4b71Sopenharmony_ci 1384e41f4b71Sopenharmony_ci``` 1385e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDataCallback (struct OH_AVScreenCapture * capture, OH_AVScreenCapture_OnBufferAvailable callback, void * userData ) 1386e41f4b71Sopenharmony_ci``` 1387e41f4b71Sopenharmony_ci 1388e41f4b71Sopenharmony_ci**Description** 1389e41f4b71Sopenharmony_ci 1390e41f4b71Sopenharmony_ciSets a data processing callback. This function must be called before screen capture starts. 1391e41f4b71Sopenharmony_ci 1392e41f4b71Sopenharmony_ciThe callback is triggered when an audio buffer or a video buffer becomes available during the running of an **OH_AVScreenCapture** instance. 1393e41f4b71Sopenharmony_ci 1394e41f4b71Sopenharmony_ciThe application needs to process microphone audio, internal audio, and video data based on the data type in the callback. After the callback is triggered, the buffer is no longer valid. 1395e41f4b71Sopenharmony_ci 1396e41f4b71Sopenharmony_ciA successful call to this function leads to the following scenarios: 1397e41f4b71Sopenharmony_ci 1398e41f4b71Sopenharmony_ci- The callbacks [OH_AVScreenCaptureOnAudioBufferAvailable](#oh_avscreencaptureonaudiobufferavailable) and [OH_AVScreenCaptureOnVideoBufferAvailable](#oh_avscreencaptureonvideobufferavailable) set by calling [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) will no longer be triggered, even when an audio buffer or a video buffer becomes available. 1399e41f4b71Sopenharmony_ci- A failure message is returned for a call to any of the following functions: [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer), [OH_AVScreenCapture_ReleaseAudioBuffer](#oh_avscreencapture_releaseaudiobuffer), [OH_AVScreenCapture_AcquireVideoBuffer](#oh_avscreencapture_acquirevideobuffer), and [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer). 1400e41f4b71Sopenharmony_ci 1401e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1402e41f4b71Sopenharmony_ci 1403e41f4b71Sopenharmony_ci**Since**: 12 1404e41f4b71Sopenharmony_ci 1405e41f4b71Sopenharmony_ci**Parameters** 1406e41f4b71Sopenharmony_ci 1407e41f4b71Sopenharmony_ci| Name| Description| 1408e41f4b71Sopenharmony_ci| -------- | -------- | 1409e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1410e41f4b71Sopenharmony_ci| callback | Data processing callback, which is [OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable).| 1411e41f4b71Sopenharmony_ci| userData | Pointer to the user-defined data. The data is returned as an input parameter when the data processing callback is triggered.| 1412e41f4b71Sopenharmony_ci 1413e41f4b71Sopenharmony_ci**Returns** 1414e41f4b71Sopenharmony_ci 1415e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1416e41f4b71Sopenharmony_ci 1417e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1418e41f4b71Sopenharmony_ci 1419e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. 1420e41f4b71Sopenharmony_ci 1421e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1422e41f4b71Sopenharmony_ci 1423e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The data callback fails to be set. 1424e41f4b71Sopenharmony_ci 1425e41f4b71Sopenharmony_ci 1426e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SetErrorCallback() 1427e41f4b71Sopenharmony_ci 1428e41f4b71Sopenharmony_ci``` 1429e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetErrorCallback (struct OH_AVScreenCapture * capture, OH_AVScreenCapture_OnError callback, void * userData ) 1430e41f4b71Sopenharmony_ci``` 1431e41f4b71Sopenharmony_ci 1432e41f4b71Sopenharmony_ci**Description** 1433e41f4b71Sopenharmony_ci 1434e41f4b71Sopenharmony_ciSets an error processing callback. This function must be called before screen capture starts. 1435e41f4b71Sopenharmony_ci 1436e41f4b71Sopenharmony_ciThe callback is triggered when an error occurs during the running of an **OH_AVScreenCapture** instance. 1437e41f4b71Sopenharmony_ci 1438e41f4b71Sopenharmony_ciAfter a successful call to this function, the callback [OH_AVScreenCaptureOnError](#oh_avscreencaptureonerror) set by calling [OH_AVScreenCapture_SetCallback](#oh_avscreencapture_setcallback) will no longer be triggered, even when an error occurs in the **OH_AVScreenCapture** instance. 1439e41f4b71Sopenharmony_ci 1440e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1441e41f4b71Sopenharmony_ci 1442e41f4b71Sopenharmony_ci**Since**: 12 1443e41f4b71Sopenharmony_ci 1444e41f4b71Sopenharmony_ci**Parameters** 1445e41f4b71Sopenharmony_ci 1446e41f4b71Sopenharmony_ci| Name| Description| 1447e41f4b71Sopenharmony_ci| -------- | -------- | 1448e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1449e41f4b71Sopenharmony_ci| callback | Error processing callback, which is [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror).| 1450e41f4b71Sopenharmony_ci| userData | Pointer to the user-defined data. The data is returned as an input parameter when the error processing callback is triggered.| 1451e41f4b71Sopenharmony_ci 1452e41f4b71Sopenharmony_ci**Returns** 1453e41f4b71Sopenharmony_ci 1454e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1455e41f4b71Sopenharmony_ci 1456e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1457e41f4b71Sopenharmony_ci 1458e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. 1459e41f4b71Sopenharmony_ci 1460e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1461e41f4b71Sopenharmony_ci 1462e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The error callback fails to be set. 1463e41f4b71Sopenharmony_ci 1464e41f4b71Sopenharmony_ci 1465e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SetMicrophoneEnabled() 1466e41f4b71Sopenharmony_ci 1467e41f4b71Sopenharmony_ci``` 1468e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetMicrophoneEnabled (struct OH_AVScreenCapture * capture, bool isMicrophone ) 1469e41f4b71Sopenharmony_ci``` 1470e41f4b71Sopenharmony_ci 1471e41f4b71Sopenharmony_ci**Description** 1472e41f4b71Sopenharmony_ci 1473e41f4b71Sopenharmony_ciEnables or disables the microphone. When **isMicrophone** is set to **true**, the microphone is enabled, and the original PCM data of the microphone can be obtained by calling [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture) and [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer). When **isMicrophone** is set to **false**, the obtained audio data is silent data. 1474e41f4b71Sopenharmony_ci 1475e41f4b71Sopenharmony_ciBy default, the microphone is enabled. 1476e41f4b71Sopenharmony_ci 1477e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1478e41f4b71Sopenharmony_ci 1479e41f4b71Sopenharmony_ci**Since**: 10 1480e41f4b71Sopenharmony_ci 1481e41f4b71Sopenharmony_ci**Parameters** 1482e41f4b71Sopenharmony_ci 1483e41f4b71Sopenharmony_ci| Name| Description| 1484e41f4b71Sopenharmony_ci| -------- | -------- | 1485e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1486e41f4b71Sopenharmony_ci| isMicrophone | Whether to enable the microphone.| 1487e41f4b71Sopenharmony_ci 1488e41f4b71Sopenharmony_ci**Returns** 1489e41f4b71Sopenharmony_ci 1490e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1491e41f4b71Sopenharmony_ci 1492e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1493e41f4b71Sopenharmony_ci 1494e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1495e41f4b71Sopenharmony_ci 1496e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The microphone fails to be enabled or disabled. 1497e41f4b71Sopenharmony_ci 1498e41f4b71Sopenharmony_ci 1499e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SetStateCallback() 1500e41f4b71Sopenharmony_ci 1501e41f4b71Sopenharmony_ci``` 1502e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetStateCallback (struct OH_AVScreenCapture * capture, OH_AVScreenCapture_OnStateChange callback, void * userData ) 1503e41f4b71Sopenharmony_ci``` 1504e41f4b71Sopenharmony_ci 1505e41f4b71Sopenharmony_ci**Description** 1506e41f4b71Sopenharmony_ci 1507e41f4b71Sopenharmony_ciSets a state change callback. This function must be called before screen capture starts. 1508e41f4b71Sopenharmony_ci 1509e41f4b71Sopenharmony_ciThe callback is triggered when the state changes during the running of an **OH_AVScreenCapture** instance. 1510e41f4b71Sopenharmony_ci 1511e41f4b71Sopenharmony_ciA privacy dialog box is displayed to ask for user consent before screen capture starts. After a successful call to this function, the following scenarios are possible: 1512e41f4b71Sopenharmony_ci 1513e41f4b71Sopenharmony_ci- If the user agrees, the screen capture startup process starts. 1514e41f4b71Sopenharmony_ci 1515e41f4b71Sopenharmony_ci - If screen capture starts successfully, the state change callback is triggered to report the [OH_SCREEN_CAPTURE_STATE_STARTED](#oh_avscreencapturestatecode-1) status to notify the application of the startup success, with a screen capture notification displayed. 1516e41f4b71Sopenharmony_ci 1517e41f4b71Sopenharmony_ci - If screen capture fails to start, the state change callback is triggered to report the failure information (for example, [OH_SCREEN_CAPTURE_STATE_MIC_UNAVAILABLE](#oh_avscreencapturestatecode-1) if the microphone is unavailable), or the error processing callback [OH_AVScreenCapture_OnError](#oh_avscreencapture_onerror) is triggered to report the error information. 1518e41f4b71Sopenharmony_ci 1519e41f4b71Sopenharmony_ci- If the user disagrees, the screen capture startup process stops. The state change callback is triggered to report the [OH_SCREEN_CAPTURE_STATE_CANCELED](#oh_avscreencapturestatecode-1) status to notify the application of the startup failure due to user rejection. 1520e41f4b71Sopenharmony_ci 1521e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1522e41f4b71Sopenharmony_ci 1523e41f4b71Sopenharmony_ci**Since**: 12 1524e41f4b71Sopenharmony_ci 1525e41f4b71Sopenharmony_ci**Parameters** 1526e41f4b71Sopenharmony_ci 1527e41f4b71Sopenharmony_ci| Name| Description| 1528e41f4b71Sopenharmony_ci| -------- | -------- | 1529e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1530e41f4b71Sopenharmony_ci| callback | State change callback, which is [OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange).| 1531e41f4b71Sopenharmony_ci| userData | Pointer to the user-defined data. The data is returned as an input parameter when the state change callback is triggered.| 1532e41f4b71Sopenharmony_ci 1533e41f4b71Sopenharmony_ci**Returns** 1534e41f4b71Sopenharmony_ci 1535e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1536e41f4b71Sopenharmony_ci 1537e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1538e41f4b71Sopenharmony_ci 1539e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** or **callback** is a null pointer. 1540e41f4b71Sopenharmony_ci 1541e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_NO_MEMORY**: The memory fails to be allocated due to insufficient memory. 1542e41f4b71Sopenharmony_ci 1543e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The state callback fails to be set. 1544e41f4b71Sopenharmony_ci 1545e41f4b71Sopenharmony_ci 1546e41f4b71Sopenharmony_ci### OH_AVScreenCapture_StartScreenCapture() 1547e41f4b71Sopenharmony_ci 1548e41f4b71Sopenharmony_ci``` 1549e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCapture (struct OH_AVScreenCapture * capture) 1550e41f4b71Sopenharmony_ci``` 1551e41f4b71Sopenharmony_ci 1552e41f4b71Sopenharmony_ci**Description** 1553e41f4b71Sopenharmony_ci 1554e41f4b71Sopenharmony_ciStarts screen capture and collects original streams. After this function is called, the callback ([OH_AVScreenCapture_OnBufferAvailable](#oh_avscreencapture_onbufferavailable)) can be used to check whether streams are generated, and the callback ([OH_AVScreenCapture_OnStateChange](#oh_avscreencapture_onstatechange)) can be used to check the startup status. 1555e41f4b71Sopenharmony_ci 1556e41f4b71Sopenharmony_ciThe application can obtain the original streams of screen capture by calling [OH_AVScreenCapture_AcquireAudioBuffer](#oh_avscreencapture_acquireaudiobuffer) and [OH_AVScreenCapture_ReleaseVideoBuffer](#oh_avscreencapture_releasevideobuffer). 1557e41f4b71Sopenharmony_ci 1558e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1559e41f4b71Sopenharmony_ci 1560e41f4b71Sopenharmony_ci**Since**: 10 1561e41f4b71Sopenharmony_ci 1562e41f4b71Sopenharmony_ci**Parameters** 1563e41f4b71Sopenharmony_ci 1564e41f4b71Sopenharmony_ci| Name| Description| 1565e41f4b71Sopenharmony_ci| -------- | -------- | 1566e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1567e41f4b71Sopenharmony_ci 1568e41f4b71Sopenharmony_ci**Returns** 1569e41f4b71Sopenharmony_ci 1570e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1571e41f4b71Sopenharmony_ci 1572e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1573e41f4b71Sopenharmony_ci 1574e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1575e41f4b71Sopenharmony_ci 1576e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or screen capture fails to start. 1577e41f4b71Sopenharmony_ci 1578e41f4b71Sopenharmony_ci 1579e41f4b71Sopenharmony_ci### OH_AVScreenCapture_StartScreenCaptureWithSurface() 1580e41f4b71Sopenharmony_ci 1581e41f4b71Sopenharmony_ci``` 1582e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenCaptureWithSurface (struct OH_AVScreenCapture * capture, OHNativeWindow * window ) 1583e41f4b71Sopenharmony_ci``` 1584e41f4b71Sopenharmony_ci 1585e41f4b71Sopenharmony_ci**Description** 1586e41f4b71Sopenharmony_ci 1587e41f4b71Sopenharmony_ciStarts screen capture in surface mode. 1588e41f4b71Sopenharmony_ci 1589e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1590e41f4b71Sopenharmony_ci 1591e41f4b71Sopenharmony_ci**Since**: 12 1592e41f4b71Sopenharmony_ci 1593e41f4b71Sopenharmony_ci**Parameters** 1594e41f4b71Sopenharmony_ci 1595e41f4b71Sopenharmony_ci| Name| Description| 1596e41f4b71Sopenharmony_ci| -------- | -------- | 1597e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1598e41f4b71Sopenharmony_ci| window | Pointer to an [OHNativeWindow](../apis-arkgraphics2d/_native_window.md#ohnativewindow) instance.| 1599e41f4b71Sopenharmony_ci 1600e41f4b71Sopenharmony_ci**Returns** 1601e41f4b71Sopenharmony_ci 1602e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1603e41f4b71Sopenharmony_ci 1604e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1605e41f4b71Sopenharmony_ci 1606e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture**, input parameter **window**, or **windowSurface** pointed to by **window** is a null pointer. 1607e41f4b71Sopenharmony_ci 1608e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or screen capture with a surface fails to start. 1609e41f4b71Sopenharmony_ci 1610e41f4b71Sopenharmony_ci 1611e41f4b71Sopenharmony_ci### OH_AVScreenCapture_StartScreenRecording() 1612e41f4b71Sopenharmony_ci 1613e41f4b71Sopenharmony_ci``` 1614e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StartScreenRecording (struct OH_AVScreenCapture * capture) 1615e41f4b71Sopenharmony_ci``` 1616e41f4b71Sopenharmony_ci 1617e41f4b71Sopenharmony_ci**Description** 1618e41f4b71Sopenharmony_ci 1619e41f4b71Sopenharmony_ciStarts screen recording, with recordings saved in files. 1620e41f4b71Sopenharmony_ci 1621e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1622e41f4b71Sopenharmony_ci 1623e41f4b71Sopenharmony_ci**Since**: 10 1624e41f4b71Sopenharmony_ci 1625e41f4b71Sopenharmony_ci**Parameters** 1626e41f4b71Sopenharmony_ci 1627e41f4b71Sopenharmony_ci| Name| Description| 1628e41f4b71Sopenharmony_ci| -------- | -------- | 1629e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1630e41f4b71Sopenharmony_ci 1631e41f4b71Sopenharmony_ci**Returns** 1632e41f4b71Sopenharmony_ci 1633e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1634e41f4b71Sopenharmony_ci 1635e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1636e41f4b71Sopenharmony_ci 1637e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1638e41f4b71Sopenharmony_ci 1639e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. The privacy permission fails to be enabled or screen recording fails to start. 1640e41f4b71Sopenharmony_ci 1641e41f4b71Sopenharmony_ci 1642e41f4b71Sopenharmony_ci### OH_AVScreenCapture_StopScreenCapture() 1643e41f4b71Sopenharmony_ci 1644e41f4b71Sopenharmony_ci``` 1645e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenCapture (struct OH_AVScreenCapture * capture) 1646e41f4b71Sopenharmony_ci``` 1647e41f4b71Sopenharmony_ci 1648e41f4b71Sopenharmony_ci**Description** 1649e41f4b71Sopenharmony_ci 1650e41f4b71Sopenharmony_ciStops screen capture. This function is used in pair with [OH_AVScreenCapture_StartScreenCapture](#oh_avscreencapture_startscreencapture). After calling this function, the application stops screen capture or screen share and releases the microphone. 1651e41f4b71Sopenharmony_ci 1652e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1653e41f4b71Sopenharmony_ci 1654e41f4b71Sopenharmony_ci**Since**: 10 1655e41f4b71Sopenharmony_ci 1656e41f4b71Sopenharmony_ci**Parameters** 1657e41f4b71Sopenharmony_ci 1658e41f4b71Sopenharmony_ci| Name| Description| 1659e41f4b71Sopenharmony_ci| -------- | -------- | 1660e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1661e41f4b71Sopenharmony_ci 1662e41f4b71Sopenharmony_ci**Returns** 1663e41f4b71Sopenharmony_ci 1664e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1665e41f4b71Sopenharmony_ci 1666e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1667e41f4b71Sopenharmony_ci 1668e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1669e41f4b71Sopenharmony_ci 1670e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. Screen capture fails to stop. 1671e41f4b71Sopenharmony_ci 1672e41f4b71Sopenharmony_ci 1673e41f4b71Sopenharmony_ci### OH_AVScreenCapture_StopScreenRecording() 1674e41f4b71Sopenharmony_ci 1675e41f4b71Sopenharmony_ci``` 1676e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_StopScreenRecording (struct OH_AVScreenCapture * capture) 1677e41f4b71Sopenharmony_ci``` 1678e41f4b71Sopenharmony_ci 1679e41f4b71Sopenharmony_ci**Description** 1680e41f4b71Sopenharmony_ci 1681e41f4b71Sopenharmony_ciStops screen recording. This function is used in pair with [OH_AVScreenCapture_StartScreenRecording](#oh_avscreencapture_startscreenrecording). 1682e41f4b71Sopenharmony_ci 1683e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1684e41f4b71Sopenharmony_ci 1685e41f4b71Sopenharmony_ci**Since**: 10 1686e41f4b71Sopenharmony_ci 1687e41f4b71Sopenharmony_ci**Parameters** 1688e41f4b71Sopenharmony_ci 1689e41f4b71Sopenharmony_ci| Name| Description| 1690e41f4b71Sopenharmony_ci| -------- | -------- | 1691e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1692e41f4b71Sopenharmony_ci 1693e41f4b71Sopenharmony_ci**Returns** 1694e41f4b71Sopenharmony_ci 1695e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1696e41f4b71Sopenharmony_ci 1697e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1698e41f4b71Sopenharmony_ci 1699e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1700e41f4b71Sopenharmony_ci 1701e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. Screen recording fails to stop. 1702e41f4b71Sopenharmony_ci 1703e41f4b71Sopenharmony_ci### OH_AVScreenCapture_ResizeCanvas() 1704e41f4b71Sopenharmony_ci 1705e41f4b71Sopenharmony_ci``` 1706e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ResizeCanvas (struct OH_AVScreenCapture * capture, int32_t width, int32_t height) 1707e41f4b71Sopenharmony_ci``` 1708e41f4b71Sopenharmony_ci 1709e41f4b71Sopenharmony_ci**Description** 1710e41f4b71Sopenharmony_ci 1711e41f4b71Sopenharmony_ciAdjusts the screen resolution. 1712e41f4b71Sopenharmony_ci 1713e41f4b71Sopenharmony_ciThis function is used to set the resolution of screen capture data. **width** indicates the screen width and **height** indicates the screen height. 1714e41f4b71Sopenharmony_ci 1715e41f4b71Sopenharmony_ciCurrently, this function supports only the scenario of capturing streams, but not the scenario of storing captured files. In addition, the caller of this function and the video data consumer must ensure that they support resolution changes of the received video data. 1716e41f4b71Sopenharmony_ci 1717e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1718e41f4b71Sopenharmony_ci 1719e41f4b71Sopenharmony_ci**Since**: 12 1720e41f4b71Sopenharmony_ci 1721e41f4b71Sopenharmony_ci**Parameters** 1722e41f4b71Sopenharmony_ci 1723e41f4b71Sopenharmony_ci| Name| Description| 1724e41f4b71Sopenharmony_ci| -------- | -------- | 1725e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1726e41f4b71Sopenharmony_ci| width | Width of the screen to capture.| 1727e41f4b71Sopenharmony_ci| height | Height of the screen to capture.| 1728e41f4b71Sopenharmony_ci 1729e41f4b71Sopenharmony_ci**Returns** 1730e41f4b71Sopenharmony_ci 1731e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1732e41f4b71Sopenharmony_ci 1733e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1734e41f4b71Sopenharmony_ci 1735e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1736e41f4b71Sopenharmony_ci 1737e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. 1738e41f4b71Sopenharmony_ci 1739e41f4b71Sopenharmony_ci### OH_AVScreenCapture_SkipPrivacyMode() 1740e41f4b71Sopenharmony_ci 1741e41f4b71Sopenharmony_ci``` 1742e41f4b71Sopenharmony_ciOH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SkipPrivacyMode (struct OH_AVScreenCapture * capture, int32_t *windowIDs, int32_t windowCount) 1743e41f4b71Sopenharmony_ci``` 1744e41f4b71Sopenharmony_ci 1745e41f4b71Sopenharmony_ci**Description** 1746e41f4b71Sopenharmony_ci 1747e41f4b71Sopenharmony_ciExempts privacy windows during screen capture. 1748e41f4b71Sopenharmony_ci 1749e41f4b71Sopenharmony_ciCurrently, all the IDs of the subwindows and main windows to skip must be passed in. 1750e41f4b71Sopenharmony_ci 1751e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Multimedia.Media.AVScreenCapture 1752e41f4b71Sopenharmony_ci 1753e41f4b71Sopenharmony_ci**Since**: 12 1754e41f4b71Sopenharmony_ci 1755e41f4b71Sopenharmony_ci**Parameters** 1756e41f4b71Sopenharmony_ci 1757e41f4b71Sopenharmony_ci| Name| Description| 1758e41f4b71Sopenharmony_ci| -------- | -------- | 1759e41f4b71Sopenharmony_ci| capture | Pointer to an [OH_AVScreenCapture](#oh_avscreencapture) instance.| 1760e41f4b71Sopenharmony_ci| windowIDs | Pointer to the IDs of the privacy windows to skip.| 1761e41f4b71Sopenharmony_ci| windowCount | Length of the privacy window ID list.| 1762e41f4b71Sopenharmony_ci 1763e41f4b71Sopenharmony_ci**Returns** 1764e41f4b71Sopenharmony_ci 1765e41f4b71Sopenharmony_ciReturns a result code defined in [OH_AVErrCode](../apis-avcodec-kit/_core.md#oh_averrcode-1). The following result codes are possible: 1766e41f4b71Sopenharmony_ci 1767e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OK**: The operation is successful. 1768e41f4b71Sopenharmony_ci 1769e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_INVALID_VAL**: The input parameter **capture** is a null pointer. 1770e41f4b71Sopenharmony_ci 1771e41f4b71Sopenharmony_ci**AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT**: The operation is not allowed. 1772