From 9df6e5b6dcdc123aafdfc5f3cb34867be22feb7d Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Mon, 16 Oct 2023 17:56:11 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=94=BB=E4=B8=AD?= =?UTF-8?q?=E7=94=BB=E5=8A=9F=E8=83=BDts=E6=8E=A5=E5=8F=A3=20Nyuanfeng@163?= =?UTF-8?q?.com?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 293 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 293 insertions(+) create mode 100644 api/@ohos.pipwindow.d.ts diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts new file mode 100644 index 000000000..243e4fad3 --- /dev/null +++ b/api/@ohos.pipwindow.d.ts @@ -0,0 +1,293 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type BaseContext from './application/BaseContext'; +import type Callback from './@ohos.base'; + +/** + * pipWindow manager + * + * @namespace pipWindow + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ +declare namespace pipWindow { + /** + * If picture-in-picture enabled in current OS. + * + * @returns { boolean } true if PictureInPicture enabled, otherwise false + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function isPictureInPictureEnabled(): boolean; + + /** + * create picture-in-picture controller + * + * @param { PictureInPictureConfiguration } config - Params for picture-in-picture controller creation + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PictureInPictureConfiguration + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PictureInPictureConfiguration): Promise; + + /** + * PictureInPictureConfiguration + * + * @interface PictureInPictureConfiguration + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PictureInPictureConfiguration { + /** + * Indicates window context. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ctx: BaseContext; + + /** + * Indicates the origin XComponentController. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + componentController: XComponentController; + + /** + * Indicates navigation ID. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + navigationId?: string; + + /** + * Picture-in-picture template type. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + templateType?: PictureInPictureTemplateType; + + /** + * Describes the width of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentWidth?: number; + + /** + * Describes the height of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentHeight?: number; + } + + /** + * Describe the type of picture-in-picture. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PictureInPictureTemplateType { + /** + * Indicates the content to show in picture-in-picture window is video play + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + + VIDEO_PLAY, + /** + * Indicates the content to show in picture-in-picture window is video call + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_CALL, + + /** + * Indicates the content to show in picture-in-picture window is video meeting + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_MEETING, + } + + /** + * Enum for pipWindow callback event type. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PictureInPictureState { + /** + * pipWindow is about to start. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + WILL_START = 1, + + /** + * pipWindow started. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STARTED = 2, + + /** + * pipWindow is about to stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + WILL_STOP = 3, + + /** + * pipWindow stopped. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STOPPED = 4, + + /** + * restore the original page from pipWindow + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + RESTORE = 5, + + /** + * error message during start/stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ERROR = 6, + } + + /** + * Describe picture-in-picture action event type. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PictureInPictureActionEventType = + PictureInPictureVideoActionEvent | PictureInPictureCallActionEvent | PictureInPictureMeetingActionEvent; + + type PictureInPictureVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; + + type PictureInPictureCallActionEvent = 'hangUp'; + + type PictureInPictureMeetingActionEvent = 'hangUp'; + + /** + * PictureInPictureController + * + * @interface PictureInPictureController + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PictureInPictureController { + + /** + * Start picture-in-picture + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 1300012 - If pip window state is abnormal. + * @throws { BusinessError } 1300013 - Create pip window failed. + * @throws { BusinessError } 1300014 - Error when load pipWindow content or show pipWindow + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPictureInPicture(): Promise; + + /** + * Stop picture-in-picture. + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 1300011 - Stop pip window failed. + * @throws { BusinessError } 1300012 - If pip window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPictureInPicture(): Promise; + + /** + * Set if auto start picture-in-picture when back home + * @param { boolean } enable - Enable auto start picture-in-picture when back home + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + setAutoStartEnabled(enable: boolean): void; + + /** + * Update source content size to adjust pipWindow aspect ratio. + * @param { number } width - Indicates the width of the content. + * @param { number } height - Indicates the height of the content. + * @throws { BusinessError } 401 - Params error, invalid width or height. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + updateContentSize(width: number, height: number): void; + + /** + * Register picture-in-picture control event listener. + * @param { 'stateChange' } type - Registration type, pip lifecycle state change, 'stateChange' + * @param { function } callback - Used to handle {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'stateChange', callback: (state: PictureInPictureState, reason: string) => void): void; + + /** + * Unregister picture-in-picture lifecycle event listener. + * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'stateChange'): void; + + /** + * Register picture-in-picture control event listener. + * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' + * @param { function } callback - Used to handle {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'controlPanelActionEvent', callback: (event: PictureInPictureActionEventType) => void): void; + + /** + * Unregister picture-in-picture lifecycle event listener + * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'controlPanelActionEvent'): void; + } +} + +export default pipWindow; \ No newline at end of file From 5894964520a7e1b00b7aea63e90aaf79933c4221 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Wed, 25 Oct 2023 16:59:34 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 47 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 243e4fad3..e12392b5e 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -36,30 +36,30 @@ declare namespace pipWindow { /** * create picture-in-picture controller * - * @param { PictureInPictureConfiguration } config - Params for picture-in-picture controller creation - * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PictureInPictureConfiguration + * @param { PipConfiguration } config - Params for picture-in-picture controller creation + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PipConfiguration * @throws { BusinessError } 801 - Capability not supported * @syscap SystemCapability.Window.SessionManager * @since 11 */ - function create(config: PictureInPictureConfiguration): Promise; + function create(config: PipConfiguration): Promise; /** - * PictureInPictureConfiguration + * PipConfiguration * - * @interface PictureInPictureConfiguration + * @interface PipConfiguration * @syscap SystemCapability.Window.SessionManager * @since 11 */ - interface PictureInPictureConfiguration { + interface PipConfiguration { /** * Indicates window context. * * @syscap SystemCapability.Window.SessionManager * @since 11 */ - ctx: BaseContext; + context: BaseContext; /** * Indicates the origin XComponentController. @@ -83,7 +83,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - templateType?: PictureInPictureTemplateType; + templateType?: PipTemplateType; /** * Describes the width of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. @@ -109,7 +109,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - enum PictureInPictureTemplateType { + enum PipTemplateType { /** * Indicates the content to show in picture-in-picture window is video play * @syscap SystemCapability.Window.SessionManager @@ -139,14 +139,14 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - enum PictureInPictureState { + enum PipState { /** * pipWindow is about to start. * * @syscap SystemCapability.Window.SessionManager * @since 11 */ - WILL_START = 1, + ABOUT_TO_START = 1, /** * pipWindow started. @@ -162,7 +162,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - WILL_STOP = 3, + ABOUT_TO_STOP = 3, /** * pipWindow stopped. @@ -178,7 +178,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - RESTORE = 5, + ABOUT_TO_RESTORE = 5, /** * error message during start/stop. @@ -195,23 +195,22 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - type PictureInPictureActionEventType = - PictureInPictureVideoActionEvent | PictureInPictureCallActionEvent | PictureInPictureMeetingActionEvent; + type PipActionEventType = PipVideoActionEvent | PipCallActionEvent | PipMeetingActionEvent; - type PictureInPictureVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; + type PipVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; - type PictureInPictureCallActionEvent = 'hangUp'; + type PipCallActionEvent = 'hangUp'; - type PictureInPictureMeetingActionEvent = 'hangUp'; + type PipMeetingActionEvent = 'hangUp'; /** - * PictureInPictureController + * PipController * - * @interface PictureInPictureController + * @interface PipController * @syscap SystemCapability.Window.SessionManager * @since 11 */ - interface PictureInPictureController { + interface PipController { /** * Start picture-in-picture @@ -261,7 +260,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - on(type: 'stateChange', callback: (state: PictureInPictureState, reason: string) => void): void; + on(type: 'stateChange', callback: (state: PipState, reason: string) => void): void; /** * Unregister picture-in-picture lifecycle event listener. @@ -278,7 +277,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - on(type: 'controlPanelActionEvent', callback: (event: PictureInPictureActionEventType) => void): void; + on(type: 'controlPanelActionEvent', callback: (event: PipActionEventType) => void): void; /** * Unregister picture-in-picture lifecycle event listener From 075577cef8a3988c9bbe8a2e65571d8e63bf9e09 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Wed, 25 Oct 2023 17:59:42 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B1=9E=E6=80=A7type?= =?UTF-8?q?=E6=A0=87=E7=AD=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index e12392b5e..12c0d5394 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -56,6 +56,7 @@ declare namespace pipWindow { /** * Indicates window context. * + * @type { BaseContext } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -64,6 +65,7 @@ declare namespace pipWindow { /** * Indicates the origin XComponentController. * + * @type { XComponentController } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -72,6 +74,7 @@ declare namespace pipWindow { /** * Indicates navigation ID. * + * @type { string } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -80,6 +83,7 @@ declare namespace pipWindow { /** * Picture-in-picture template type. * + * @type { PipTemplateType } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -88,6 +92,7 @@ declare namespace pipWindow { /** * Describes the width of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. * + * @type { number } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -96,6 +101,7 @@ declare namespace pipWindow { /** * Describes the height of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. * + * @type { number } * @syscap SystemCapability.Window.SessionManager * @since 11 */ From 1d2d3105a85c84bf371368c253d701b0a41f5eae Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Wed, 25 Oct 2023 18:14:17 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E5=A2=9E=E5=8A=A0AsyncCallback=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 12c0d5394..5bce51397 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -13,8 +13,8 @@ * limitations under the License. */ +import type AsyncCallback from './@ohos.base'; import type BaseContext from './application/BaseContext'; -import type Callback from './@ohos.base'; /** * pipWindow manager @@ -45,6 +45,18 @@ declare namespace pipWindow { */ function create(config: PipConfiguration): Promise; + /** + * create picture-in-picture controller + * + * @param { PipConfiguration } config - Params for picture-in-picture controller creation + * @param { AsyncCallback } callback - Callback used to return the PipController created + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PipConfiguration + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PipConfiguration, callback: AsyncCallback): void; + /** * PipConfiguration * @@ -230,6 +242,18 @@ declare namespace pipWindow { */ startPictureInPicture(): Promise; + /** + * Start picture-in-picture + * @param { AsyncCallback } callback - Callback after pip start finish + * @throws { BusinessError } 1300012 - If pip window state is abnormal. + * @throws { BusinessError } 1300013 - Create pip window failed. + * @throws { BusinessError } 1300014 - Error when load pipWindow content or show pipWindow + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPictureInPicture(callback: AsyncCallback): void; + /** * Stop picture-in-picture. * @returns { Promise } - The promise returned by the function. @@ -241,6 +265,17 @@ declare namespace pipWindow { */ stopPictureInPicture(): Promise; + /** + * Stop picture-in-picture. + * @param { AsyncCallback } callback - Callback after pip stop finish + * @throws { BusinessError } 1300011 - Stop pip window failed. + * @throws { BusinessError } 1300012 - If pip window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPictureInPicture(callback: AsyncCallback): void; + /** * Set if auto start picture-in-picture when back home * @param { boolean } enable - Enable auto start picture-in-picture when back home From cd3db859c969960fc041ec50645c79297d88fa2a Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Wed, 25 Oct 2023 18:27:08 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9cleanCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 5bce51397..2f6b0ef35 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -86,7 +86,7 @@ declare namespace pipWindow { /** * Indicates navigation ID. * - * @type { string } + * @type { ?string } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -95,7 +95,7 @@ declare namespace pipWindow { /** * Picture-in-picture template type. * - * @type { PipTemplateType } + * @type { ?PipTemplateType } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -104,7 +104,7 @@ declare namespace pipWindow { /** * Describes the width of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. * - * @type { number } + * @type { ?number } * @syscap SystemCapability.Window.SessionManager * @since 11 */ @@ -113,7 +113,7 @@ declare namespace pipWindow { /** * Describes the height of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. * - * @type { number } + * @type { ?number } * @syscap SystemCapability.Window.SessionManager * @since 11 */ From f2a2b0a01cdaac1f3d07d3137b0de1bb66b0ec3a Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Fri, 27 Oct 2023 11:21:25 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9pip=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=90=8D=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 2f6b0ef35..fcab18c08 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -31,7 +31,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - function isPictureInPictureEnabled(): boolean; + function isPipEnabled(): boolean; /** * create picture-in-picture controller @@ -240,7 +240,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - startPictureInPicture(): Promise; + startPip(): Promise; /** * Start picture-in-picture @@ -252,7 +252,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - startPictureInPicture(callback: AsyncCallback): void; + startPip(callback: AsyncCallback): void; /** * Stop picture-in-picture. @@ -263,7 +263,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - stopPictureInPicture(): Promise; + stopPip(): Promise; /** * Stop picture-in-picture. @@ -274,7 +274,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - stopPictureInPicture(callback: AsyncCallback): void; + stopPip(callback: AsyncCallback): void; /** * Set if auto start picture-in-picture when back home From 9ee4e4a423d27a76fa19b6977d85d9d2ff9e0717 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Fri, 27 Oct 2023 11:26:13 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index fcab18c08..88876ef82 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -135,6 +135,7 @@ declare namespace pipWindow { */ VIDEO_PLAY, + /** * Indicates the content to show in picture-in-picture window is video call * @syscap SystemCapability.Window.SessionManager From 58fa51f2eae9017064b737106e3aad9be03e26ec Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Fri, 27 Oct 2023 12:38:01 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 88876ef82..8c45ea557 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -133,7 +133,6 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - VIDEO_PLAY, /** From 7d584acc154215ff3bcfef850dbe8dfee79d3085 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Sat, 28 Oct 2023 14:36:37 +0800 Subject: [PATCH 09/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 8c45ea557..9e6952aae 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -17,7 +17,7 @@ import type AsyncCallback from './@ohos.base'; import type BaseContext from './application/BaseContext'; /** - * pipWindow manager + * PipWindow manager * * @namespace pipWindow * @syscap SystemCapability.Window.SessionManager @@ -34,7 +34,7 @@ declare namespace pipWindow { function isPipEnabled(): boolean; /** - * create picture-in-picture controller + * Create picture-in-picture controller * * @param { PipConfiguration } config - Params for picture-in-picture controller creation * @returns { Promise } - The promise returned by the function @@ -46,7 +46,7 @@ declare namespace pipWindow { function create(config: PipConfiguration): Promise; /** - * create picture-in-picture controller + * Create picture-in-picture controller * * @param { PipConfiguration } config - Params for picture-in-picture controller creation * @param { AsyncCallback } callback - Callback used to return the PipController created @@ -159,7 +159,7 @@ declare namespace pipWindow { */ enum PipState { /** - * pipWindow is about to start. + * PipWindow is about to start. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -167,7 +167,7 @@ declare namespace pipWindow { ABOUT_TO_START = 1, /** - * pipWindow started. + * PipWindow started. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -175,7 +175,7 @@ declare namespace pipWindow { STARTED = 2, /** - * pipWindow is about to stop. + * PipWindow is about to stop. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -183,7 +183,7 @@ declare namespace pipWindow { ABOUT_TO_STOP = 3, /** - * pipWindow stopped. + * PipWindow stopped. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -191,7 +191,7 @@ declare namespace pipWindow { STOPPED = 4, /** - * restore the original page from pipWindow + * Restore the original page from pipWindow * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -199,7 +199,7 @@ declare namespace pipWindow { ABOUT_TO_RESTORE = 5, /** - * error message during start/stop. + * Error message during start/stop. * * @syscap SystemCapability.Window.SessionManager * @since 11 From 268dc66865194b95da614e300a3070549aace59f Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Tue, 31 Oct 2023 14:24:21 +0800 Subject: [PATCH 10/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=A7=84=E8=8C=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 104 +++++++++++++++++++-------------------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts index 9e6952aae..74dec8c29 100644 --- a/api/@ohos.pipwindow.d.ts +++ b/api/@ohos.pipwindow.d.ts @@ -17,7 +17,7 @@ import type AsyncCallback from './@ohos.base'; import type BaseContext from './application/BaseContext'; /** - * PipWindow manager + * Picture In Picture Window Manager * * @namespace pipWindow * @syscap SystemCapability.Window.SessionManager @@ -31,40 +31,40 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - function isPipEnabled(): boolean; + function isPiPEnabled(): boolean; /** * Create picture-in-picture controller * - * @param { PipConfiguration } config - Params for picture-in-picture controller creation - * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PipConfiguration + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration * @throws { BusinessError } 801 - Capability not supported * @syscap SystemCapability.Window.SessionManager * @since 11 */ - function create(config: PipConfiguration): Promise; + function create(config: PiPConfiguration): Promise; /** * Create picture-in-picture controller * - * @param { PipConfiguration } config - Params for picture-in-picture controller creation - * @param { AsyncCallback } callback - Callback used to return the PipController created - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PipConfiguration + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation + * @param { AsyncCallback } callback - Callback used to return the PiPController created + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration * @throws { BusinessError } 801 - Capability not supported * @syscap SystemCapability.Window.SessionManager * @since 11 */ - function create(config: PipConfiguration, callback: AsyncCallback): void; + function create(config: PiPConfiguration, callback: AsyncCallback): void; /** - * PipConfiguration + * PiPConfiguration * - * @interface PipConfiguration + * @interface PiPConfiguration * @syscap SystemCapability.Window.SessionManager * @since 11 */ - interface PipConfiguration { + interface PiPConfiguration { /** * Indicates window context. * @@ -95,14 +95,14 @@ declare namespace pipWindow { /** * Picture-in-picture template type. * - * @type { ?PipTemplateType } + * @type { ?PiPTemplateType } * @syscap SystemCapability.Window.SessionManager * @since 11 */ - templateType?: PipTemplateType; + templateType?: PiPTemplateType; /** - * Describes the width of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. + * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio. * * @type { ?number } * @syscap SystemCapability.Window.SessionManager @@ -111,7 +111,7 @@ declare namespace pipWindow { contentWidth?: number; /** - * Describes the height of content to be displayed in pipWindow. For adjusting pipWindow aspect ratio. + * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio. * * @type { ?number } * @syscap SystemCapability.Window.SessionManager @@ -127,7 +127,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - enum PipTemplateType { + enum PiPTemplateType { /** * Indicates the content to show in picture-in-picture window is video play * @syscap SystemCapability.Window.SessionManager @@ -151,15 +151,15 @@ declare namespace pipWindow { } /** - * Enum for pipWindow callback event type. + * Enum for PiP window callback event type. * * @enum { number }. * @syscap SystemCapability.Window.SessionManager * @since 11 */ - enum PipState { + enum PiPState { /** - * PipWindow is about to start. + * PiP window is about to start. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -167,7 +167,7 @@ declare namespace pipWindow { ABOUT_TO_START = 1, /** - * PipWindow started. + * PiP window started. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -175,7 +175,7 @@ declare namespace pipWindow { STARTED = 2, /** - * PipWindow is about to stop. + * PiP window is about to stop. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -183,7 +183,7 @@ declare namespace pipWindow { ABOUT_TO_STOP = 3, /** - * PipWindow stopped. + * PiP window stopped. * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -191,7 +191,7 @@ declare namespace pipWindow { STOPPED = 4, /** - * Restore the original page from pipWindow + * Restore the original page from PiP window * * @syscap SystemCapability.Window.SessionManager * @since 11 @@ -213,68 +213,68 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - type PipActionEventType = PipVideoActionEvent | PipCallActionEvent | PipMeetingActionEvent; + type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent; - type PipVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; + type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; - type PipCallActionEvent = 'hangUp'; + type PiPCallActionEvent = 'hangUp'; - type PipMeetingActionEvent = 'hangUp'; + type PiPMeetingActionEvent = 'hangUp'; /** - * PipController + * PiPController * - * @interface PipController + * @interface PiPController * @syscap SystemCapability.Window.SessionManager * @since 11 */ - interface PipController { + interface PiPController { /** * Start picture-in-picture * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 1300012 - If pip window state is abnormal. - * @throws { BusinessError } 1300013 - Create pip window failed. - * @throws { BusinessError } 1300014 - Error when load pipWindow content or show pipWindow + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window * @throws { BusinessError } 1300015 - If window has created * @syscap SystemCapability.Window.SessionManager * @since 11 */ - startPip(): Promise; + startPiP(): Promise; /** * Start picture-in-picture - * @param { AsyncCallback } callback - Callback after pip start finish - * @throws { BusinessError } 1300012 - If pip window state is abnormal. - * @throws { BusinessError } 1300013 - Create pip window failed. - * @throws { BusinessError } 1300014 - Error when load pipWindow content or show pipWindow + * @param { AsyncCallback } callback - Callback after PiP start finish + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window * @throws { BusinessError } 1300015 - If window has created * @syscap SystemCapability.Window.SessionManager * @since 11 */ - startPip(callback: AsyncCallback): void; + startPiP(callback: AsyncCallback): void; /** * Stop picture-in-picture. * @returns { Promise } - The promise returned by the function. - * @throws { BusinessError } 1300011 - Stop pip window failed. - * @throws { BusinessError } 1300012 - If pip window state is abnormal. + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. * @throws { BusinessError } 1300015 - If window is stopping * @syscap SystemCapability.Window.SessionManager * @since 11 */ - stopPip(): Promise; + stopPiP(): Promise; /** * Stop picture-in-picture. - * @param { AsyncCallback } callback - Callback after pip stop finish - * @throws { BusinessError } 1300011 - Stop pip window failed. - * @throws { BusinessError } 1300012 - If pip window state is abnormal. + * @param { AsyncCallback } callback - Callback after PiP stop finish + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. * @throws { BusinessError } 1300015 - If window is stopping * @syscap SystemCapability.Window.SessionManager * @since 11 */ - stopPip(callback: AsyncCallback): void; + stopPiP(callback: AsyncCallback): void; /** * Set if auto start picture-in-picture when back home @@ -285,7 +285,7 @@ declare namespace pipWindow { setAutoStartEnabled(enable: boolean): void; /** - * Update source content size to adjust pipWindow aspect ratio. + * Update source content size to adjust PiP window aspect ratio. * @param { number } width - Indicates the width of the content. * @param { number } height - Indicates the height of the content. * @throws { BusinessError } 401 - Params error, invalid width or height. @@ -296,12 +296,12 @@ declare namespace pipWindow { /** * Register picture-in-picture control event listener. - * @param { 'stateChange' } type - Registration type, pip lifecycle state change, 'stateChange' + * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange' * @param { function } callback - Used to handle {'stateChange'} command * @syscap SystemCapability.Window.SessionManager * @since 11 */ - on(type: 'stateChange', callback: (state: PipState, reason: string) => void): void; + on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; /** * Unregister picture-in-picture lifecycle event listener. @@ -318,7 +318,7 @@ declare namespace pipWindow { * @syscap SystemCapability.Window.SessionManager * @since 11 */ - on(type: 'controlPanelActionEvent', callback: (event: PipActionEventType) => void): void; + on(type: 'controlPanelActionEvent', callback: (event: PiPActionEventType) => void): void; /** * Unregister picture-in-picture lifecycle event listener From 184bb704c5f3ce404edae530d0f890191a4bd6c2 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Tue, 31 Oct 2023 14:35:41 +0800 Subject: [PATCH 11/15] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipwindow.d.ts | 333 --------------------------------------- 1 file changed, 333 deletions(-) delete mode 100644 api/@ohos.pipwindow.d.ts diff --git a/api/@ohos.pipwindow.d.ts b/api/@ohos.pipwindow.d.ts deleted file mode 100644 index 74dec8c29..000000000 --- a/api/@ohos.pipwindow.d.ts +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type AsyncCallback from './@ohos.base'; -import type BaseContext from './application/BaseContext'; - -/** - * Picture In Picture Window Manager - * - * @namespace pipWindow - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ -declare namespace pipWindow { - /** - * If picture-in-picture enabled in current OS. - * - * @returns { boolean } true if PictureInPicture enabled, otherwise false - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - function isPiPEnabled(): boolean; - - /** - * Create picture-in-picture controller - * - * @param { PiPConfiguration } config - Params for picture-in-picture controller creation - * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration - * @throws { BusinessError } 801 - Capability not supported - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - function create(config: PiPConfiguration): Promise; - - /** - * Create picture-in-picture controller - * - * @param { PiPConfiguration } config - Params for picture-in-picture controller creation - * @param { AsyncCallback } callback - Callback used to return the PiPController created - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration - * @throws { BusinessError } 801 - Capability not supported - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - function create(config: PiPConfiguration, callback: AsyncCallback): void; - - /** - * PiPConfiguration - * - * @interface PiPConfiguration - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - interface PiPConfiguration { - /** - * Indicates window context. - * - * @type { BaseContext } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - context: BaseContext; - - /** - * Indicates the origin XComponentController. - * - * @type { XComponentController } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - componentController: XComponentController; - - /** - * Indicates navigation ID. - * - * @type { ?string } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - navigationId?: string; - - /** - * Picture-in-picture template type. - * - * @type { ?PiPTemplateType } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - templateType?: PiPTemplateType; - - /** - * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio. - * - * @type { ?number } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - contentWidth?: number; - - /** - * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio. - * - * @type { ?number } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - contentHeight?: number; - } - - /** - * Describe the type of picture-in-picture. - * - * @enum { number }. - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - enum PiPTemplateType { - /** - * Indicates the content to show in picture-in-picture window is video play - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - VIDEO_PLAY, - - /** - * Indicates the content to show in picture-in-picture window is video call - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - VIDEO_CALL, - - /** - * Indicates the content to show in picture-in-picture window is video meeting - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - VIDEO_MEETING, - } - - /** - * Enum for PiP window callback event type. - * - * @enum { number }. - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - enum PiPState { - /** - * PiP window is about to start. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ABOUT_TO_START = 1, - - /** - * PiP window started. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - STARTED = 2, - - /** - * PiP window is about to stop. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ABOUT_TO_STOP = 3, - - /** - * PiP window stopped. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - STOPPED = 4, - - /** - * Restore the original page from PiP window - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ABOUT_TO_RESTORE = 5, - - /** - * Error message during start/stop. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ERROR = 6, - } - - /** - * Describe picture-in-picture action event type. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent; - - type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; - - type PiPCallActionEvent = 'hangUp'; - - type PiPMeetingActionEvent = 'hangUp'; - - /** - * PiPController - * - * @interface PiPController - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - interface PiPController { - - /** - * Start picture-in-picture - * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300013 - Create PiP window failed. - * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window - * @throws { BusinessError } 1300015 - If window has created - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - startPiP(): Promise; - - /** - * Start picture-in-picture - * @param { AsyncCallback } callback - Callback after PiP start finish - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300013 - Create PiP window failed. - * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window - * @throws { BusinessError } 1300015 - If window has created - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - startPiP(callback: AsyncCallback): void; - - /** - * Stop picture-in-picture. - * @returns { Promise } - The promise returned by the function. - * @throws { BusinessError } 1300011 - Stop PiP window failed. - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300015 - If window is stopping - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - stopPiP(): Promise; - - /** - * Stop picture-in-picture. - * @param { AsyncCallback } callback - Callback after PiP stop finish - * @throws { BusinessError } 1300011 - Stop PiP window failed. - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300015 - If window is stopping - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - stopPiP(callback: AsyncCallback): void; - - /** - * Set if auto start picture-in-picture when back home - * @param { boolean } enable - Enable auto start picture-in-picture when back home - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - setAutoStartEnabled(enable: boolean): void; - - /** - * Update source content size to adjust PiP window aspect ratio. - * @param { number } width - Indicates the width of the content. - * @param { number } height - Indicates the height of the content. - * @throws { BusinessError } 401 - Params error, invalid width or height. - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - updateContentSize(width: number, height: number): void; - - /** - * Register picture-in-picture control event listener. - * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange' - * @param { function } callback - Used to handle {'stateChange'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; - - /** - * Unregister picture-in-picture lifecycle event listener. - * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - off(type: 'stateChange'): void; - - /** - * Register picture-in-picture control event listener. - * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' - * @param { function } callback - Used to handle {'controlPanelActionEvent'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - on(type: 'controlPanelActionEvent', callback: (event: PiPActionEventType) => void): void; - - /** - * Unregister picture-in-picture lifecycle event listener - * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - off(type: 'controlPanelActionEvent'): void; - } -} - -export default pipWindow; \ No newline at end of file From 37bb7ff7a00057af8886076e900cedb57b895ece Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Tue, 31 Oct 2023 14:37:10 +0800 Subject: [PATCH 12/15] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipWindow.d.ts | 335 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 api/@ohos.pipWindow.d.ts diff --git a/api/@ohos.pipWindow.d.ts b/api/@ohos.pipWindow.d.ts new file mode 100644 index 000000000..99d54c1de --- /dev/null +++ b/api/@ohos.pipWindow.d.ts @@ -0,0 +1,335 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type AsyncCallback from './@ohos.base'; +import type BaseContext from './application/BaseContext'; + +/** + * Picture In Picture Window Manager + * + * @namespace pipWindow + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ +declare namespace pipWindow { + /** + * If picture-in-picture enabled in current OS. + * + * @returns { boolean } true if PictureInPicture enabled, otherwise false + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function isPiPEnabled(): boolean; + + /** + * Create picture-in-picture controller + * + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PiPConfiguration): Promise; + + /** + * Create picture-in-picture controller + * + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation + * @param { AsyncCallback } callback - Callback used to return the PiPController created + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PiPConfiguration, callback: AsyncCallback): void; + + /** + * PiPConfiguration + * + * @interface PiPConfiguration + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PiPConfiguration { + /** + * Indicates window context. + * + * @type { BaseContext } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + context: BaseContext; + + /** + * Indicates the origin XComponentController. + * + * @type { XComponentController } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + componentController: XComponentController; + + /** + * Indicates navigation ID. + * + * @type { ?string } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + navigationId?: string; + + /** + * Picture-in-picture template type. + * + * @type { ?PiPTemplateType } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + templateType?: PiPTemplateType; + + /** + * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio. + * + * @type { ?number } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentWidth?: number; + + /** + * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio. + * + * @type { ?number } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentHeight?: number; + } + + /** + * Describe the type of picture-in-picture. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PiPTemplateType { + /** + * Indicates the content to show in picture-in-picture window is video play + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_PLAY, + + /** + * Indicates the content to show in picture-in-picture window is video call + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_CALL, + + /** + * Indicates the content to show in picture-in-picture window is video meeting + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_MEETING, + } + + /** + * Enum for PiP window callback event type. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PiPState { + /** + * PiP window is about to start. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_START = 1, + + /** + * PiP window started. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STARTED = 2, + + /** + * PiP window is about to stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_STOP = 3, + + /** + * PiP window stopped. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STOPPED = 4, + + /** + * Restore the original page from PiP window + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_RESTORE = 5, + + /** + * Error message during start/stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ERROR = 6, + } + + /** + * Describe picture-in-picture action event type. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent; + + type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; + + type PiPCallActionEvent = 'hangUp'; + + type PiPMeetingActionEvent = 'hangUp'; + + /** + * PiPController + * + * @interface PiPController + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PiPController { + + /** + * Start picture-in-picture + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPiP(): Promise; + + /** + * Start picture-in-picture + * @param { AsyncCallback } callback - Callback after PiP start finish + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPiP(callback: AsyncCallback): void; + + /** + * Stop picture-in-picture. + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPiP(): Promise; + + /** + * Stop picture-in-picture. + * @param { AsyncCallback } callback - Callback after PiP stop finish + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPiP(callback: AsyncCallback): void; + + /** + * Set if auto start picture-in-picture when back home + * @param { boolean } enable - Enable auto start picture-in-picture when back home + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + setAutoStartEnabled(enable: boolean): void; + + /** + * Update source content size to adjust PiP window aspect ratio. + * @param { number } width - Indicates the width of the content. + * @param { number } height - Indicates the height of the content. + * @throws { BusinessError } 401 - Params error, invalid width or height. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + updateContentSize(width: number, height: number): void; + + /** + * Register picture-in-picture control event listener. + * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange' + * @param { function } callback - Used to handle {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; + + /** + * Unregister picture-in-picture lifecycle event listener. + * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'stateChange'): void; + + /** + * Register picture-in-picture control event listener. + * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' + * @param { function } callback - Used to handle {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'controlPanelActionEvent', callback: (event: PiPActionEventType) => void): void; + + /** + * Unregister picture-in-picture lifecycle event listener + * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'controlPanelActionEvent'): void; + } +} + + + +export default pipWindow; \ No newline at end of file From c2290c591034007b947cb234e89f9fd1cb872943 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Tue, 31 Oct 2023 14:39:39 +0800 Subject: [PATCH 13/15] =?UTF-8?q?=E9=87=8D=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ning Yuanfeng --- api/@ohos.pipWindow.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/api/@ohos.pipWindow.d.ts b/api/@ohos.pipWindow.d.ts index 99d54c1de..74dec8c29 100644 --- a/api/@ohos.pipWindow.d.ts +++ b/api/@ohos.pipWindow.d.ts @@ -330,6 +330,4 @@ declare namespace pipWindow { } } - - export default pipWindow; \ No newline at end of file From 5b51c801c56cfa4fdc3f0aa6a5769421f175a42e Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Tue, 31 Oct 2023 14:49:06 +0800 Subject: [PATCH 14/15] rename Signed-off-by: Ning Yuanfeng --- api/@ohos.pipWindow.d.ts | 333 --------------------------------------- 1 file changed, 333 deletions(-) delete mode 100644 api/@ohos.pipWindow.d.ts diff --git a/api/@ohos.pipWindow.d.ts b/api/@ohos.pipWindow.d.ts deleted file mode 100644 index 74dec8c29..000000000 --- a/api/@ohos.pipWindow.d.ts +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright (c) 2023 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import type AsyncCallback from './@ohos.base'; -import type BaseContext from './application/BaseContext'; - -/** - * Picture In Picture Window Manager - * - * @namespace pipWindow - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ -declare namespace pipWindow { - /** - * If picture-in-picture enabled in current OS. - * - * @returns { boolean } true if PictureInPicture enabled, otherwise false - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - function isPiPEnabled(): boolean; - - /** - * Create picture-in-picture controller - * - * @param { PiPConfiguration } config - Params for picture-in-picture controller creation - * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration - * @throws { BusinessError } 801 - Capability not supported - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - function create(config: PiPConfiguration): Promise; - - /** - * Create picture-in-picture controller - * - * @param { PiPConfiguration } config - Params for picture-in-picture controller creation - * @param { AsyncCallback } callback - Callback used to return the PiPController created - * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration - * @throws { BusinessError } 801 - Capability not supported - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - function create(config: PiPConfiguration, callback: AsyncCallback): void; - - /** - * PiPConfiguration - * - * @interface PiPConfiguration - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - interface PiPConfiguration { - /** - * Indicates window context. - * - * @type { BaseContext } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - context: BaseContext; - - /** - * Indicates the origin XComponentController. - * - * @type { XComponentController } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - componentController: XComponentController; - - /** - * Indicates navigation ID. - * - * @type { ?string } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - navigationId?: string; - - /** - * Picture-in-picture template type. - * - * @type { ?PiPTemplateType } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - templateType?: PiPTemplateType; - - /** - * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio. - * - * @type { ?number } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - contentWidth?: number; - - /** - * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio. - * - * @type { ?number } - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - contentHeight?: number; - } - - /** - * Describe the type of picture-in-picture. - * - * @enum { number }. - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - enum PiPTemplateType { - /** - * Indicates the content to show in picture-in-picture window is video play - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - VIDEO_PLAY, - - /** - * Indicates the content to show in picture-in-picture window is video call - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - VIDEO_CALL, - - /** - * Indicates the content to show in picture-in-picture window is video meeting - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - VIDEO_MEETING, - } - - /** - * Enum for PiP window callback event type. - * - * @enum { number }. - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - enum PiPState { - /** - * PiP window is about to start. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ABOUT_TO_START = 1, - - /** - * PiP window started. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - STARTED = 2, - - /** - * PiP window is about to stop. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ABOUT_TO_STOP = 3, - - /** - * PiP window stopped. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - STOPPED = 4, - - /** - * Restore the original page from PiP window - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ABOUT_TO_RESTORE = 5, - - /** - * Error message during start/stop. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - ERROR = 6, - } - - /** - * Describe picture-in-picture action event type. - * - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent; - - type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; - - type PiPCallActionEvent = 'hangUp'; - - type PiPMeetingActionEvent = 'hangUp'; - - /** - * PiPController - * - * @interface PiPController - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - interface PiPController { - - /** - * Start picture-in-picture - * @returns { Promise } - The promise returned by the function - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300013 - Create PiP window failed. - * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window - * @throws { BusinessError } 1300015 - If window has created - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - startPiP(): Promise; - - /** - * Start picture-in-picture - * @param { AsyncCallback } callback - Callback after PiP start finish - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300013 - Create PiP window failed. - * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window - * @throws { BusinessError } 1300015 - If window has created - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - startPiP(callback: AsyncCallback): void; - - /** - * Stop picture-in-picture. - * @returns { Promise } - The promise returned by the function. - * @throws { BusinessError } 1300011 - Stop PiP window failed. - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300015 - If window is stopping - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - stopPiP(): Promise; - - /** - * Stop picture-in-picture. - * @param { AsyncCallback } callback - Callback after PiP stop finish - * @throws { BusinessError } 1300011 - Stop PiP window failed. - * @throws { BusinessError } 1300012 - If PiP window state is abnormal. - * @throws { BusinessError } 1300015 - If window is stopping - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - stopPiP(callback: AsyncCallback): void; - - /** - * Set if auto start picture-in-picture when back home - * @param { boolean } enable - Enable auto start picture-in-picture when back home - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - setAutoStartEnabled(enable: boolean): void; - - /** - * Update source content size to adjust PiP window aspect ratio. - * @param { number } width - Indicates the width of the content. - * @param { number } height - Indicates the height of the content. - * @throws { BusinessError } 401 - Params error, invalid width or height. - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - updateContentSize(width: number, height: number): void; - - /** - * Register picture-in-picture control event listener. - * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange' - * @param { function } callback - Used to handle {'stateChange'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; - - /** - * Unregister picture-in-picture lifecycle event listener. - * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - off(type: 'stateChange'): void; - - /** - * Register picture-in-picture control event listener. - * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' - * @param { function } callback - Used to handle {'controlPanelActionEvent'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - on(type: 'controlPanelActionEvent', callback: (event: PiPActionEventType) => void): void; - - /** - * Unregister picture-in-picture lifecycle event listener - * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command - * @syscap SystemCapability.Window.SessionManager - * @since 11 - */ - off(type: 'controlPanelActionEvent'): void; - } -} - -export default pipWindow; \ No newline at end of file From 802724a6155e8f7ba65c35bafbadfbde54cbdac7 Mon Sep 17 00:00:00 2001 From: Ning Yuanfeng Date: Tue, 31 Oct 2023 14:50:51 +0800 Subject: [PATCH 15/15] rename Signed-off-by: Ning Yuanfeng --- api/@ohos.PiPWindow.d.ts | 333 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 333 insertions(+) create mode 100644 api/@ohos.PiPWindow.d.ts diff --git a/api/@ohos.PiPWindow.d.ts b/api/@ohos.PiPWindow.d.ts new file mode 100644 index 000000000..77ec4a82e --- /dev/null +++ b/api/@ohos.PiPWindow.d.ts @@ -0,0 +1,333 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import type AsyncCallback from './@ohos.base'; +import type BaseContext from './application/BaseContext'; + +/** + * Picture In Picture Window Manager + * + * @namespace PiPWindow + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ +declare namespace PiPWindow { + /** + * If picture-in-picture enabled in current OS. + * + * @returns { boolean } true if PictureInPicture enabled, otherwise false + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function isPiPEnabled(): boolean; + + /** + * Create picture-in-picture controller + * + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PiPConfiguration): Promise; + + /** + * Create picture-in-picture controller + * + * @param { PiPConfiguration } config - Params for picture-in-picture controller creation + * @param { AsyncCallback } callback - Callback used to return the PiPController created + * @throws { BusinessError } 401 - Params error, invalid or illegal parameter in PiPConfiguration + * @throws { BusinessError } 801 - Capability not supported + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + function create(config: PiPConfiguration, callback: AsyncCallback): void; + + /** + * PiPConfiguration + * + * @interface PiPConfiguration + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PiPConfiguration { + /** + * Indicates window context. + * + * @type { BaseContext } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + context: BaseContext; + + /** + * Indicates the origin XComponentController. + * + * @type { XComponentController } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + componentController: XComponentController; + + /** + * Indicates navigation ID. + * + * @type { ?string } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + navigationId?: string; + + /** + * Picture-in-picture template type. + * + * @type { ?PiPTemplateType } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + templateType?: PiPTemplateType; + + /** + * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio. + * + * @type { ?number } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentWidth?: number; + + /** + * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio. + * + * @type { ?number } + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + contentHeight?: number; + } + + /** + * Describe the type of picture-in-picture. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PiPTemplateType { + /** + * Indicates the content to show in picture-in-picture window is video play + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_PLAY, + + /** + * Indicates the content to show in picture-in-picture window is video call + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_CALL, + + /** + * Indicates the content to show in picture-in-picture window is video meeting + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + VIDEO_MEETING, + } + + /** + * Enum for PiP window callback event type. + * + * @enum { number }. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + enum PiPState { + /** + * PiP window is about to start. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_START = 1, + + /** + * PiP window started. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STARTED = 2, + + /** + * PiP window is about to stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_STOP = 3, + + /** + * PiP window stopped. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + STOPPED = 4, + + /** + * Restore the original page from PiP window + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ABOUT_TO_RESTORE = 5, + + /** + * Error message during start/stop. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + ERROR = 6, + } + + /** + * Describe picture-in-picture action event type. + * + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent; + + type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo'; + + type PiPCallActionEvent = 'hangUp'; + + type PiPMeetingActionEvent = 'hangUp'; + + /** + * PiPController + * + * @interface PiPController + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + interface PiPController { + + /** + * Start picture-in-picture + * @returns { Promise } - The promise returned by the function + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPiP(): Promise; + + /** + * Start picture-in-picture + * @param { AsyncCallback } callback - Callback after PiP start finish + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300013 - Create PiP window failed. + * @throws { BusinessError } 1300014 - Error when load PiP window content or show PiP window + * @throws { BusinessError } 1300015 - If window has created + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + startPiP(callback: AsyncCallback): void; + + /** + * Stop picture-in-picture. + * @returns { Promise } - The promise returned by the function. + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPiP(): Promise; + + /** + * Stop picture-in-picture. + * @param { AsyncCallback } callback - Callback after PiP stop finish + * @throws { BusinessError } 1300011 - Stop PiP window failed. + * @throws { BusinessError } 1300012 - If PiP window state is abnormal. + * @throws { BusinessError } 1300015 - If window is stopping + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + stopPiP(callback: AsyncCallback): void; + + /** + * Set if auto start picture-in-picture when back home + * @param { boolean } enable - Enable auto start picture-in-picture when back home + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + setAutoStartEnabled(enable: boolean): void; + + /** + * Update source content size to adjust PiP window aspect ratio. + * @param { number } width - Indicates the width of the content. + * @param { number } height - Indicates the height of the content. + * @throws { BusinessError } 401 - Params error, invalid width or height. + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + updateContentSize(width: number, height: number): void; + + /** + * Register picture-in-picture control event listener. + * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange' + * @param { function } callback - Used to handle {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void; + + /** + * Unregister picture-in-picture lifecycle event listener. + * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'stateChange'): void; + + /** + * Register picture-in-picture control event listener. + * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent' + * @param { function } callback - Used to handle {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + on(type: 'controlPanelActionEvent', callback: (event: PiPActionEventType) => void): void; + + /** + * Unregister picture-in-picture lifecycle event listener + * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command + * @syscap SystemCapability.Window.SessionManager + * @since 11 + */ + off(type: 'controlPanelActionEvent'): void; + } +} + +export default PiPWindow; \ No newline at end of file