• 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     * Describes the data object shared within the content instance loaded by the window.
249     *
250     * @type { ?LocalStorage }
251     * @syscap SystemCapability.Window.SessionManager
252     * @atomicservice
253     * @since 17
254     */
255    localStorage?: LocalStorage;
256
257    /**
258     * Describes the default picture-in-picture window size as it is started.
259     * 0: not set. 1: small size. 2: large size.
260     *
261     * @type { ?number }
262     * @syscap SystemCapability.Window.SessionManager
263     * @atomicservice
264     * @since 19
265     */
266     defaultWindowSizeType?: number;
267  }
268
269  /**
270   * The picture-in-picture window size
271   *
272   * @interface PiPWindowSize
273   * @syscap SystemCapability.Window.SessionManager
274   * @atomicservice
275   * @since 15
276   */
277   interface PiPWindowSize {
278    /**
279     * The width of the picture-in-picture window.
280     *
281     * @type { number }
282     * @syscap SystemCapability.Window.SessionManager
283     * @atomicservice
284     * @since 15
285     */
286    width: number;
287
288    /**
289     * The height of the picture-in-picture window.
290     *
291     * @type { number }
292     * @syscap SystemCapability.Window.SessionManager
293     * @atomicservice
294     * @since 15
295     */
296    height: number;
297
298    /**
299     * The scale of the picture-in-picture window.
300     *
301     * @type { number }
302     * @syscap SystemCapability.Window.SessionManager
303     * @atomicservice
304     * @since 15
305     */
306    scale: number;
307  }
308
309  /**
310   * The info of picture-in-picture window
311   *
312   * @interface PiPWindowInfo
313   * @syscap SystemCapability.Window.SessionManager
314   * @atomicservice
315   * @since 15
316   */
317  interface PiPWindowInfo {
318    /**
319     * Indicates target window id.
320     *
321     * @type { number }
322     * @syscap SystemCapability.Window.SessionManager
323     * @atomicservice
324     * @since 15
325     */
326    windowId: number;
327
328    /**
329     * The picture-in-picture window size.
330     *
331     * @type { PiPWindowSize }
332     * @syscap SystemCapability.Window.SessionManager
333     * @atomicservice
334     * @since 15
335     */
336    size: PiPWindowSize;
337  }
338
339  /**
340   * Describe the type of picture-in-picture.
341   *
342   * @enum { number }.
343   * @syscap SystemCapability.Window.SessionManager
344   * @since 11
345   */
346  /**
347   * Describe the type of picture-in-picture.
348   *
349   * @enum { number }.
350   * @syscap SystemCapability.Window.SessionManager
351   * @atomicservice
352   * @since 12
353   */
354  enum PiPTemplateType {
355    /**
356     * Indicates the content to show in picture-in-picture window is video play
357     * @syscap SystemCapability.Window.SessionManager
358     * @since 11
359     */
360    /**
361     * Indicates the content to show in picture-in-picture window is video play
362     * @syscap SystemCapability.Window.SessionManager
363     * @atomicservice
364     * @since 12
365     */
366    VIDEO_PLAY,
367
368    /**
369     * Indicates the content to show in picture-in-picture window is video call
370     * @syscap SystemCapability.Window.SessionManager
371     * @since 11
372     */
373    /**
374     * Indicates the content to show in picture-in-picture window is video call
375     * @syscap SystemCapability.Window.SessionManager
376     * @atomicservice
377     * @since 12
378     */
379    VIDEO_CALL,
380
381    /**
382     * Indicates the content to show in picture-in-picture window is video meeting
383     * @syscap SystemCapability.Window.SessionManager
384     * @since 11
385     */
386    /**
387     * Indicates the content to show in picture-in-picture window is video meeting
388     * @syscap SystemCapability.Window.SessionManager
389     * @atomicservice
390     * @since 12
391     */
392    VIDEO_MEETING,
393
394    /**
395     * Indicates the content to show in picture-in-picture window is video live
396     * @syscap SystemCapability.Window.SessionManager
397     * @since 11
398     */
399    /**
400     * Indicates the content to show in picture-in-picture window is video live
401     * @syscap SystemCapability.Window.SessionManager
402     * @atomicservice
403     * @since 12
404     */
405    VIDEO_LIVE,
406  }
407
408  /**
409   * Enum for PiP window callback event type.
410   *
411   * @enum { number }.
412   * @syscap SystemCapability.Window.SessionManager
413   * @since 11
414   */
415  /**
416   * Enum for PiP window callback event type.
417   *
418   * @enum { number }.
419   * @syscap SystemCapability.Window.SessionManager
420   * @atomicservice
421   * @since 12
422   */
423  enum PiPState {
424    /**
425     * PiP window is about to start.
426     *
427     * @syscap SystemCapability.Window.SessionManager
428     * @since 11
429     */
430    /**
431     * PiP window is about to start.
432     *
433     * @syscap SystemCapability.Window.SessionManager
434     * @atomicservice
435     * @since 12
436     */
437    ABOUT_TO_START = 1,
438
439    /**
440     * PiP window started.
441     *
442     * @syscap SystemCapability.Window.SessionManager
443     * @since 11
444     */
445    /**
446     * PiP window started.
447     *
448     * @syscap SystemCapability.Window.SessionManager
449     * @atomicservice
450     * @since 12
451     */
452    STARTED = 2,
453
454    /**
455     * PiP window is about to stop.
456     *
457     * @syscap SystemCapability.Window.SessionManager
458     * @since 11
459     */
460    /**
461     * PiP window is about to stop.
462     *
463     * @syscap SystemCapability.Window.SessionManager
464     * @atomicservice
465     * @since 12
466     */
467    ABOUT_TO_STOP = 3,
468
469    /**
470     * PiP window stopped.
471     *
472     * @syscap SystemCapability.Window.SessionManager
473     * @since 11
474     */
475    /**
476     * PiP window stopped.
477     *
478     * @syscap SystemCapability.Window.SessionManager
479     * @atomicservice
480     * @since 12
481     */
482    STOPPED = 4,
483
484    /**
485     * Restore the original page from PiP window
486     *
487     * @syscap SystemCapability.Window.SessionManager
488     * @since 11
489     */
490    /**
491     * Restore the original page from PiP window
492     *
493     * @syscap SystemCapability.Window.SessionManager
494     * @atomicservice
495     * @since 12
496     */
497    ABOUT_TO_RESTORE = 5,
498
499    /**
500     * Error occurs during the lifecycle of PiP window.
501     *
502     * @syscap SystemCapability.Window.SessionManager
503     * @since 11
504     */
505    /**
506     * Error occurs during the lifecycle of PiP window.
507     *
508     * @syscap SystemCapability.Window.SessionManager
509     * @atomicservice
510     * @since 12
511     */
512    ERROR = 6,
513  }
514
515  /**
516   * Describe optional component groups of PiP window.
517   *
518   * @typedef { VideoPlayControlGroup | VideoCallControlGroup | VideoMeetingControlGroup | VideoLiveControlGroup }
519   * @syscap SystemCapability.Window.SessionManager
520   * @atomicservice
521   * @since 12
522   */
523  type PiPControlGroup = VideoPlayControlGroup | VideoCallControlGroup | VideoMeetingControlGroup | VideoLiveControlGroup;
524
525  /**
526   * Enum for video play component groups of PiP window.
527   *
528   * @enum { number }.
529   * @syscap SystemCapability.Window.SessionManager
530   * @atomicservice
531   * @since 12
532   */
533  enum VideoPlayControlGroup {
534    /**
535     * Previous/Next for video.
536     *
537     * @syscap SystemCapability.Window.SessionManager
538     * @atomicservice
539     * @since 12
540     */
541    VIDEO_PREVIOUS_NEXT = 101,
542
543    /**
544     * Forward/Backward for video.
545     *
546     * @syscap SystemCapability.Window.SessionManager
547     * @atomicservice
548     * @since 12
549     */
550    FAST_FORWARD_BACKWARD = 102,
551  }
552
553  /**
554   * Enum for video call component groups of PiP window.
555   *
556   * @enum { number }.
557   * @syscap SystemCapability.Window.SessionManager
558   * @atomicservice
559   * @since 12
560   */
561  enum VideoCallControlGroup {
562    /**
563     * Turn on/off the microphone.
564     *
565     * @syscap SystemCapability.Window.SessionManager
566     * @atomicservice
567     * @since 12
568     */
569    MICROPHONE_SWITCH = 201,
570
571    /**
572     * Hang up.
573     *
574     * @syscap SystemCapability.Window.SessionManager
575     * @atomicservice
576     * @since 12
577     */
578    HANG_UP_BUTTON = 202,
579
580    /**
581     * Turn on/off the camera
582     *
583     * @syscap SystemCapability.Window.SessionManager
584     * @atomicservice
585     * @since 12
586     */
587    CAMERA_SWITCH = 203,
588
589    /**
590     * Mute switch.
591     *
592     * @syscap SystemCapability.Window.SessionManager
593     * @atomicservice
594     * @since 12
595     */
596    MUTE_SWITCH = 204,
597  }
598
599  /**
600   * Enum for video meeting component groups of PiP window.
601   *
602   * @enum { number }.
603   * @syscap SystemCapability.Window.SessionManager
604   * @atomicservice
605   * @since 12
606   */
607  enum VideoMeetingControlGroup {
608    /**
609     * Hang up.
610     *
611     * @syscap SystemCapability.Window.SessionManager
612     * @atomicservice
613     * @since 12
614     */
615    HANG_UP_BUTTON = 301,
616
617    /**
618     * Turn on/off the camera
619     *
620     * @syscap SystemCapability.Window.SessionManager
621     * @atomicservice
622     * @since 12
623     */
624    CAMERA_SWITCH = 302,
625
626    /**
627     * Mute switch.
628     *
629     * @syscap SystemCapability.Window.SessionManager
630     * @atomicservice
631     * @since 12
632     */
633    MUTE_SWITCH = 303,
634
635    /**
636     * Turn on/off the microphone.
637     *
638     * @syscap SystemCapability.Window.SessionManager
639     * @atomicservice
640     * @since 12
641     */
642    MICROPHONE_SWITCH = 304,
643  }
644
645  /**
646   * Enum for video Live component groups of PiP window.
647   *
648   * @enum { number }.
649   * @syscap SystemCapability.Window.SessionManager
650   * @atomicservice
651   * @since 12
652   */
653  enum VideoLiveControlGroup {
654    /**
655     * Video play/pause control.
656     *
657     * @syscap SystemCapability.Window.SessionManager
658     * @atomicservice
659     * @since 12
660     */
661    VIDEO_PLAY_PAUSE = 401,
662
663    /**
664     * Mute switch.
665     *
666     * @syscap SystemCapability.Window.SessionManager
667     * @atomicservice
668     * @since 12
669     */
670    MUTE_SWITCH = 402,
671  }
672
673  /**
674   * Enum for control status.
675   *
676   * @enum { number }.
677   * @syscap SystemCapability.Window.SessionManager
678   * @atomicservice
679   * @since 12
680   */
681  enum PiPControlStatus {
682    /**
683     * The video is in play mode.
684     *
685     * @syscap SystemCapability.Window.SessionManager
686     * @atomicservice
687     * @since 12
688     */
689    PLAY = 1,
690
691    /**
692     * The video is in pause mode.
693     *
694     * @syscap SystemCapability.Window.SessionManager
695     * @atomicservice
696     * @since 12
697     */
698    PAUSE = 0,
699
700    /**
701     * A control with both open and closed states is in an open state.
702     *
703     * @syscap SystemCapability.Window.SessionManager
704     * @atomicservice
705     * @since 12
706     */
707    OPEN = 1,
708
709    /**
710     * A control with both open and closed states is in a close state.
711     *
712     * @syscap SystemCapability.Window.SessionManager
713     * @atomicservice
714     * @since 12
715     */
716    CLOSE = 0,
717  }
718
719  /**
720   * Enum for control type.
721   *
722   * @enum { number }.
723   * @syscap SystemCapability.Window.SessionManager
724   * @atomicservice
725   * @since 12
726   */
727  enum PiPControlType {
728    /**
729     * Video play/pause control.
730     *
731     * @syscap SystemCapability.Window.SessionManager
732     * @atomicservice
733     * @since 12
734     */
735    VIDEO_PLAY_PAUSE = 0,
736
737    /**
738     * Previous video control.
739     *
740     * @syscap SystemCapability.Window.SessionManager
741     * @atomicservice
742     * @since 12
743     */
744    VIDEO_PREVIOUS = 1,
745
746    /**
747     * Next video control.
748     *
749     * @syscap SystemCapability.Window.SessionManager
750     * @atomicservice
751     * @since 12
752     */
753    VIDEO_NEXT = 2,
754
755    /**
756     * Fast-forward control.
757     *
758     * @syscap SystemCapability.Window.SessionManager
759     * @atomicservice
760     * @since 12
761     */
762    FAST_FORWARD = 3,
763
764    /**
765     * Fast-backward control.
766     *
767     * @syscap SystemCapability.Window.SessionManager
768     * @atomicservice
769     * @since 12
770     */
771    FAST_BACKWARD = 4,
772
773    /**
774     * Hang-up control.
775     *
776     * @syscap SystemCapability.Window.SessionManager
777     * @atomicservice
778     * @since 12
779     */
780    HANG_UP_BUTTON = 5,
781
782    /**
783     * Microphone state switching control.
784     *
785     * @syscap SystemCapability.Window.SessionManager
786     * @atomicservice
787     * @since 12
788     */
789    MICROPHONE_SWITCH = 6,
790
791    /**
792     * Camera state switching control.
793     *
794     * @syscap SystemCapability.Window.SessionManager
795     * @atomicservice
796     * @since 12
797     */
798    CAMERA_SWITCH = 7,
799
800    /**
801     * Mute state switching control.
802     *
803     * @syscap SystemCapability.Window.SessionManager
804     * @atomicservice
805     * @since 12
806     */
807    MUTE_SWITCH = 8,
808  }
809
810
811  /**
812   * Describe picture-in-picture action event type.
813   *
814   * @typedef { PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent }
815   * @syscap SystemCapability.Window.SessionManager
816   * @since 11
817   */
818  /**
819   * Describe picture-in-picture action event type.
820   *
821   * @typedef { PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent }
822   * @syscap SystemCapability.Window.SessionManager
823   * @atomicservice
824   * @since 12
825   */
826  type PiPActionEventType = PiPVideoActionEvent | PiPCallActionEvent | PiPMeetingActionEvent | PiPLiveActionEvent;
827
828  /**
829   * Describe picture-in-picture video template action event type.
830   *
831   * @typedef { 'playbackStateChanged' | 'nextVideo' | 'previousVideo' }
832   * @syscap SystemCapability.Window.SessionManager
833   * @since 11
834   */
835  /**
836   * Describe picture-in-picture video template action event type.
837   *
838   * @typedef { 'playbackStateChanged' | 'nextVideo' | 'previousVideo' | 'fastForward' | 'fastBackward' }
839   * @syscap SystemCapability.Window.SessionManager
840   * @atomicservice
841   * @since 12
842   */
843  type PiPVideoActionEvent = 'playbackStateChanged' | 'nextVideo' | 'previousVideo' | 'fastForward' | 'fastBackward';
844
845  /**
846   * Describe picture-in-picture call template action event type.
847   *
848   * @typedef { 'hangUp' | 'micStateChanged' | 'videoStateChanged' }
849   * @syscap SystemCapability.Window.SessionManager
850   * @since 11
851   */
852  /**
853   * Describe picture-in-picture call template action event type.
854   *
855   * @typedef { 'hangUp' | 'micStateChanged' | 'videoStateChanged' | 'voiceStateChanged' }
856   * @syscap SystemCapability.Window.SessionManager
857   * @atomicservice
858   * @since 12
859   */
860  type PiPCallActionEvent = 'hangUp' | 'micStateChanged' | 'videoStateChanged' | 'voiceStateChanged';
861
862  /**
863   * Describe picture-in-picture meeting template action event type.
864   *
865   * @typedef { 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' }
866   * @syscap SystemCapability.Window.SessionManager
867   * @since 11
868   */
869  /**
870   * Describe picture-in-picture meeting template action event type.
871   *
872   * @typedef { 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' | 'micStateChanged' }
873   * @syscap SystemCapability.Window.SessionManager
874   * @atomicservice
875   * @since 12
876   */
877  type PiPMeetingActionEvent = 'hangUp' | 'voiceStateChanged' | 'videoStateChanged' | 'micStateChanged';
878
879  /**
880   * Describe picture-in-picture live template action event type.
881   *
882   * @typedef { 'playbackStateChanged' }
883   * @syscap SystemCapability.Window.SessionManager
884   * @since 11
885   */
886  /**
887   * Describe picture-in-picture live template action event type.
888   *
889   * @typedef { 'playbackStateChanged' | 'voiceStateChanged' }
890   * @syscap SystemCapability.Window.SessionManager
891   * @atomicservice
892   * @since 12
893   */
894  type PiPLiveActionEvent = 'playbackStateChanged' | 'voiceStateChanged';
895
896  /**
897   * Describe picture-in-picture control panel action event callback.
898   *
899   * @typedef { function } ControlPanelActionEventCallback
900   * @param { PiPActionEventType } event - the event from controlPanel
901   * @param { number } [status] - the status of control button
902   * @syscap SystemCapability.Window.SessionManager
903   * @atomicservice
904   * @since 12
905   */
906  type ControlPanelActionEventCallback = (event: PiPActionEventType, status?: number) => void;
907
908  /**
909   * Describe picture-in-picture control event callback.
910   *
911   * @interface ControlEventParam
912   * @syscap SystemCapability.Window.SessionManager
913   * @atomicservice
914   * @since 12
915   */
916  interface ControlEventParam {
917    /**
918     * The type of control.
919     *
920     * @type { PiPControlType }
921     * @syscap SystemCapability.Window.SessionManager
922     * @atomicservice
923     * @since 12
924     */
925    controlType: PiPControlType;
926
927    /**
928     * The status of control.
929     *
930     * @type { ?PiPControlStatus }
931     * @syscap SystemCapability.Window.SessionManager
932     * @atomicservice
933     * @since 12
934     */
935    status?: PiPControlStatus;
936  }
937
938  /**
939   * PiPController
940   *
941   * @interface PiPController
942   * @syscap SystemCapability.Window.SessionManager
943   * @since 11
944   */
945  /**
946   * PiPController
947   *
948   * @interface PiPController
949   * @syscap SystemCapability.Window.SessionManager
950   * @atomicservice
951   * @since 12
952   */
953  interface PiPController {
954
955    /**
956     * Start picture-in-picture
957     * @returns { Promise<void> } - The promise returned by the function
958     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
959     * @throws { BusinessError } 1300013 - Failed to create the PiP window.
960     * @throws { BusinessError } 1300014 - PiP internal error.
961     * @throws { BusinessError } 1300015 - Repeated PiP operation.
962     * @syscap SystemCapability.Window.SessionManager
963     * @since 11
964     */
965    /**
966     * Start picture-in-picture
967     * @returns { Promise<void> } - The promise returned by the function
968     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
969     * @throws { BusinessError } 1300013 - Failed to create the PiP window.
970     * @throws { BusinessError } 1300014 - PiP internal error.
971     * @throws { BusinessError } 1300015 - Repeated PiP operation.
972     * @syscap SystemCapability.Window.SessionManager
973     * @atomicservice
974     * @since 12
975     */
976    startPiP(): Promise<void>;
977
978    /**
979     * Stop picture-in-picture.
980     * @returns { Promise<void> } - The promise returned by the function.
981     * @throws { BusinessError } 1300011 - Failed to destroy the PiP window.
982     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
983     * @throws { BusinessError } 1300015 - Repeated PiP operation.
984     * @syscap SystemCapability.Window.SessionManager
985     * @since 11
986     */
987    /**
988     * Stop picture-in-picture.
989     * @returns { Promise<void> } - The promise returned by the function.
990     * @throws { BusinessError } 1300011 - Failed to destroy the PiP window.
991     * @throws { BusinessError } 1300012 - The PiP window state is abnormal.
992     * @throws { BusinessError } 1300015 - Repeated PiP operation.
993     * @syscap SystemCapability.Window.SessionManager
994     * @atomicservice
995     * @since 12
996     */
997    stopPiP(): Promise<void>;
998
999    /**
1000     * Set if auto start picture-in-picture when back home
1001     * @param { boolean } enable - Enable auto start picture-in-picture when back home
1002     * @syscap SystemCapability.Window.SessionManager
1003     * @since 11
1004     */
1005    /**
1006     * Set if auto start picture-in-picture when back home
1007     * @param { boolean } enable - Enable auto start picture-in-picture when back home
1008     * @syscap SystemCapability.Window.SessionManager
1009     * @atomicservice
1010     * @since 12
1011     */
1012    setAutoStartEnabled(enable: boolean): void;
1013
1014    /**
1015     * Update source content size to adjust PiP window aspect ratio.
1016     * @param { number } width - Indicate the width of the content. The width can consist of only digits and above 0.
1017     * @param { number } height - Indicate the height of the content. The height can consist of only digits and above 0.
1018     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1019     *                                                                2. Incorrect parameter types.
1020     * @syscap SystemCapability.Window.SessionManager
1021     * @since 11
1022     */
1023    /**
1024     * Update source content size to adjust PiP window aspect ratio.
1025     * @param { number } width - Indicate the width of the content. The width can consist of only digits and above 0.
1026     * @param { number } height - Indicate the height of the content. The height can consist of only digits and above 0.
1027     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1028     *                                                                2. Incorrect parameter types.
1029     * @syscap SystemCapability.Window.SessionManager
1030     * @atomicservice
1031     * @since 12
1032     */
1033    updateContentSize(width: number, height: number): void;
1034
1035    /**
1036     * Set dashboard control status.
1037     * @param { PiPControlType } controlType - Describe picture-in-picture control type.
1038     * @param { PiPControlStatus } status - Describe picture-in-picture control Status.
1039     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1040     *                                                                2. Incorrect parameter types.
1041     *                                                                3. Parameter verification failed
1042     * @syscap SystemCapability.Window.SessionManager
1043     * @atomicservice
1044     * @since 12
1045     */
1046    updatePiPControlStatus(controlType: PiPControlType, status: PiPControlStatus): void;
1047
1048    /**
1049     * Update the node which display the content of PiP window.
1050     * @param { typeNode.XComponent } contentNode - The node which display the content of pip window.
1051     * @returns { Promise<void> } - The promise returned by the function.
1052     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1053     *                                                                2. Incorrect parameter types.
1054     *                                                                3. Parameter verification failed.
1055     * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
1056     * @throws { BusinessError } 1300014 - PiP internal error.
1057     * @syscap SystemCapability.Window.SessionManager
1058     * @atomicservice
1059     * @since 18
1060     */
1061    updateContentNode(contentNode: typeNode.XComponent): Promise<void>;
1062
1063    /**
1064     * Set Dashboard control enable status.
1065     * @param { PiPControlType } controlType - Describe picture-in-picture control type.
1066     * @param { boolean } enabled - Describe picture-in-picture control enable Status.
1067     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1068     *                                                                2. Incorrect parameter types.
1069     *                                                                3. Parameter verification failed
1070     * @syscap SystemCapability.Window.SessionManager
1071     * @atomicservice
1072     * @since 12
1073     */
1074    setPiPControlEnabled(controlType: PiPControlType, enabled: boolean): void;
1075
1076    /**
1077     * Get the info of PiP window.
1078     * @returns { Promise<PiPWindowInfo> } - The promise used to return the PIP window info.
1079     * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
1080     * @throws { BusinessError } 1300014 - PiP internal error.
1081     * @syscap SystemCapability.Window.SessionManager
1082     * @atomicservice
1083     * @since 15
1084     */
1085     getPiPWindowInfo(): Promise<PiPWindowInfo>;
1086
1087     /**
1088     * Get the PiP switch status of system setting.
1089     * @returns { Promise<boolean> } - The promise used to return the PIP switch status.
1090     * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
1091     * @throws { BusinessError } 1300014 - PiP internal error.
1092     * @syscap SystemCapability.Window.SessionManager
1093     * @atomicservice
1094     * @since 20
1095     */
1096     getPiPSettingSwitch(): Promise<boolean>;
1097
1098    /**
1099     * Register picture-in-picture control event listener.
1100     * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange'
1101     * @param { function } callback - Used to handle {'stateChange'} command
1102     * @syscap SystemCapability.Window.SessionManager
1103     * @since 11
1104     */
1105    /**
1106     * Register picture-in-picture control event listener.
1107     * @param { 'stateChange' } type - Registration type, PiP lifecycle state change, 'stateChange'
1108     * @param { function } callback - Used to handle {'stateChange'} command
1109     * @syscap SystemCapability.Window.SessionManager
1110     * @atomicservice
1111     * @since 12
1112     */
1113    on(type: 'stateChange', callback: (state: PiPState, reason: string) => void): void;
1114
1115    /**
1116     * Unregister picture-in-picture lifecycle event listener.
1117     * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command
1118     * @syscap SystemCapability.Window.SessionManager
1119     * @since 11
1120     */
1121    /**
1122     * Unregister picture-in-picture lifecycle event listener.
1123     * @param { 'stateChange' } type - Used to unregister listener for {'stateChange'} command
1124     * @syscap SystemCapability.Window.SessionManager
1125     * @atomicservice
1126     * @since 12
1127     */
1128    off(type: 'stateChange'): void;
1129
1130    /**
1131     * Register picture-in-picture control event listener.
1132     * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent'
1133     * @param { function } callback - Used to handle {'controlPanelActionEvent'} command
1134     * @syscap SystemCapability.Window.SessionManager
1135     * @since 11
1136     */
1137    /**
1138     * Register picture-in-picture control event listener.
1139     *
1140     * @param { 'controlPanelActionEvent' } type - Registration type, user action event, 'controlPanelActionEvent'
1141     * @param { ControlPanelActionEventCallback } callback - Used to handle {'controlPanelActionEvent'} command.
1142     * @syscap SystemCapability.Window.SessionManager
1143     * @atomicservice
1144     * @since 12
1145     */
1146    on(type: 'controlPanelActionEvent', callback: ControlPanelActionEventCallback): void;
1147
1148    /**
1149     * Unregister picture-in-picture lifecycle event listener
1150     * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command
1151     * @syscap SystemCapability.Window.SessionManager
1152     * @since 11
1153     */
1154    /**
1155     * Unregister picture-in-picture lifecycle event listener
1156     * @param { 'controlPanelActionEvent' } type - Used to unregister listener for {'controlPanelActionEvent'} command
1157     * @syscap SystemCapability.Window.SessionManager
1158     * @atomicservice
1159     * @since 12
1160     */
1161    off(type: 'controlPanelActionEvent'): void;
1162
1163    /**
1164     * Register picture-in-picture control event listener.
1165     *
1166     * @param { 'controlEvent' } type - Registration type, user action event, 'controlEvent'
1167     * @param { Callback<ControlEventParam> } callback - Used to handle {'controlEvent'} command.
1168     * @syscap SystemCapability.Window.SessionManager
1169     * @atomicservice
1170     * @since 12
1171     */
1172    on(type: 'controlEvent', callback: Callback<ControlEventParam>): void;
1173
1174    /**
1175     * Unregister picture-in-picture control event listener
1176     * @param { 'controlEvent' } type - Used to unregister listener for {'controlEvent'} command
1177     * @param { Callback<ControlEventParam> } callback - Used to handle {'controlEvent'} command.
1178     * @syscap SystemCapability.Window.SessionManager
1179     * @atomicservice
1180     * @since 12
1181     */
1182    off(type: 'controlEvent', callback?: Callback<ControlEventParam>): void;
1183
1184    /**
1185     * Register picture-in-picture window size change event listener
1186     *
1187     * @param { 'pipWindowSizeChange' } type - The value is fixed at 'pipWindowSizeChange', indicating the picture-in-picture
1188     * window size change event.
1189     * @param { Callback<PiPWindowSize> } callback - Callback used to return the picture-in-picture window size.
1190     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1191     *                                                                2. Incorrect parameter types.
1192     *                                                                3. Parameter verification failed.
1193     * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
1194     * @throws { BusinessError } 1300014 - PiP internal error.
1195     * @syscap SystemCapability.Window.SessionManager
1196     * @atomicservice
1197     * @since 15
1198     */
1199    on(type: 'pipWindowSizeChange', callback: Callback<PiPWindowSize>): void;
1200
1201    /**
1202     * Unregister picture-in-picture window size change event listener
1203     *
1204     * @param { 'pipWindowSizeChange' } type - The value is fixed at 'pipWindowSizeChange', indicating the picture-in-picture
1205     * window size change event.
1206     * @param { Callback<PiPWindowSize> } callback - Callback used to return the picture-in-picture window size.
1207     * @throws { BusinessError } 401 - Params error. Possible causes: 1. Mandatory parameters are left unspecified.
1208     *                                                                2. Incorrect parameter types.
1209     *                                                                3. Parameter verification failed.
1210     * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities.
1211     * @syscap SystemCapability.Window.SessionManager
1212     * @atomicservice
1213     * @since 15
1214     */
1215    off(type: 'pipWindowSizeChange', callback?: Callback<PiPWindowSize>): void;
1216
1217    /**
1218     * Returns a Boolean value that indicates whether picture-in-picture is supported
1219     *
1220     * @returns { boolean } - True if picture-in-picture is supported, otherwise false
1221     * @throws { BusinessError } 202 - Not System App. Interface caller is not a system app.
1222     * @throws { BusinessError } 1300014 - PiP internal error.
1223     * @syscap SystemCapability.Window.SessionManager
1224     * @systemapi Hide this for inner system use
1225     * @since 18
1226     * @test
1227     */
1228    isPiPSupported(): boolean;
1229  }
1230}
1231
1232export default PiPWindow;
1233