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