harmony 鸿蒙oh_window_pip.h

  • 2025-06-12
  • 浏览 (4)

oh_window_pip.h

Overview

The oh_window_pip.h file declares the APIs related to the Picture in Picture (PiP) feature, including creating and deleting a PiP controller, and starting and stopping PiP. PiP is mainly used in video playback, live streaming, video calls, or video meetings.

File to include:

Library: libnative_window_manager.so

System capability: SystemCapability.Window.SessionManager

Since: 20

Related module: WindowManager

Summary

Enums

|Name|typedef Keyword|Description| |–|–|–| |PictureInPicture_PipTemplateType|PictureInPicture_PipTemplateType|Enumerates the types of PiP templates.| |PictureInPicture_PipControlGroup|PictureInPicture_PipControlGroup|Enumerates the types of component groups displayed on the PiP controller.| |PictureInPicture_PipControlType|PictureInPicture_PipControlType|Enumerates the types of components displayed on the PiP controller.| |PictureInPicture_PipControlStatus|PictureInPicture_PipControlStatus|Enumerates the statuses of components displayed on the PiP controller.| |PictureInPicture_PipState|PictureInPicture_PipState|Enumerates the PiP lifecycle states.|

Functions

|Name|typedef Keyword|Description| |–|–|–| |typedef void (*WebPipStartPipCallback)(uint32_t controllerId, uint8_t requestId, uint64_t surfaceId)|WebPipStartPipCallback|Defines a callback function for PiP window creation.| |typedef void (*WebPipLifecycleCallback)(uint32_t controllerId, PictureInPicture_PipState state, int32_t errcode)|WebPipLifecycleCallback|Defines a callback function for PiP window lifecycle changes.| |typedef void (*WebPipControlEventCallback)(uint32_t controllerId, PictureInPicture_PipControlType controlType,PictureInPicture_PipControlStatus status)|WebPipControlEventCallback|Defines a callback function for the component click event of the PiP window.| |typedef void (*WebPipResizeCallback)(uint32_t controllerId, uint32_t width, uint32_t height, double scale)|WebPipResizeCallback|Defines a callback function for PiP window size changes.| |int32_t OH_PictureInPicture_CreatePipConfig(PictureInPicture_PipConfig* pipConfig)|-|Creates a PiP configuration.| |int32_t OH_PictureInPicture_DestroyPipConfig(PictureInPicture_PipConfig* pipConfig)|-|Destroys a PiP configuration.| |int32_t OH_PictureInPicture_SetPipMainWindowId(PictureInPicture_PipConfig pipConfig, uint32_t mainWindowId)|-|Sets the ID of the main window that launches PiP.| |int32_t OH_PictureInPicture_SetPipTemplateType(PictureInPicture_PipConfig pipConfig,PictureInPicture_PipTemplateType pipTemplateType)|-|Sets the PiP template type. The default value is video playback.| |int32_t OH_PictureInPicture_SetPipRect(PictureInPicture_PipConfig pipConfig, uint32_t width, uint32_t height)|-|Sets the size of the PiP window for calculating the aspect ratio.| |int32_t OH_PictureInPicture_SetPipControlGroup(PictureInPicture_PipConfig pipConfig,PictureInPicture_PipControlGroup* controlGroup, uint8_t controlGroupLength)|-|Sets a PiP component group, which must match the template type.| |int32_t OH_PictureInPicture_SetPipNapiEnv(PictureInPicture_PipConfig pipConfig, void* env)|-|Sets the runtime environment for launching PiP.| |int32_t OH_PictureInPicture_CreatePip(PictureInPicture_PipConfig pipConfig, uint32_t* controllerId)|-|Creates a PiP controller.| |int32_t OH_PictureInPicture_DeletePip(uint32_t controllerId)|-|Deletes a PiP controller.| |int32_t OH_PictureInPicture_StartPip(uint32_t controllerId)|-|Starts PiP.| |int32_t OH_PictureInPicture_StopPip(uint32_t controllerId)|-|Stops PiP.| |int32_t OH_PictureInPicture_UpdatePipContentSize(uint32_t controllerId, uint32_t width, uint32_t height)|-|Updates the media content size when the media content changes.| |int32_t OH_PictureInPicture_UpdatePipControlStatus(uint32_t controllerId, PictureInPicture_PipControlType controlType,PictureInPicture_PipControlStatus status)|-|Updates the PiP component status.| |int32_t OH_PictureInPicture_SetPipControlEnabled(uint32_t controllerId, PictureInPicture_PipControlType controlType,bool enabled)|-|Sets the PiP component enabled status.| |int32_t OH_PictureInPicture_RegisterStartPipCallback(uint32_t controllerId, WebPipStartPipCallback callback)|-|Registers a callback function for PiP window creation.| |int32_t OH_PictureInPicture_UnregisterStartPipCallback(uint32_t controllerId, WebPipStartPipCallback callback)|-|Unregisters a single callback function for PiP window creation.| |int32_t OH_PictureInPicture_UnregisterAllStartPipCallbacks(uint32_t controllerId)|-|Unregisters all callback functions for PiP window creation.| |int32_t OH_PictureInPicture_RegisterLifecycleListener(uint32_t controllerId, WebPipLifecycleCallback callback)|-|Registers a callback function for PiP window lifecycle changes.| |int32_t OH_PictureInPicture_UnregisterLifecycleListener(uint32_t controllerId, WebPipLifecycleCallback callback)|-|Unregisters a single callback function for PiP window lifecycle changes.| |int32_t OH_PictureInPicture_UnregisterAllLifecycleListeners(uint32_t controllerId)|-|Unregisters all callback functions for PiP window lifecycle changes.| |int32_t OH_PictureInPicture_RegisterControlEventListener(uint32_t controllerId, WebPipControlEventCallback callback)|-|Registers a callback function for the component click event of the PiP window.| |int32_t OH_PictureInPicture_UnregisterControlEventListener(uint32_t controllerId, WebPipControlEventCallback callback)|-|Unregisters a single callback function for the component click event of the PiP window.| |int32_t OH_PictureInPicture_UnregisterAllControlEventListeners(uint32_t controllerId)|-|Unregisters all callback functions for the component click event of the PiP window.| |int32_t OH_PictureInPicture_RegisterResizeListener(uint32_t controllerId, WebPipResizeCallback callback)|-|Registers a callback function for PiP window size changes.| |int32_t OH_PictureInPicture_UnregisterResizeListener(uint32_t controllerId, WebPipResizeCallback callback)|-|Unregisters a single callback function for PiP window size changes.| |int32_t OH_PictureInPicture_UnregisterAllResizeListeners(uint32_t controllerId)|-|Unregisters all callback functions for PiP window size changes.|

Enum Description

PictureInPicture_PipTemplateType

enum PictureInPicture_PipTemplateType

Description

Enumerates the types of PiP templates.

Since: 20

|Enum Item|Description| |–|–| |VIDEO_PLAY = 0|Video playback template. A PiP window will be started during video playback, and the video playback template is loaded.| |VIDEO_CALL = 1|Video call template. A PiP window will be started during a video call, and the video call template will be loaded.| |VIDEO_MEETING = 2|Video meeting template. A PiP window will be started during a video meeting, and the video meeting template will be loaded.| |VIDEO_LIVE = 3|Live template. A PiP window will be started during a live, and the live template is loaded.|

PictureInPicture_PipControlGroup

enum PictureInPicture_PipControlGroup

Description

Enumerates the types of component groups displayed on the PiP controller.

Since: 20

|Enum Item|Description| |–|–| |VIDEO_PLAY_VIDEO_PREVIOUS_NEXT = 101|Previous/Next component group for video playback. This component group is mutually exclusive with the fast-forward/rewind component group. It cannot be added if the fast-forward/rewind component group is added.| |VIDEO_PLAY_FAST_FORWARD_BACKWARD = 102|Fast-forward/Rewind component group for video playback. This component group is mutually exclusive with the previous/next component group. It cannot be added if the previous/next component group is added.| |VIDEO_CALL_MICROPHONE_SWITCH = 201|Microphone on/off component group for video calls.| |VIDEO_CALL_HANG_UP_BUTTON = 202|Hang-up component group for video calls.| |VIDEO_CALL_CAMERA_SWITCH = 203|Camera on/off component group for video calls.| |VIDEO_CALL_MUTE_SWITCH = 204|Mute component group for video calls.| |VIDEO_MEETING_HANG_UP_BUTTON = 301|Hang-up component group for video meetings.| |VIDEO_MEETING_CAMERA_SWITCH = 302|Camera on/off component group for video meetings.| |VIDEO_MEETING_MUTE_SWITCH = 303|Mute component group for video meetings.| |VIDEO_MEETING_MICROPHONE_SWITCH = 304|Microphone on/off component group for video meetings.| |VIDEO_LIVE_VIDEO_PLAY_PAUSE = 401|Play/Pause component group for live streaming.| |VIDEO_LIVE_MUTE_SWITCH = 402|Mute component group for live streaming.|

PictureInPicture_PipControlType

enum PictureInPicture_PipControlType

Description

Enumerates the types of components displayed on the PiP controller.

Since: 20

|Enum Item|Description| |–|–| |VIDEO_PLAY_PAUSE = 0|Play/Pause component.| |VIDEO_PREVIOUS = 1|Previous component in video scenarios.| |VIDEO_NEXT = 2|Next component in video scenarios.| |FAST_FORWARD = 3|Fast-forward component in video scenarios.| |FAST_BACKWARD = 4|Rewind component in video scenarios.| |HANG_UP_BUTTON = 5|Hang-up component.| |MICROPHONE_SWITCH = 6|Microphone on/off component.| |CAMERA_SWITCH = 7|Camera on/off component.| |MUTE_SWITCH = 8|Mute/Unmute component.|

PictureInPicture_PipControlStatus

enum PictureInPicture_PipControlStatus

Description

Enumerates the statuses of components displayed on the PiP controller.

Since: 20

|Enum Item|Description| |–|–| |PLAY = 1|A video is playing.| |PAUSE = 0|A video is paused.| |OPEN = 1|The camera, microphone, and mute components are enabled.| |CLOSE = 0|The camera, microphone, and mute components are disabled.|

PictureInPicture_PipState

enum PictureInPicture_PipState

Description

Enumerates the PiP lifecycle states.

Since: 20

|Enum Item|Description| |–|–| |ABOUT_TO_START = 1|PiP is about to start.| |STARTED = 2|PiP is started.| |ABOUT_TO_STOP = 3|PiP is about to stop.| |STOPPED = 4|PiP is stopped.| |ABOUT_TO_RESTORE = 5|The original page is about to restore.| |ERROR = 6|An error occurs during the execution of the PiP lifecycle.|

Function Description

WebPipStartPipCallback()

typedef void (*WebPipStartPipCallback)(uint32_t controllerId, uint8_t requestId, uint64_t surfaceId)

Description

Defines a callback function for PiP window creation.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| | uint8_t requestId|Request ID, which indicates the number of times the PiP window has been requested to be pulled up.| | uint64_t surfaceId|Surface ID of the XComponent in PiP. It is used for application rendering.|

WebPipLifecycleCallback()

typedef void (*WebPipLifecycleCallback)(uint32_t controllerId, PictureInPicture_PipState state, int32_t errcode)

Description

Defines a callback function for PiP window lifecycle changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| | PictureInPicture_PipState state|PiP lifecycle state.| | int32_t errcode|Common status codes of PiP APIs. For details, see WindowManager_ErrorCode.|

WebPipControlEventCallback()

typedef void (*WebPipControlEventCallback)(uint32_t controllerId, PictureInPicture_PipControlType controlType, PictureInPicture_PipControlStatus status)

Description

Defines a callback function for the component click event of the PiP window.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| | PictureInPicture_PipControlType controlType|Type of component displayed on the PiP controller.| |PictureInPicture_PipControlStatus status|Status of the component displayed on the PiP controller.|

WebPipResizeCallback()

typedef void (*WebPipResizeCallback)(uint32_t controllerId, uint32_t width, uint32_t height, double scale)

Description

Defines a callback function for PiP window size changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| | uint32_t width|PiP window width, in px. The value is a positive integer and cannot be greater than the screen width.| | uint32_t height|PiP window height, in px. The value is a positive integer and cannot be greater than the screen height.| | double scale|Scale factor of the PiP window, representing the display size relative to the width and height. The value is a floating point number in the range (0.0, 1.0]. The value 1 means that the PiP window matches the specified width and height.|

OH_PictureInPicture_CreatePipConfig()

int32_t OH_PictureInPicture_CreatePipConfig(PictureInPicture_PipConfig* pipConfig)

Description

Creates a PiP configuration.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig* pipConfig|Pointer to the PiP parameter configuration.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.|

OH_PictureInPicture_DestroyPipConfig()

int32_t OH_PictureInPicture_DestroyPipConfig(PictureInPicture_PipConfig* pipConfig)

Description

Destroys a PiP configuration.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig* pipConfig|Pointer to the PiP configuration.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.|

OH_PictureInPicture_SetPipMainWindowId()

int32_t OH_PictureInPicture_SetPipMainWindowId(PictureInPicture_PipConfig pipConfig, uint32_t mainWindowId)

Description

Sets the ID of the main window that launches PiP.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig pipConfig|PiP configuration.| |uint32_t mainWindowId|ID of the main window that launches PiP.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.|

OH_PictureInPicture_SetPipTemplateType()

int32_t OH_PictureInPicture_SetPipTemplateType(PictureInPicture_PipConfig pipConfig, PictureInPicture_PipTemplateType pipTemplateType)

Description

Sets the PiP template type. The default value is video playback.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig pipConfig|PiP configuration.| |PictureInPicture_PipTemplateType pipTemplateType|Type of the PiP template.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.|

OH_PictureInPicture_SetPipRect()

int32_t OH_PictureInPicture_SetPipRect(PictureInPicture_PipConfig pipConfig, uint32_t width, uint32_t height)

Description

Sets the size of the PiP window for calculating the aspect ratio.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig pipConfig|PiP configuration.| |uint32_t width|Width of the original content, in px. The value must be a positive integer. It is used to determine the aspect ratio of the PiP window.| |uint32_t height|Height of the original content, in px. The value must be a positive integer. It is used to determine the aspect ratio of the PiP window.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.|

OH_PictureInPicture_SetPipControlGroup()

int32_t OH_PictureInPicture_SetPipControlGroup(PictureInPicture_PipConfig pipConfig, PictureInPicture_PipControlGroup* controlGroup, uint8_t controlGroupLength)

Description

Sets a PiP component group, which must match the template type.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig pipConfig|PiP configuration.| |PictureInPicture_PipControlGroup* controlGroup|Pointer to an optional component group of the PiP controller. An application can configure whether to display these optional components. If this parameter is not set for an application, the basic components (for example, play/pause of the video playback component group) are displayed. A maximum of three components can be configured.| |uint8_t controlGroupLength|Number of components in the PiP component group. The value ranges from 0 to 3.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.|

OH_PictureInPicture_SetPipNapiEnv()

int32_t OH_PictureInPicture_SetPipNapiEnv(PictureInPicture_PipConfig pipConfig, void* env)

Description

Sets the runtime environment for launching PiP.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig pipConfig|PiP configuration.| |void* env|Pointer to the NAPI environment.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.|

OH_PictureInPicture_CreatePip()

int32_t OH_PictureInPicture_CreatePip(PictureInPicture_PipConfig pipConfig, uint32_t* controllerId)

Description

Creates a PiP controller.

Since: 20

Parameters

|Parameter|Description| |–|–| |PictureInPicture_PipConfig pipConfig|PiP configuration.| |uint32_t* controllerId|Pointer to the ID of the PiP controller created.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_DeletePip()

int32_t OH_PictureInPicture_DeletePip(uint32_t controllerId)

Description

Deletes a PiP controller.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.|

OH_PictureInPicture_StartPip()

int32_t OH_PictureInPicture_StartPip(uint32_t controllerId)

Description

Starts PiP.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_PIP_STATE_ABNORMAL: The PiP window is abnormal.
WINDOW_MANAGER_ERRORCODE_PIP_CREATE_FAILED: Creating the PiP window fails.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.
WINDOW_MANAGER_ERRORCODE_PIP_REPEAT_OPERATION: The PiP window is manipulated repeatedly.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.|

OH_PictureInPicture_StopPip()

int32_t OH_PictureInPicture_StopPip(uint32_t controllerId)

Description

Stops PiP.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_PIP_DESTROY_FAILED: Destroying the PiP window fails.
WINDOW_MANAGER_ERRORCODE_PIP_STATE_ABNORMAL: The PiP window is abnormal.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.
WINDOW_MANAGER_ERRORCODE_PIP_REPEAT_OPERATION: The PiP window is manipulated repeatedly.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.|

OH_PictureInPicture_UpdatePipContentSize()

int32_t OH_PictureInPicture_UpdatePipContentSize(uint32_t controllerId, uint32_t width, uint32_t height)

Description

Updates the media content size when the media content changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |uint32_t width|Width of the media content, in px. The value must be a positive integer. It is used to update the aspect ratio of the PiP window.| |uint32_t height|Height of the media content, in px. The value must be a positive integer. It is used to update the aspect ratio of the PiP window.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UpdatePipControlStatus()

int32_t OH_PictureInPicture_UpdatePipControlStatus(uint32_t controllerId, PictureInPicture_PipControlType controlType, PictureInPicture_PipControlStatus status)

Description

Updates the PiP component status.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |PictureInPicture_PipControlType controlType|Type of the component displayed on the PiP controller. Currently, only VIDEO_PLAY_PAUSE, MICROPHONE_SWITCH, CAMERA_SWITCH, and MUTE_SWITCH are supported.| |PictureInPicture_PipControlStatus status|Status of the component displayed on the PiP controller.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_SetPipControlEnabled()

int32_t OH_PictureInPicture_SetPipControlEnabled(uint32_t controllerId, PictureInPicture_PipControlType controlType, bool enabled)

Description

Sets the PiP component enabled status.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |PictureInPicture_PipControlType controlType|Type of the component displayed on the PiP controller.| |bool enabled|Enabled status of the component displayed on the PiP controller. The value true means that the component is enabled, and false means the opposite.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_RegisterStartPipCallback()

int32_t OH_PictureInPicture_RegisterStartPipCallback(uint32_t controllerId, WebPipStartPipCallback callback)

Description

Registers a callback function for PiP window creation.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipStartPipCallback callback|Callback function for PiP window creation.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterStartPipCallback()

int32_t OH_PictureInPicture_UnregisterStartPipCallback(uint32_t controllerId, WebPipStartPipCallback callback)

Description

Unregisters a single callback function for PiP window creation.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipStartPipCallback callback|Callback function for PiP window creation.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterAllStartPipCallbacks()

int32_t OH_PictureInPicture_UnregisterAllStartPipCallbacks(uint32_t controllerId)

Description

Unregisters all callback functions for PiP window creation.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_RegisterLifecycleListener()

int32_t OH_PictureInPicture_RegisterLifecycleListener(uint32_t controllerId, WebPipLifecycleCallback callback)

Description

Registers a callback function for PiP window lifecycle changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipLifecycleCallback callback|Callback function for PiP window lifecycle changes.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterLifecycleListener()

int32_t OH_PictureInPicture_UnregisterLifecycleListener(uint32_t controllerId, WebPipLifecycleCallback callback)

Description

Unregisters a single callback function for PiP window lifecycle changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipLifecycleCallback callback|Callback function for PiP window lifecycle changes.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterAllLifecycleListeners()

int32_t OH_PictureInPicture_UnregisterAllLifecycleListeners(uint32_t controllerId)

Description

Unregisters all callback functions for PiP window lifecycle changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_RegisterControlEventListener()

int32_t OH_PictureInPicture_RegisterControlEventListener(uint32_t controllerId, WebPipControlEventCallback callback)

Description

Registers a callback function for the component click event of the PiP window.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipControlEventCallback callback|Callback function for the component click event of the PiP window.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterControlEventListener()

int32_t OH_PictureInPicture_UnregisterControlEventListener(uint32_t controllerId, WebPipControlEventCallback callback)

Description

Unregisters a single callback function for the component click event of the PiP window.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipControlEventCallback callback|Callback function for the component click event of the PiP window.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterAllControlEventListeners()

int32_t OH_PictureInPicture_UnregisterAllControlEventListeners(uint32_t controllerId)

Description

Unregisters all callback functions for the component click event of the PiP window.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_RegisterResizeListener()

int32_t OH_PictureInPicture_RegisterResizeListener(uint32_t controllerId, WebPipResizeCallback callback)

Description

Registers a callback function for PiP window size changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipResizeCallback callback|Callback function for PiP window size changes.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterResizeListener()

int32_t OH_PictureInPicture_UnregisterResizeListener(uint32_t controllerId, WebPipResizeCallback callback)

Description

Unregisters a single callback function for PiP window size changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.| |WebPipResizeCallback callback|Callback function for PiP window size changes.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

OH_PictureInPicture_UnregisterAllResizeListeners()

int32_t OH_PictureInPicture_UnregisterAllResizeListeners(uint32_t controllerId)

Description

Unregisters all callback functions for PiP window size changes.

Since: 20

Parameters

|Parameter|Description| |–|–| |uint32_t controllerId|ID of the PiP controller. The value is a non-negative integer.|

Return value

|Type|Description| |–|–| |int32_t|One of the following result codes:
OK: The function is successfully called.
WINDOW_MANAGER_ERRORCODE_INCORRECT_PARAM: A parameter is incorrect.
WINDOW_MANAGER_ERRORCODE_DEVICE_NOT_SUPPORTED: The device does not support PiP.
WINDOW_MANAGER_ERRORCODE_ERRORCODE_PIP_INTERNAL_ERROR: An internal error occurs in PiP.|

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkUI

harmony 鸿蒙ARKUI_TextPickerCascadeRangeContent

harmony 鸿蒙ARKUI_TextPickerRangeContent

harmony 鸿蒙ArkUI_AnimateCompleteCallback

harmony 鸿蒙ArkUI_AttributeItem

harmony 鸿蒙ArkUI_ColorStop

harmony 鸿蒙ArkUI_ContextCallback

harmony 鸿蒙ArkUI_EventModule

harmony 鸿蒙ArkUI_ExpectedFrameRateRange

harmony 鸿蒙ArkUI_IntOffset

0  赞