• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21import type BaseContext from './application/BaseContext';
22import type { Callback } from './@ohos.base';
23import { NodeController } from './arkui/NodeController';
24import { typeNode } from './arkui/FrameNode';
25
26/**
27 * Picture In Picture Window Manager
28 *
29 * @namespace PiPWindow
30 * @syscap SystemCapability.Window.SessionManager
31 * @since 11
32 */
33/**
34 * Picture In Picture Window Manager
35 *
36 * @namespace PiPWindow
37 * @syscap SystemCapability.Window.SessionManager
38 * @atomicservice
39 * @since 12
40 */
41declare namespace PiPWindow {
42  /**
43   * If picture-in-picture enabled in current OS.
44   *
45   * @returns { boolean } true if PictureInPicture enabled, otherwise false
46   * @syscap SystemCapability.Window.SessionManager
47   * @since 11
48   */
49  /**
50   * If picture-in-picture enabled in current OS.
51   *
52   * @returns { boolean } true if PictureInPicture enabled, otherwise false
53   * @syscap SystemCapability.Window.SessionManager
54   * @atomicservice
55   * @since 12
56   */
57  function isPiPEnabled(): boolean;
58
59  /**
60   * Create picture-in-picture controller
61   *
62   * @param { PiPConfiguration } config - Params for picture-in-picture controller creation. The config must be valid,
63   * the context and componentController in config should not be null. If templateType is specified, make sure
64   * it's type of PiPTemplateType. If controlGroups is specified, make sure it correspond to the templateType.
65   * @returns { Promise<PiPController> } - The promise returned by the function
66   * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
67   *                                                                2. Incorrect parameter types.
68   *                                                                3. Parameter verification failed
69   * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
70   * @syscap SystemCapability.Window.SessionManager
71   * @since 11
72   */
73  /**
74   * Create picture-in-picture controller
75   *
76   * @param { PiPConfiguration } config - Params for picture-in-picture controller creation. The config must be valid,
77   * the context and componentController in config should not be null. If templateType is specified, make sure
78   * it's type of PiPTemplateType. If controlGroups is specified, make sure it correspond to the templateType.
79   * @returns { Promise<PiPController> } - The promise returned by the function
80   * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
81   *                                                                2. Incorrect parameter types.
82   *                                                                3. Parameter verification failed
83   * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
84   * @syscap SystemCapability.Window.SessionManager
85   * @atomicservice
86   * @since 12
87   */
88  function create(config: PiPConfiguration): Promise<PiPController>;
89
90  /**
91   * Create picture-in-picture controller
92   *
93   * @param { PiPConfiguration } config - Params for picture-in-picture controller creation. The config must be valid,
94   * the context and componentController in config should not be null. If templateType is specified, make sure
95   * it's type of PiPTemplateType. If controlGroups is specified, make sure it correspond to the templateType.
96   * @param { typeNode.XComponent } contentNode - Params for picture-in-picture controller creation.
97   * Indicates the node which display the content of pip window.
98   * @returns { Promise<PiPController> } - The promise returned by the function
99   * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
100   *                                                                2. Incorrect parameter types.
101   *                                                                3. Parameter verification failed.
102   * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
103   * @syscap SystemCapability.Window.SessionManager
104   * @atomicservice
105   * @since 12
106   */
107  function create(config: PiPConfiguration, contentNode: typeNode.XComponent): Promise<PiPController>;
108
109  /**
110   * PiPConfiguration
111   *
112   * @interface PiPConfiguration
113   * @syscap SystemCapability.Window.SessionManager
114   * @since 11
115   */
116  /**
117   * PiPConfiguration
118   *
119   * @interface PiPConfiguration
120   * @syscap SystemCapability.Window.SessionManager
121   * @atomicservice
122   * @since 12
123   */
124  interface PiPConfiguration {
125    /**
126     * Indicates window context.
127     *
128     * @type { BaseContext }
129     * @syscap SystemCapability.Window.SessionManager
130     * @since 11
131     */
132    /**
133     * Indicates window context.
134     *
135     * @type { BaseContext }
136     * @syscap SystemCapability.Window.SessionManager
137     * @atomicservice
138     * @since 12
139     */
140    context: BaseContext;
141
142    /**
143     * Indicates the origin XComponentController.
144     *
145     * @type { XComponentController }
146     * @syscap SystemCapability.Window.SessionManager
147     * @since 11
148     */
149    /**
150     * Indicates the origin XComponentController.
151     *
152     * @type { XComponentController }
153     * @syscap SystemCapability.Window.SessionManager
154     * @atomicservice
155     * @since 12
156     */
157    componentController: XComponentController;
158
159    /**
160     * Indicates navigation ID.
161     *
162     * @type { ?string }
163     * @syscap SystemCapability.Window.SessionManager
164     * @since 11
165     */
166    /**
167     * Indicates navigation ID.
168     *
169     * @type { ?string }
170     * @syscap SystemCapability.Window.SessionManager
171     * @atomicservice
172     * @since 12
173     */
174    navigationId?: string;
175
176    /**
177     * Picture-in-picture template type.
178     *
179     * @type { ?PiPTemplateType }
180     * @syscap SystemCapability.Window.SessionManager
181     * @since 11
182     */
183    /**
184     * Picture-in-picture template type.
185     *
186     * @type { ?PiPTemplateType }
187     * @syscap SystemCapability.Window.SessionManager
188     * @atomicservice
189     * @since 12
190     */
191    templateType?: PiPTemplateType;
192
193    /**
194     * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio.
195     *
196     * @type { ?number }
197     * @syscap SystemCapability.Window.SessionManager
198     * @since 11
199     */
200    /**
201     * Describes the width of content to be displayed in PiP window. For adjusting PiP window aspect ratio.
202     *
203     * @type { ?number }
204     * @syscap SystemCapability.Window.SessionManager
205     * @atomicservice
206     * @since 12
207     */
208    contentWidth?: number;
209
210    /**
211     * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio.
212     *
213     * @type { ?number }
214     * @syscap SystemCapability.Window.SessionManager
215     * @since 11
216     */
217    /**
218     * Describes the height of content to be displayed in PiP window. For adjusting PiP window aspect ratio.
219     *
220     * @type { ?number }
221     * @syscap SystemCapability.Window.SessionManager
222     * @atomicservice
223     * @since 12
224     */
225    contentHeight?: number;
226
227    /**
228     * Describes the custom controls to be displayed in PiP window control panel. If the parameter is empty, only mandatory controls are displayed.
229     *
230     * @type { ?Array<PiPControlGroup> }
231     * @syscap SystemCapability.Window.SessionManager
232     * @atomicservice
233     * @since 12
234     */
235    controlGroups?: Array<PiPControlGroup>;
236
237    /**
238     * Describes the customUIController by which we can display a custom layout above pip content.
239     *
240     * @type { ?NodeController }
241     * @syscap SystemCapability.Window.SessionManager
242     * @atomicservice
243     * @since 12
244     */
245    customUIController?: NodeController;
246  }
247
248  /**
249   * Describe the type of picture-in-picture.
250   *
251   * @enum { number }.
252   * @syscap SystemCapability.Window.SessionManager
253   * @since 11
254   */
255  /**
256   * Describe the type of picture-in-picture.
257   *
258   * @enum { number }.
259   * @syscap SystemCapability.Window.SessionManager
260   * @atomicservice
261   * @since 12
262   */
263  enum PiPTemplateType {
264    /**
265     * Indicates the content to show in picture-in-picture window is video play
266     * @syscap SystemCapability.Window.SessionManager
267     * @since 11
268     */
269    /**
270     * Indicates the content to show in picture-in-picture window is video play
271     * @syscap SystemCapability.Window.SessionManager
272     * @atomicservice
273     * @since 12
274     */
275    VIDEO_PLAY,
276
277    /**
278     * Indicates the content to show in picture-in-picture window is video call
279     * @syscap SystemCapability.Window.SessionManager
280     * @since 11
281     */
282    /**
283     * Indicates the content to show in picture-in-picture window is video call
284     * @syscap SystemCapability.Window.SessionManager
285     * @atomicservice
286     * @since 12
287     */
288    VIDEO_CALL,
289
290    /**
291     * Indicates the content to show in picture-in-picture window is video meeting
292     * @syscap SystemCapability.Window.SessionManager
293     * @since 11
294     */
295    /**
296     * Indicates the content to show in picture-in-picture window is video meeting
297     * @syscap SystemCapability.Window.SessionManager
298     * @atomicservice
299     * @since 12
300     */
301    VIDEO_MEETING,
302
303    /**
304     * Indicates the content to show in picture-in-picture window is video live
305     * @syscap SystemCapability.Window.SessionManager
306     * @since 11
307     */
308    /**
309     * Indicates the content to show in picture-in-picture window is video live
310     * @syscap SystemCapability.Window.SessionManager
311     * @atomicservice
312     * @since 12
313     */
314    VIDEO_LIVE,
315  }
316
317  /**
318   * Enum for PiP window callback event type.
319   *
320   * @enum { number }.
321   * @syscap SystemCapability.Window.SessionManager
322   * @since 11
323   */
324  /**
325   * Enum for PiP window callback event type.
326   *
327   * @enum { number }.
328   * @syscap SystemCapability.Window.SessionManager
329   * @atomicservice
330   * @since 12
331   */
332  enum PiPState {
333    /**
334     * PiP window is about to start.
335     *
336     * @syscap SystemCapability.Window.SessionManager
337     * @since 11
338     */
339    /**
340     * PiP window is about to start.
341     *
342     * @syscap SystemCapability.Window.SessionManager
343     * @atomicservice
344     * @since 12
345     */
346    ABOUT_TO_START = 1,
347
348    /**
349     * PiP window started.
350     *
351     * @syscap SystemCapability.Window.SessionManager
352     * @since 11
353     */
354    /**
355     * PiP window started.
356     *
357     * @syscap SystemCapability.Window.SessionManager
358     * @atomicservice
359     * @since 12
360     */
361    STARTED = 2,
362
363    /**
364     * PiP window is about to stop.
365     *
366     * @syscap SystemCapability.Window.SessionManager
367     * @since 11
368     */
369    /**
370     * PiP window is about to stop.
371     *
372     * @syscap SystemCapability.Window.SessionManager
373     * @atomicservice
374     * @since 12
375     */
376    ABOUT_TO_STOP = 3,
377
378    /**
379     * PiP window stopped.
380     *
381     * @syscap SystemCapability.Window.SessionManager
382     * @since 11
383     */
384    /**
385     * PiP window stopped.
386     *
387     * @syscap SystemCapability.Window.SessionManager
388     * @atomicservice
389     * @since 12
390     */
391    STOPPED = 4,
392
393    /**
394     * Restore the original page from PiP window
395     *
396     * @syscap SystemCapability.Window.SessionManager
397     * @since 11
398     */
399    /**
400     * Restore the original page from PiP window
401     *
402     * @syscap SystemCapability.Window.SessionManager
403     * @atomicservice
404     * @since 12
405     */
406    ABOUT_TO_RESTORE = 5,
407
408    /**
409     * Error message during start/stop.
410     *
411     * @syscap SystemCapability.Window.SessionManager
412     * @since 11
413     */
414    /**
415     * Error message during start/stop.
416     *
417     * @syscap SystemCapability.Window.SessionManager
418     * @atomicservice
419     * @since 12
420     */
421    ERROR = 6,
422  }
423
424  /**
425   * Describe PiP window custom controls.
426   *
427   * @typedef { VideoPlayControlGroup | VideoCallControlGroup | VideoMeetingControlGroup | VideoLiveControlGroup }
428   * @syscap SystemCapability.Window.SessionManager
429   * @atomicservice
430   * @since 12
431   */
432  type PiPControlGroup = VideoPlayControlGroup | VideoCallControlGroup | VideoMeetingControlGroup | VideoLiveControlGroup;
433
434  /**
435   * Enum for video play PiP window custom controls.
436   *
437   * @enum { number }.
438   * @syscap SystemCapability.Window.SessionManager
439   * @atomicservice
440   * @since 12
441   */
442  enum VideoPlayControlGroup {
443    /**
444     * Previous/Next for video.
445     *
446     * @syscap SystemCapability.Window.SessionManager
447     * @atomicservice
448     * @since 12
449     */
450    VIDEO_PREVIOUS_NEXT = 101,
451
452    /**
453     * Forward/Backward for video.
454     *
455     * @syscap SystemCapability.Window.SessionManager
456     * @atomicservice
457     * @since 12
458     */
459    FAST_FORWARD_BACKWARD = 102,
460  }
461
462  /**
463   * Enum for video call PiP window custom controls.
464   *
465   * @enum { number }.
466   * @syscap SystemCapability.Window.SessionManager
467   * @atomicservice
468   * @since 12
469   */
470  enum VideoCallControlGroup {
471    /**
472     * Turn on/off the microphone.
473     *
474     * @syscap SystemCapability.Window.SessionManager
475     * @atomicservice
476     * @since 12
477     */
478    MICROPHONE_SWITCH = 201,
479
480    /**
481     * Hang up.
482     *
483     * @syscap SystemCapability.Window.SessionManager
484     * @atomicservice
485     * @since 12
486     */
487    HANG_UP_BUTTON = 202,
488
489    /**
490     * Turn on/off the camera
491     *
492     * @syscap SystemCapability.Window.SessionManager
493     * @atomicservice
494     * @since 12
495     */
496    CAMERA_SWITCH = 203,
497
498    /**
499     * Mute switch.
500     *
501     * @syscap SystemCapability.Window.SessionManager
502     * @atomicservice
503     * @since 12
504     */
505    MUTE_SWITCH = 204,
506  }
507
508  /**
509   * Enum for video meeting PiP window custom controls.
510   *
511   * @enum { number }.
512   * @syscap SystemCapability.Window.SessionManager
513   * @atomicservice
514   * @since 12
515   */
516  enum VideoMeetingControlGroup {
517    /**
518     * Hang up.
519     *
520     * @syscap SystemCapability.Window.SessionManager
521     * @atomicservice
522     * @since 12
523     */
524    HANG_UP_BUTTON = 301,
525
526    /**
527     * Turn on/off the camera
528     *
529     * @syscap SystemCapability.Window.SessionManager
530     * @atomicservice
531     * @since 12
532     */
533    CAMERA_SWITCH = 302,
534
535    /**
536     * Mute switch.
537     *
538     * @syscap SystemCapability.Window.SessionManager
539     * @atomicservice
540     * @since 12
541     */
542    MUTE_SWITCH = 303,
543
544    /**
545     * Turn on/off the microphone.
546     *
547     * @syscap SystemCapability.Window.SessionManager
548     * @atomicservice
549     * @since 12
550     */
551    MICROPHONE_SWITCH = 304,
552  }
553
554  /**
555   * Enum for video Live PiP window custom controls.
556   *
557   * @enum { number }.
558   * @syscap SystemCapability.Window.SessionManager
559   * @atomicservice
560   * @since 12
561   */
562  enum VideoLiveControlGroup {
563    /**
564     * Video play/pause control.
565     *
566     * @syscap SystemCapability.Window.SessionManager
567     * @atomicservice
568     * @since 12
569     */
570    VIDEO_PLAY_PAUSE = 401,
571
572    /**
573     * Mute switch.
574     *
575     * @syscap SystemCapability.Window.SessionManager
576     * @atomicservice
577     * @since 12
578     */
579    MUTE_SWITCH = 402,
580  }
581
582  /**
583   * Enum for control status.
584   *
585   * @enum { number }.
586   * @syscap SystemCapability.Window.SessionManager
587   * @atomicservice
588   * @since 12
589   */
590  enum PiPControlStatus {
591    /**
592     * The video is in play mode.
593     *
594     * @syscap SystemCapability.Window.SessionManager
595     * @atomicservice
596     * @since 12
597     */
598    PLAY = 1,
599
600    /**
601     * The video is in pause mode.
602     *
603     * @syscap SystemCapability.Window.SessionManager
604     * @atomicservice
605     * @since 12
606     */
607    PAUSE = 0,
608
609    /**
610     * A control with both open and closed states is in an open state.
611     *
612     * @syscap SystemCapability.Window.SessionManager
613     * @atomicservice
614     * @since 12
615     */
616    OPEN = 1,
617
618    /**
619     * A control with both open and closed states is in a close state.
620     *
621     * @syscap SystemCapability.Window.SessionManager
622     * @atomicservice
623     * @since 12
624     */
625    CLOSE = 0,
626  }
627
628  /**
629   * Enum for control type.
630   *
631   * @enum { number }.
632   * @syscap SystemCapability.Window.SessionManager
633   * @atomicservice
634   * @since 12
635   */
636  enum PiPControlType {
637    /**
638     * Video play/pause control.
639     *
640     * @syscap SystemCapability.Window.SessionManager
641     * @atomicservice
642     * @since 12
643     */
644    VIDEO_PLAY_PAUSE = 0,
645
646    /**
647     * Previous video control.
648     *
649     * @syscap SystemCapability.Window.SessionManager
650     * @atomicservice
651     * @since 12
652     */
653    VIDEO_PREVIOUS = 1,
654
655    /**
656     * Next video control.
657     *
658     * @syscap SystemCapability.Window.SessionManager
659     * @atomicservice
660     * @since 12
661     */
662    VIDEO_NEXT = 2,
663
664    /**
665     * Fast-forward control.
666     *
667     * @syscap SystemCapability.Window.SessionManager
668     * @atomicservice
669     * @since 12
670     */
671    FAST_FORWARD = 3,
672
673    /**
674     * Fast-backward control.
675     *
676     * @syscap SystemCapability.Window.SessionManager
677     * @atomicservice
678     * @since 12
679     */
680    FAST_BACKWARD = 4,
681
682    /**
683     * Hang-up control.
684     *
685     * @syscap SystemCapability.Window.SessionManager
686     * @atomicservice
687     * @since 12
688     */
689    HANG_UP_BUTTON = 5,
690
691    /**
692     * Microphone state switching control.
693     *
694     * @syscap SystemCapability.Window.SessionManager
695     * @atomicservice
696     * @since 12
697     */
698    MICROPHONE_SWITCH = 6,
699
700    /**
701     * Camera state switching control.
702     *
703     * @syscap SystemCapability.Window.SessionManager
704     * @atomicservice
705     * @since 12
706     */
707    CAMERA_SWITCH = 7,
708
709    /**
710     * Mute state switching control.
711     *
712     * @syscap SystemCapability.Window.SessionManager
713     * @atomicservice
714     * @since 12
715     */
716    MUTE_SWITCH = 8,
717  }
718
719
720  /**
721   * Describe picture-in-picture action event type.
722   *
723   * @typedef { PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent }
724   * @syscap SystemCapability.Window.SessionManager
725   * @since 11
726   */
727  /**
728   * Describe picture-in-picture action event type.
729   *
730   * @typedef { PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent }
731   * @syscap SystemCapability.Window.SessionManager
732   * @atomicservice
733   * @since 12
734   */
735  type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent;
736
737  /**
738   * Describe picture-in-picture video template action event type.
739   *
740   * @typedef { 'playbackStateChanged' | 'nextVideo' | 'previousVideo' }
741   * @syscap SystemCapability.Window.SessionManager
742   * @since 11
743   */
744  /**
745   * Describe picture-in-picture video template action event type.
746   *
747   * @typedef { 'playbackStateChanged' | 'nextVideo' | 'previousVideo' | 'fastForward' | 'fastBackward' }
748   * @syscap SystemCapability.Window.SessionManager
749   * @atomicservice
750   * @since 12
751   */
752  type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo' | 'fastForward' | 'fastBackward';
753
754  /**
755   * Describe picture-in-picture call template action event type.
756   *
757   * @typedef { 'hangUp' | 'micStateChanged' | 'videoStateChanged' }
758   * @syscap SystemCapability.Window.SessionManager
759   * @since 11
760   */
761  /**
762   * Describe picture-in-picture call template action event type.
763   *
764   * @typedef { 'hangUp' | 'micStateChanged' | 'videoStateChanged' | 'voiceStateChanged' }
765   * @syscap SystemCapability.Window.SessionManager
766   * @atomicservice
767   * @since 12
768   */
769  type PiPCallActionEvent = 'hangUp' | 'micStateChanged' | 'videoStateChanged' | 'voiceStateChanged';
770
771  /**
772   * Describe picture-in-picture meeting template action event type.
773   *
774   * @typedef { 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' }
775   * @syscap SystemCapability.Window.SessionManager
776   * @since 11
777   */
778  /**
779   * Describe picture-in-picture meeting template action event type.
780   *
781   * @typedef { 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' | 'micStateChanged' }
782   * @syscap SystemCapability.Window.SessionManager
783   * @atomicservice
784   * @since 12
785   */
786  type PiPMeetingActionEvent = 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' | 'micStateChanged';
787
788  /**
789   * Describe picture-in-picture live template action event type.
790   *
791   * @typedef { 'playbackStateChanged' }
792   * @syscap SystemCapability.Window.SessionManager
793   * @since 11
794   */
795  /**
796   * Describe picture-in-picture live template action event type.
797   *
798   * @typedef { 'playbackStateChanged' | 'voiceStateChanged' }
799   * @syscap SystemCapability.Window.SessionManager
800   * @atomicservice
801   * @since 12
802   */
803  type PiPLiveActionEvent = 'playbackStateChanged' | 'voiceStateChanged';
804
805  /**
806   * Describe picture-in-picture control panel action event callback.
807   *
808   * @typedef { function } ControlPanelActionEventCallback
809   * @param { PiPActionEventType } event - the event from controlPanel
810   * @param { number } [status] - the status of control button
811   * @syscap SystemCapability.Window.SessionManager
812   * @atomicservice
813   * @since 12
814   */
815  type ControlPanelActionEventCallback = (event: PiPActionEventType, status?: number) => void;
816
817  /**
818   * Describe picture-in-picture control event callback.
819   *
820   * @interface ControlEventParam
821   * @syscap SystemCapability.Window.SessionManager
822   * @atomicservice
823   * @since 12
824   */
825  interface ControlEventParam {
826    /**
827     * The type of control.
828     *
829     * @type { PiPControlType }
830     * @syscap SystemCapability.Window.SessionManager
831     * @atomicservice
832     * @since 12
833     */
834    controlType: PiPControlType;
835
836    /**
837     * The status of control.
838     *
839     * @type { ?PiPControlStatus }
840     * @syscap SystemCapability.Window.SessionManager
841     * @atomicservice
842     * @since 12
843     */
844    status?: PiPControlStatus;
845  }
846
847  /**
848   * PiPController
849   *
850   * @interface PiPController
851   * @syscap SystemCapability.Window.SessionManager
852   * @since 11
853   */
854  /**
855   * PiPController
856   *
857   * @interface PiPController
858   * @syscap SystemCapability.Window.SessionManager
859   * @atomicservice
860   * @since 12
861   */
862  interface PiPController {
863
864    /**
865     * Start picture-in-picture
866     * @returns { Promise<void> } - The promise returned by the function
867     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
868     * @throws { BusinessError } 1300013 - Failed to create the PiP window.
869     * @throws { BusinessError } 1300014 - PiP internal error.
870     * @throws { BusinessError } 1300015 - Repeated PiP operation.
871     * @syscap SystemCapability.Window.SessionManager
872     * @since 11
873     */
874    /**
875     * Start picture-in-picture
876     * @returns { Promise<void> } - The promise returned by the function
877     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
878     * @throws { BusinessError } 1300013 - Failed to create the PiP window.
879     * @throws { BusinessError } 1300014 - PiP internal error.
880     * @throws { BusinessError } 1300015 - Repeated PiP operation.
881     * @syscap SystemCapability.Window.SessionManager
882     * @atomicservice
883     * @since 12
884     */
885    startPiP(): Promise<void>;
886
887    /**
888     * Stop picture-in-picture.
889     * @returns { Promise<void> } - The promise returned by the function.
890     * @throws { BusinessError } 1300011 - Failed to destroy the PiP window.
891     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
892     * @throws { BusinessError } 1300015 - Repeated PiP operation.
893     * @syscap SystemCapability.Window.SessionManager
894     * @since 11
895     */
896    /**
897     * Stop picture-in-picture.
898     * @returns { Promise<void> } - The promise returned by the function.
899     * @throws { BusinessError } 1300011 - Failed to destroy the PiP window.
900     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
901     * @throws { BusinessError } 1300015 - Repeated PiP operation.
902     * @syscap SystemCapability.Window.SessionManager
903     * @atomicservice
904     * @since 12
905     */
906    stopPiP(): Promise<void>;
907
908    /**
909     * Set if auto start picture-in-picture when back home
910     * @param { boolean } enable - Enable auto start picture-in-picture when back home
911     * @syscap SystemCapability.Window.SessionManager
912     * @since 11
913     */
914    /**
915     * Set if auto start picture-in-picture when back home
916     * @param { boolean } enable - Enable auto start picture-in-picture when back home
917     * @syscap SystemCapability.Window.SessionManager
918     * @atomicservice
919     * @since 12
920     */
921    setAutoStartEnabled(enable: boolean): void;
922
923    /**
924     * Update source content size to adjust PiP window aspect ratio.
925     * @param { number } width - Indicate the width of the content. The width can consist of only digits and above 0.
926     * @param { number } height - Indicate the height of the content. The height can consist of only digits and above 0.
927     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
928     *                                                                2. Incorrect parameter types.
929     * @syscap SystemCapability.Window.SessionManager
930     * @since 11
931     */
932    /**
933     * Update source content size to adjust PiP window aspect ratio.
934     * @param { number } width - Indicate the width of the content. The width can consist of only digits and above 0.
935     * @param { number } height - Indicate the height of the content. The height can consist of only digits and above 0.
936     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
937     *                                                                2. Incorrect parameter types.
938     * @syscap SystemCapability.Window.SessionManager
939     * @atomicservice
940     * @since 12
941     */
942    updateContentSize(width: number, height: number): void;
943
944    /**
945     * Set dashboard control status.
946     * @param { PiPControlType } controlType - Describe picture-in-picture control type.
947     * @param { PiPControlStatus } status - Describe picture-in-picture control Status.
948     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
949     *                                                                2. Incorrect parameter types.
950     *                                                                3. Parameter verification failed
951     * @syscap SystemCapability.Window.SessionManager
952     * @atomicservice
953     * @since 12
954     */
955    updatePiPControlStatus(controlType: PiPControlType, status: PiPControlStatus): void;
956
957    /**
958     * Set Dashboard control enable status.
959     * @param { PiPControlType } controlType - Describe picture-in-picture control type.
960     * @param { boolean } enabled - Describe picture-in-picture control enable Status.
961     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
962     *                                                                2. Incorrect parameter types.
963     *                                                                3. Parameter verification failed
964     * @syscap SystemCapability.Window.SessionManager
965     * @atomicservice
966     * @since 12
967     */
968    setPiPControlEnabled(controlType: PiPControlType, enabled: boolean): void;
969
970    /**
971     * Register picture-in-picture control event listener.
972     * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange'
973     * @param { function } callback - Used to handle {'stateChange'} command
974     * @syscap SystemCapability.Window.SessionManager
975     * @since 11
976     */
977    /**
978     * Register picture-in-picture control event listener.
979     * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange'
980     * @param { function } callback - Used to handle {'stateChange'} command
981     * @syscap SystemCapability.Window.SessionManager
982     * @atomicservice
983     * @since 12
984     */
985    on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void;
986
987    /**
988     * Unregister picture-in-picture lifecycle event listener.
989     * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command
990     * @syscap SystemCapability.Window.SessionManager
991     * @since 11
992     */
993    /**
994     * Unregister picture-in-picture lifecycle event listener.
995     * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command
996     * @syscap SystemCapability.Window.SessionManager
997     * @atomicservice
998     * @since 12
999     */
1000    off(type: 'stateChange'): void;
1001
1002    /**
1003     * Register picture-in-picture control event listener.
1004     * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent'
1005     * @param { function } callback - Used to handle {'controlPanelActionEvent'} command
1006     * @syscap SystemCapability.Window.SessionManager
1007     * @since 11
1008     */
1009    /**
1010     * Register picture-in-picture control event listener.
1011     *
1012     * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent'
1013     * @param { ControlPanelActionEventCallback } callback - Used to handle {'controlPanelActionEvent'} command.
1014     * @syscap SystemCapability.Window.SessionManager
1015     * @atomicservice
1016     * @since 12
1017     */
1018    on(type: 'controlPanelActionEvent', callback: ControlPanelActionEventCallback): void;
1019
1020    /**
1021     * Unregister picture-in-picture lifecycle event listener
1022     * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command
1023     * @syscap SystemCapability.Window.SessionManager
1024     * @since 11
1025     */
1026    /**
1027     * Unregister picture-in-picture lifecycle event listener
1028     * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command
1029     * @syscap SystemCapability.Window.SessionManager
1030     * @atomicservice
1031     * @since 12
1032     */
1033    off(type: 'controlPanelActionEvent'): void;
1034
1035    /**
1036     * Register picture-in-picture control event listener.
1037     *
1038     * @param { 'controlEvent' } type - Registration type, user action event, 'controlEvent'
1039     * @param { Callback<ControlEventParam> } callback - Used to handle {'controlEvent'} command.
1040     * @syscap SystemCapability.Window.SessionManager
1041     * @atomicservice
1042     * @since 12
1043     */
1044    on(type: 'controlEvent', callback: Callback<ControlEventParam>): void;
1045
1046    /**
1047     * Unregister picture-in-picture control event listener
1048     * @param { 'controlEvent' } type - Used to unregister listener for {'controlEvent'} command
1049     * @param { Callback<ControlEventParam> } callback - Used to handle {'controlEvent'} command.
1050     * @syscap SystemCapability.Window.SessionManager
1051     * @atomicservice
1052     * @since 12
1053     */
1054    off(type: 'controlEvent', callback?: Callback<ControlEventParam>): void;
1055  }
1056}
1057
1058export default PiPWindow;