diff --git a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json index d175c78a730a8663fa828c1bc08125b1291ba346..fd456c8df2a1a530a11b9dccb5543e2c6eef5091 100644 --- a/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json +++ b/multimedia/player_framework/avscreen_capture/libnative_avscreen_capture.ndk.json @@ -110,5 +110,9 @@ { "first_introduced": "18", "name": "OH_AVScreenCapture_SetDisplayCallback" + }, + { + "first_introduced": "20", + "name": "OH_AVScreenCapture_SetCaptureContentChangedCallback" } ] \ No newline at end of file diff --git a/multimedia/player_framework/native_avscreen_capture.h b/multimedia/player_framework/native_avscreen_capture.h index 150ebef4f1755430aca165442f0d158ecef65138..dd3f94ad427cd0bbe2d73dcc9031420df8e0b9ba 100644 --- a/multimedia/player_framework/native_avscreen_capture.h +++ b/multimedia/player_framework/native_avscreen_capture.h @@ -463,6 +463,22 @@ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_ShowCursor(struct OH_AVScreenCapt */ OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetDisplayCallback(struct OH_AVScreenCapture *capture, OH_AVScreenCapture_OnDisplaySelected callback, void *userData); + +/** + * @brief Set the Capture Content Changed callback function so that your application can + * customize event handler generated by the av screen capture. This interface must be called before Start is called. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param capture Pointer to an OH_AVScreenCapture instance + * @param callback contentchanged callback function, see {@link OH_AVScreenCapture_OnCaptureContentChanged} + * @param userData Pointer to user specific data + * @return Function result code. + * {@link AV_SCREEN_CAPTURE_ERR_OK} if the execution is successful. + * {@link AV_SCREEN_CAPTURE_ERR_INVALID_VAL} input capture is nullptr or input callback is nullptr. + * {@link AV_SCREEN_CAPTURE_ERR_OPERATE_NOT_PERMIT} opertation not be permitted, set ErrorCallback failed. + * @since 20 + */ +OH_AVSCREEN_CAPTURE_ErrCode OH_AVScreenCapture_SetCaptureContentChangedCallback(struct OH_AVScreenCapture *capture, + OH_AVScreenCapture_OnCaptureContentChanged callback, void *userData); #ifdef __cplusplus } #endif diff --git a/multimedia/player_framework/native_avscreen_capture_base.h b/multimedia/player_framework/native_avscreen_capture_base.h index 85b1280d10cdf856dadf3dc95455a06119f0a192..32b4682790172bb2e753751ba5d414ffc2bba5f0 100644 --- a/multimedia/player_framework/native_avscreen_capture_base.h +++ b/multimedia/player_framework/native_avscreen_capture_base.h @@ -481,6 +481,21 @@ typedef enum OH_AVScreenCaptureFilterableAudioContent { OH_SCREEN_CAPTURE_CURRENT_APP_AUDIO = 1, } OH_AVScreenCaptureFilterableAudioContent; +/** + * @brief Enumerates screen capture content state. + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * + * @since 20 + */ +typedef enum OH_AVScreenCaptureContentChangedEvent { + /** Content is hiden */ + OH_SCREEN_CAPTURE_CONTENT_HIDE = 0, + /** Content is visible */ + OH_SCREEN_CAPTURE_CONTENT_VISIBLE = 1, + /** ScreenCapture stopped by user */ + OH_SCREEN_CAPTURE_CONTENT_UNAVAILABLE = 2, +} OH_AVScreenCaptureContentChangedEvent; + /** * @brief When state of OH_AVScreenCapture is changed, the function pointer will be called. * @syscap SystemCapability.Multimedia.Media.AVScreenCapture @@ -532,6 +547,19 @@ typedef void (*OH_AVScreenCapture_OnBufferAvailable)(OH_AVScreenCapture *capture */ typedef void (*OH_AVScreenCapture_OnDisplaySelected)(OH_AVScreenCapture *capture, uint64_t displayId, void *userData); +/** + * @brief When Capture Content info changes, the function will be called to notify user + * @syscap SystemCapability.Multimedia.Media.AVScreenCapture + * @param {OH_AVScreenCapture*} capture Pointer to an OH_AVScreenCapture instance + * @param {OH_AVScreenCaptureContentChangedEvent} event enum for content change event + * @param {OH_Rect*} area capture content rect position + * @param { void*} userData Pointer to user specific data + * + * @since 20 + * @version 1.0 + */ +typedef void (*OH_AVScreenCapture_OnCaptureContentChanged)(OH_AVScreenCapture* capture, + OH_AVScreenCaptureContentChangedEvent event, OH_Rect* area, void *userData); #ifdef __cplusplus } #endif