• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2* Copyright (C) 2021-2024 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 MediaKit
19 */
20
21import { ErrorCallback, AsyncCallback, Callback } from './@ohos.base';
22import audio from './@ohos.multimedia.audio';
23import photoAccessHelper from './@ohos.file.photoAccessHelper';
24import type image from './@ohos.multimedia.image';
25import type { SoundPool as _SoundPool } from './multimedia/soundPool';
26import type { PlayParameters as _PlayParameters } from './multimedia/soundPool';
27import type drm from './@ohos.multimedia.drm';
28
29/**
30 * @namespace media
31 * @since 6
32 */
33/**
34 * @namespace media
35 * @atomicservice
36 * @since 11
37 */
38/**
39 * The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and
40 * use media resources.
41 *
42 * @namespace media
43 * @syscap SystemCapability.Multimedia.Media.Core
44 * @crossplatform
45 * @atomicservice
46 * @since 12
47 */
48declare namespace media {
49  /**
50   * Creates an AVPlayer instance.
51   * @param { AsyncCallback<AVPlayer> } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise.
52   * The instance can be used to play audio and video.
53   * @throws { BusinessError } 5400101 - No memory. Return by callback.
54   * @syscap SystemCapability.Multimedia.Media.AVPlayer
55   * @since 9
56   */
57  /**
58   * Creates an AVPlayer instance.
59   * @param { AsyncCallback<AVPlayer> } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise.
60   * @throws { BusinessError } 5400101 - No memory. Return by callback.
61   * @syscap SystemCapability.Multimedia.Media.AVPlayer
62   * @atomicservice
63   * @since 11
64   */
65  /**
66   * Creates an **AVPlayer** instance. This API uses an asynchronous callback to return the result.
67   * <br>**NOTE:**<br>
68   * You are advised to create a maximum of 16 **AVPlayer** instances for an application in both audio and video
69   * playback scenarios.
70   *
71   * The actual number of instances that can be created may be different.
72   * It depends on the specifications of the device chip in use.
73   *
74   * @param { AsyncCallback<AVPlayer> } callback - used to return the result. If the operation is successful, an
75   * **AVPlayer** instance is returned; otherwise, **null** is returned. The instance can be used to play
76   * audio and video.
77   * @throws { BusinessError } 5400101 - No memory. Return by callback.
78   * @syscap SystemCapability.Multimedia.Media.AVPlayer
79   * @crossplatform
80   * @atomicservice
81   * @since 12
82   */
83  function createAVPlayer(callback: AsyncCallback<AVPlayer>): void;
84
85  /**
86   * Creates an AVPlayer instance. This API uses a promise to return the result.
87   * @returns { Promise<AVPlayer> } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise.
88   * @throws { BusinessError } 5400101 - No memory. Return by promise.
89   * @syscap SystemCapability.Multimedia.Media.AVPlayer
90   * @since 9
91   */
92  /**
93   * Creates an AVPlayer instance. This API uses a promise to return the result.
94   * @returns { Promise<AVPlayer> } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise.
95   * @throws { BusinessError } 5400101 - No memory. Return by promise.
96   * @syscap SystemCapability.Multimedia.Media.AVPlayer
97   * @atomicservice
98   * @since 11
99   */
100  /**
101   * Creates an **AVPlayer** instance. This API uses a promise to return the result.
102   * <br>**NOTE:**<br>
103   * You are advised to create a maximum of 16 **AVPlayer** instances for an application in both audio and video
104   * playback scenarios.
105   *
106   * The actual number of instances that can be created may be different. It depends on the specifications of
107   * the device chip in use.
108   *
109   * @returns { Promise<AVPlayer> } A Promise instance used to return the result. If the operation is successful, an
110   * **AVPlayer** instance is returned; **null** is returned otherwise. The instance can be used to play
111   * audio and video.
112   * @throws { BusinessError } 5400101 - No memory. Return by promise.
113   * @syscap SystemCapability.Multimedia.Media.AVPlayer
114   * @crossplatform
115   * @atomicservice
116   * @since 12
117   */
118  function createAVPlayer(): Promise<AVPlayer>;
119
120  /**
121   * Creates an AVRecorder instance.
122   * @param { AsyncCallback<AVRecorder> } callback - used to return AVRecorder instance if the operation is successful; returns null otherwise.
123   * @throws { BusinessError } 5400101 - No memory. Return by callback.
124   * @syscap SystemCapability.Multimedia.Media.AVRecorder
125   * @since 9
126   */
127  /**
128   * Creates an **AVRecorder** instance. This API uses an asynchronous callback to return the result.
129   * @param { AsyncCallback<AVRecorder> } callback - Callback used to return the result. If the operation is successful,
130   * an **AVRecorder** instance is returned; otherwise, **null** is returned. The instance can be used to record audio
131   * and video.
132   * @throws { BusinessError } 5400101 - No memory. Return by callback.
133   * @syscap SystemCapability.Multimedia.Media.AVRecorder
134   * @crossplatform
135   * @since 12
136   */
137  function createAVRecorder(callback: AsyncCallback<AVRecorder>): void;
138
139  /**
140   * Creates an AVRecorder instance.
141   * @returns { Promise<AVRecorder> } A Promise instance used to return AVRecorder instance if the operation is successful; returns null otherwise.
142   * @throws { BusinessError } 5400101 - No memory. Return by promise.
143   * @syscap SystemCapability.Multimedia.Media.AVRecorder
144   * @since 9
145   */
146  /**
147   * Creates an **AVRecorder** instance. This API uses a promise to return the result.
148   * @returns { Promise<AVRecorder> } Promise used to return the result. If the operation is successful,
149   * an **AVRecorder** instance is returned; otherwise, **null** is returned.
150   * The instance can be used to record audio and video.
151   * @throws { BusinessError } 5400101 - No memory. Return by promise.
152   * @syscap SystemCapability.Multimedia.Media.AVRecorder
153   * @crossplatform
154   * @atomicservice
155   * @since 12
156   */
157  function createAVRecorder(): Promise<AVRecorder>;
158
159  /**
160   * Creates an AudioPlayer instance.
161   * @returns { AudioPlayer } Returns an AudioPlayer instance if the operation is successful; returns null otherwise.
162   * @syscap SystemCapability.Multimedia.Media.AudioPlayer
163   * @since 6
164   * @deprecated since 9
165   * @useinstead ohos.multimedia.media/media#createAVPlayer
166   */
167  function createAudioPlayer(): AudioPlayer;
168
169  /**
170   * Creates an AudioRecorder instance.
171   * @returns { AudioRecorder } Returns an AudioRecorder instance if the operation is successful; returns null otherwise.
172   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
173   * @since 6
174   * @deprecated since 9
175   * @useinstead ohos.multimedia.media/media#createAVRecorder
176   */
177  function createAudioRecorder(): AudioRecorder;
178
179  /**
180   * Create MediaSource from url.
181   * @param { string } url : The location for the media source.
182   * @param { Record<string, string> } headers : Headers attached to network request while player request data.
183   * @returns { MediaSource } MediaSource instance if the operation is successful; returns null otherwise.
184   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
185   * <br>2. Incorrect parameter types. 3.Parameter verification failed.
186   * @throws { BusinessError } 5400101 - No memory.
187   * @syscap SystemCapability.Multimedia.Media.Core
188   * @since 12
189   */
190  /**
191   * Creates a media source for streaming media to be pre-downloaded.
192   * @param { string } url : Url of the media source. The following streaming media formats are supported: HLS,
193   *  HTTP-FLV, DASH, and HTTPS.
194   * @param { Record<string, string> } headers : Headers attached to network request while player request data.
195   * @returns { MediaSource } MediaSource instance if the operation is successful; returns null otherwise.
196   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
197   * <br>2. Incorrect parameter types. 3.Parameter verification failed.
198   * @throws { BusinessError } 5400101 - No memory.
199   * @syscap SystemCapability.Multimedia.Media.Core
200   * @atomicservice
201   * @since 13
202   */
203  function createMediaSourceWithUrl(url: string, headers?: Record<string, string>): MediaSource;
204
205   /**
206   * Creates a multi-bitrate media source for streaming media. Currently, only the HTTP-FLV multi-bitrate
207   * media source is supported.
208   * @param { Array<MediaStream> } streams - Array of MediaStream objects.
209   * The supported streaming media format is HTTP-FLV.
210   * @returns { MediaSource } MediaSource instance if the operation is successful; returns null otherwise.
211   * @syscap SystemCapability.Multimedia.Media.Core
212   * @atomicservice
213   * @since 19
214   */
215  function createMediaSourceWithStreamData(streams: Array<MediaStream>): MediaSource;
216
217  /**
218   * Creates an VideoPlayer instance.
219   * @param { AsyncCallback<VideoPlayer> } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise.
220   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
221   * @since 8
222   * @deprecated since 9
223   * @useinstead ohos.multimedia.media/media#createAVPlayer
224   */
225  function createVideoPlayer(callback: AsyncCallback<VideoPlayer>): void;
226
227  /**
228   * Creates an VideoPlayer instance.
229   * @returns { Promise<VideoPlayer> } A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise.
230   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
231   * @since 8
232   * @deprecated since 9
233   * @useinstead ohos.multimedia.media/media#createAVPlayer
234   */
235  function createVideoPlayer(): Promise<VideoPlayer>;
236
237  /**
238   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
239   * Creates an VideoRecorder instance.
240   * @param { AsyncCallback<VideoRecorder> } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise.
241   * @throws { BusinessError } 5400101 - No memory. Return by callback.
242   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
243   * @systemapi
244   * @since 9
245   */
246  /**
247   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
248   * Creates an VideoRecorder instance.
249   * @param { AsyncCallback<VideoRecorder> } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise.
250   * @throws { BusinessError } 202 - Not System App.
251   * @throws { BusinessError } 5400101 - No memory. Return by callback.
252   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
253   * @systemapi
254   * @since 12
255   */
256  function createVideoRecorder(callback: AsyncCallback<VideoRecorder>): void;
257
258  /**
259   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
260   * Creates an VideoRecorder instance.
261   * @returns { Promise<VideoRecorder> } A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise.
262   * @throws { BusinessError } 5400101 - No memory. Return by promise.
263   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
264   * @systemapi
265   * @since 9
266   */
267  /**
268   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
269   * Creates an VideoRecorder instance.
270   * @returns { Promise<VideoRecorder> } A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise.
271   * @throws { BusinessError } 202 - Not System App.
272   * @throws { BusinessError } 5400101 - No memory. Return by promise.
273   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
274   * @systemapi
275   * @since 12
276   */
277  function createVideoRecorder(): Promise<VideoRecorder>;
278
279  /**
280   * Creates a **SoundPool** instance. This API uses an asynchronous callback to return the result.
281   *
282   * **NOTE**
283   * - In versions earlier than API version 18, the bottom layer of the created **SoundPool** object is in singleton
284   * mode. Therefore, an application process can create only one **SoundPool** instance.
285   * - In API version 18 and later versions, the bottom layer of the created **SoundPool** object is in multiton mode.
286   * Therefore, an application process can create a maximum of 128 **SoundPool** instances.
287   *
288   * @param {number} maxStreams - Maximum number of streams that can be played by the **SoundPool** instance.
289   * The value is an integer ranging from 1 to 32.
290   * @param {audio.AudioRendererInfo} audioRenderInfo - Audio renderer parameters. When the **usage** parameter
291   * in **audioRenderInfo** is set to **STREAM_USAGE_UNKNOWN**, **STREAM_USAGE_MUSIC**, **STREAM_USAGE_MOVIE**, or
292   * **STREAM_USAGE_AUDIOBOOK**, the SoundPool uses the audio mixing mode when playing a short sound, without
293   * interrupting the playback of other audios.
294   * @param {AsyncCallback<SoundPool>} callback - Callback used to return the result. If the operation is successful, a
295   * **SoundPool** instance is returned; otherwise, **null** is returned.
296   * The instance is used for loading and playback.
297   * @throws { BusinessError } 5400101 - No memory. Return by callback.
298   * @syscap SystemCapability.Multimedia.Media.SoundPool
299   * @since 10
300   */
301  function createSoundPool(
302    maxStreams: number,
303    audioRenderInfo: audio.AudioRendererInfo,
304    callback: AsyncCallback<SoundPool>
305  ): void;
306
307  /**
308   * Creates a **SoundPool** instance. This API uses a promise to return the result.
309   *
310   * **NOTE**
311   * - In versions earlier than API version 18, the bottom layer of the created **SoundPool** object is in singleton
312   * mode. Therefore, an application process can create only one **SoundPool** instance.
313   * - In API version 18 and later versions, the bottom layer of the created **SoundPool** object is in multiton mode.
314   * Therefore, an application process can create a maximum of 128 **SoundPool** instances.
315   *
316   * @param {number} maxStreams - Maximum number of streams that can be played by the **SoundPool** instance.
317   * The value is an integer ranging from 1 to 32.
318   * @param {audio.AudioRendererInfo} audioRenderInfo - Audio renderer parameters.
319   * @returns {Promise<SoundPool>} Promise used to return the result. If the operation is successful,
320   * a **SoundPool** instance is returned; otherwise, **null** is returned.
321   * The instance is used for loading and playback.
322   * @throws { BusinessError } 5400101 - No memory. Return by promise.
323   * @syscap SystemCapability.Multimedia.Media.SoundPool
324   * @since 10
325   */
326  function createSoundPool(maxStreams: number, audioRenderInfo: audio.AudioRendererInfo): Promise<SoundPool>;
327
328  /**
329   * Creates a **SoundPool** instance. This API uses a promise to return the result.
330   *
331   * If a **SoundPool** instance created using [createSoundPool]{@link #createSoundPool} is used to play the same sound again,
332   * it stops the current audio and restarts the audio. However, if the instance is created using
333   * **createParallelSoundPool**, it keeps playing the first audio and starts the new one alongside it.
334   *
335   * @param {number} maxStreams - Maximum number of streams that can be played by the **SoundPool** instance.
336   * The value is an integer ranging from 1 to 32.
337   * @param {audio.AudioRendererInfo} audioRenderInfo - Audio renderer parameters.
338   * @returns {Promise<SoundPool>} Promise used to return the result. If the operation is successful, a **SoundPool**
339   * instance is returned; otherwise, **null** is returned. The instance is used for loading and playback.
340   * @throws { BusinessError } 5400101 - No memory. Return by promise.
341   * @throws { BusinessError } 202 - System API error. Return by promise.
342   * @syscap SystemCapability.Multimedia.Media.SoundPool
343   * @systemapi
344   * @since 20
345   */
346  function createParallelSoundPool(maxStreams: number, audioRenderInfo: audio.AudioRendererInfo): Promise<SoundPool>;
347
348  /**
349   * Creates an **AVScreenCaptureRecorder** instance. This API uses a promise to return the result.
350   * @returns { Promise<AVScreenCaptureRecorder> } Promise used to return the result. If the operation is successful,
351   * an **AVScreenCaptureRecorder** instance is returned; otherwise, **null** is returned.
352   * The instance can be used for screen capture.
353   * @throws { BusinessError } 5400101 - No memory. Return by promise.
354   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
355   * @since 12
356   * @example
357   * import { BusinessError } from '@kit.BasicServicesKit';
358   *
359   * let avScreenCaptureRecorder: media.AVScreenCaptureRecorder;
360   * media.createAVScreenCaptureRecorder().then((captureRecorder: media.AVScreenCaptureRecorder) => {
361   *   if (captureRecorder != null) {
362   *     avScreenCaptureRecorder = captureRecorder;
363   *     console.info('Succeeded in createAVScreenCaptureRecorder');
364   *   } else {
365   *     console.error('Failed to createAVScreenCaptureRecorder');
366   *   }
367   * }).catch((error: BusinessError) => {
368   *   console.error(`createAVScreenCaptureRecorder catchCallback, error message:${error.message}`);
369   * });
370   */
371  function createAVScreenCaptureRecorder(): Promise<AVScreenCaptureRecorder>;
372
373  /**
374   * Reports the user selection result in the screen capture privacy dialog box to the AVScreenCapture server to
375   * determine whether to start screen capture. Screen capture starts only when the user touches a button to
376   * continue the operation.
377   * This API is called by the system application that creates the dialog box.
378   *
379   * @param {number} sessionId Session ID of the AVScreenCapture service, which is sent to the application when
380   * the AVScreenCapture server starts the privacy dialog box.
381   * @param {string} choice User choice, including whether screen capture is agreed, selected display ID,
382   * and window ID. For details, see JsonData in the example below.
383   * @returns { Promise<void> } Promise used to return the result.
384   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
385   * 2. Incorrect parameter types. 3.Parameter verification failed.
386   * @throws { BusinessError } 5400101 - No memory. Return by promise.
387   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
388   * @systemapi
389   * @since 12
390   * @example
391   * import { BusinessError } from '@kit.BasicServicesKit';
392   * import { media } from '@kit.MediaKit';
393   *
394   * class JsonData {
395   *   public choice: string = 'true'
396   *   public displayId: number | null = -1
397   *   public missionId: number | null = -1
398   * }
399   * let sessionId: number = 0; // Use the ID of the session that starts the process.
400   *
401   * try {
402   *   const jsonData: JsonData = {
403   *     choice: 'true',  // Replace it with the user choice.
404   *     displayId: -1, // Replace it with the ID of the display selected by the user.
405   *     missionId: -1,   // Replace it with the ID of the window selected by the user.
406   *   }
407   *   await media.reportAVScreenCaptureUserChoice(sessionId, JSON.stringify(jsonData));
408   * } catch (error: BusinessError) {
409   *   console.error(`reportAVScreenCaptureUserChoice error, error message: ${error.message}`);
410   * }
411   */
412  function reportAVScreenCaptureUserChoice(sessionId: number, choice: string): Promise<void>;
413
414   /**
415   * get Configurations which user can changes from AVScreenCapture server
416   *
417   * @param { number } sessionId The AVScreenCapture server session ID.
418   * @returns { Promise<string> } Returns a configurable configuration item string.
419   * @throws { BusinessError } 202 Called from Non-System applications. Return by promise.
420   * @throws { BusinessError } 5400109 - Sessions not exist. Return by promise.
421   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
422   * @systemapi
423   * @since 20
424   * @arkts 1.1&1.2
425   */
426  function getAVScreenCaptureConfigurableParameters(sessionId: number): Promise<string>;
427
428  /**
429   * Creates an **AVTranscoder** instance. This API uses a promise to return the result.
430   *
431   * **NOTE**
432   *
433   * A maximum of 2 **AVTranscoder** instances can be created.
434   *
435   * @returns {Promise<AVTranscoder>} Promise used to return the result. If the operation is successful, an
436   * **AVTranscoder** instance is returned; otherwise, **null** is returned. The instance can be used for video
437   * transcoding.
438   * @throws { BusinessError } 5400101 - No memory. Return by promise.
439   * @syscap SystemCapability.Multimedia.Media.AVTranscoder
440   * @since 12
441   */
442  function createAVTranscoder(): Promise<AVTranscoder>;
443
444  /**
445   * Obtains a **ScreenCaptureMonitor** instance. This API uses a promise to return the result.
446   *
447   * @returns { Promise<ScreenCaptureMonitor> } Promise used to return the result. The instance can be used to query
448   * and monitor the status of the system screen recorder.<br>If the operation is successful,
449   * a **ScreenCaptureMonitor** instance is returned; otherwise, **null** is returned.
450   * @throws { BusinessError } 202 - Not System App.
451   * @throws { BusinessError } 5400101 - No memory. Return by promise.
452   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
453   * @systemapi
454   * @since 18
455   * @example
456   * let screenCaptureMonitor: media.ScreenCaptureMonitor;
457   * try {
458   *   screenCaptureMonitor = await media.getScreenCaptureMonitor();
459   * } catch (err) {
460   *   console.error(`getScreenCaptureMonitor failed, error message:${err.message}`);
461   * }
462   */
463  function getScreenCaptureMonitor(): Promise<ScreenCaptureMonitor>;
464
465  /**
466   * Provides APIs for loading, unloading, playing, and stopping playing system sounds, setting the volume,
467   * and setting the number of loops.
468   *
469   * @typedef { _SoundPool }
470   * @syscap SystemCapability.Multimedia.Media.SoundPool
471   * @since 10
472   */
473  type SoundPool = _SoundPool;
474
475  /**
476   * Playback parameters of the sound pool.
477   *
478   * @typedef { _PlayParameters }
479   * @syscap SystemCapability.Multimedia.Media.SoundPool
480   * @since 10
481   */
482  type PlayParameters = _PlayParameters;
483
484  /**
485   * Enumerates state change reason.
486   *
487   * @enum { number }
488   * @syscap SystemCapability.Multimedia.Media.Core
489   * @since 9
490   */
491  /**
492   * Enumerates state change reason.
493   *
494   * @enum { number }
495   * @syscap SystemCapability.Multimedia.Media.Core
496   * @atomicservice
497   * @since 11
498   */
499  /**
500   * Enumerates the reasons for the state transition of the **AVPlayer** or **AVRecorder** instance.
501   * The enum value is reported together with **state**.
502   *
503   * @enum { number }
504   * @syscap SystemCapability.Multimedia.Media.Core
505   * @crossplatform
506   * @atomicservice
507   * @since 12
508   */
509  enum StateChangeReason {
510    /**
511     * State changed by user operation.
512     * @syscap SystemCapability.Multimedia.Media.Core
513     * @since 9
514     */
515    /**
516     * State changed by user operation.
517     * @syscap SystemCapability.Multimedia.Media.Core
518     * @atomicservice
519     * @since 11
520     */
521    /**
522     * State transition triggered by user behavior. It happens when a user or the client calls an API.
523     * @syscap SystemCapability.Multimedia.Media.Core
524     * @crossplatform
525     * @atomicservice
526     * @since 12
527     */
528    USER = 1,
529
530    /**
531     * State changed by background action.
532     * @syscap SystemCapability.Multimedia.Media.Core
533     * @since 9
534     */
535    /**
536     * State changed by background action.
537     * @syscap SystemCapability.Multimedia.Media.Core
538     * @atomicservice
539     * @since 11
540     */
541    /**
542     * State transition caused by background system behavior. For example, if an application does not have the permission of
543     * Media Controller, the application is forcibly suspended or stopped by the system when it switches to the background.
544     * @syscap SystemCapability.Multimedia.Media.Core
545     * @crossplatform
546     * @atomicservice
547     * @since 12
548     */
549    BACKGROUND = 2,
550  }
551
552  /**
553   * Creates an AVMetadataExtractor instance.
554   * @returns { Promise<AVMetadataExtractor> } A Promise instance used to return AVMetadataExtractor instance
555   * if the operation is successful; returns null otherwise.
556   * @throws { BusinessError } 5400101 - No memory. Returned by promise.
557   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
558   * @since 11
559   */
560  /**
561   * Creates an **AVMetadataExtractor** instance. This API uses a promise to return the result.
562   * @returns { Promise<AVMetadataExtractor> } A Promise instance used to return AVMetadataExtractor instance
563   * if the operation is successful; returns null otherwise.
564   * @throws { BusinessError } 5400101 - No memory. Returned by promise.
565   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
566   * @crossplatform
567   * @since 12
568   */
569  function createAVMetadataExtractor(): Promise<AVMetadataExtractor>;
570
571  /**
572   * Creates an AVMetadataExtractor instance.
573   * @param { AsyncCallback<AVMetadataExtractor> } callback - Callback used to return AVMetadataExtractor instance
574   * if the operation is successful; returns null otherwise.
575   * @throws { BusinessError } 5400101 - No memory. Returned by callback.
576   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
577   * @since 11
578   */
579  /**
580   * Creates an **AVMetadataExtractor** instance. This API uses an asynchronous callback to return the result.
581   * @param { AsyncCallback<AVMetadataExtractor> } callback - Callback used to return the result. If the operation is
582   * successful, **err** is **undefined** and **data** is the **AVMetadataExtractor** instance created;
583   * otherwise, **err** is an error object.
584   * @throws { BusinessError } 5400101 - No memory. Returned by callback.
585   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
586   * @crossplatform
587   * @since 12
588   */
589  function createAVMetadataExtractor(callback: AsyncCallback<AVMetadataExtractor>): void;
590
591  /**
592   * Creates an **AVImageGenerator** instance. This API uses a promise to return the result.
593   * @returns { Promise<AVImageGenerator> } Promise used to return the result. If the operation is successful,
594   * an **AVImageGenerator** instance is returned; otherwise, **null** is returned.
595   * The API can be used to obtain a video thumbnail.
596   * @throws { BusinessError } 5400101 - No memory. Returned by promise.
597   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
598   * @since 12
599   */
600  function createAVImageGenerator(): Promise<AVImageGenerator>;
601
602  /**
603   * Creates an **AVImageGenerator** instance. This API uses an asynchronous callback to return the result.
604   * @param { AsyncCallback<AVImageGenerator> } callback - Callback used to return the result.
605   * If the operation is successful, an **AVImageGenerator** instance is returned; otherwise, **null** is returned.
606   * The API can be used to obtain a video thumbnail.
607   * @throws { BusinessError } 5400101 - No memory. Returned by callback.
608   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
609   * @since 12
610   */
611  function createAVImageGenerator(callback: AsyncCallback<AVImageGenerator>): void;
612
613  /**
614   * Fetch media meta data or audio art picture from source. Before calling an AVMetadataExtractor method,
615   * you must use createAVMetadataExtractor() to create an AVMetadataExtractor instance.
616   * @typedef AVMetadataExtractor
617   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
618   * @since 11
619   */
620  /**
621   * Fetch media meta data or audio art picture from source. Before calling an **AVMetadataExtractor** method,
622   * you must use [createAVMetadataExtractor()]{@link #createAVMetadataExtractor} to create an
623   * **AVMetadataExtractor** instance.
624   *
625   * @typedef AVMetadataExtractor
626   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
627   * @crossplatform
628   * @since 12
629   */
630  interface AVMetadataExtractor {
631    /**
632     * Media file descriptor.
633     * @type { ?AVFileDescriptor }
634     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
635     * @since 11
636     */
637    /**
638     * Media file descriptor, which specifies the data source. Before obtaining metadata,
639     * you must set the data source through either **fdSrc** or **dataSrc**.
640     *
641     * **Example:**
642     *
643     * There is a media file that stores continuous assets, the address offset is 0, and the byte length is 100.
644     * Its file descriptor is **AVFileDescriptor { fd = resourceHandle; offset = 0; length = 100; }**.
645     *
646     * **NOTE**
647     * - After the resource handle (FD) is transferred to an **AVMetadataExtractor** instance,
648     * do not use the resource handle to perform other read and write operations, including but not limited to
649     * transferring this handle to other **AVPlayer**, **AVMetadataExtractor**, **AVImageGenerator**,
650     * or **AVTranscoder** instance. Competition occurs when multiple **AVMetadataExtractor** use the same resource
651     * handle to read and write files at the same time, resulting in errors in obtaining data.
652     * @type { ?AVFileDescriptor }
653     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
654     * @crossplatform
655     * @since 12
656     */
657    fdSrc ?: AVFileDescriptor;
658
659    /**
660     * DataSource descriptor.
661     * @type { ?AVDataSrcDescriptor }
662     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
663     * @since 11
664     */
665    /**
666     * Streaming media resource descriptor, which specifies the data source. Before obtaining metadata,
667     * you must set the data source through either **fdSrc** or **dataSrc**.
668     *
669     * When an application obtains a media file from the remote, you can set **dataSrc** to obtain the metadata before
670     * the application finishes the downloading.
671     * @type { ?AVDataSrcDescriptor }
672     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
673     * @crossplatform
674     * @since 12
675     */
676    dataSrc ?: AVDataSrcDescriptor;
677
678    /**
679     * It will extract the resource to fetch media meta data info.
680     * @param { AsyncCallback<AVMetadata> } callback - A callback instance used to return when fetchMetadata completed.
681     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
682     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
683     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
684     * @since 11
685     */
686    /**
687     * Obtains media metadata. This API uses an asynchronous callback to return the result.
688     * @param { AsyncCallback<AVMetadata> } callback - Callback used to return the result,
689     * which is an **AVMetadata** instance.
690     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
691     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
692     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
693     * @crossplatform
694     * @since 12
695     */
696    fetchMetadata(callback: AsyncCallback<AVMetadata>): void;
697
698    /**
699     * It will extract the resource to fetch media meta data info.
700     * @returns { Promise<AVMetadata> } A Promise instance used to return when fetchMetadata completed.
701     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
702     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
703     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
704     * @since 11
705     */
706    /**
707     * Obtains media metadata. This API uses a promise to return the result.
708     * @returns { Promise<AVMetadata> } Promise used to return the result, which is an **AVMetadata** instance.
709     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
710     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
711     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
712     * @crossplatform
713     * @since 12
714     */
715    fetchMetadata(): Promise<AVMetadata>;
716
717    /**
718     * It will extract the audio resource to fetch an album cover.
719     * @param { AsyncCallback<image.PixelMap> } callback - A callback instance used
720     * to return when fetchAlbumCover completed.
721     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
722     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
723     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
724     * @since 11
725     */
726    /**
727     * Obtains the cover of the audio album. This API uses an asynchronous callback to return the result.
728     * @param { AsyncCallback<image.PixelMap> } callback - Callback used to return the album cover.
729     * to return when fetchAlbumCover completed.
730     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
731     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
732     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
733     * @crossplatform
734     * @since 12
735     */
736    fetchAlbumCover(callback: AsyncCallback<image.PixelMap>): void;
737
738    /**
739     * It will extract the audio resource to fetch an album cover.
740     * @returns { Promise<image.PixelMap> } A Promise instance used to return when fetchAlbumCover completed.
741     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
742     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
743     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
744     * @since 11
745     */
746    /**
747     * Obtains the cover of the audio album. This API uses a promise to return the result.
748     * @returns { Promise<image.PixelMap> } Promise used to return the album cover.
749     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
750     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
751     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
752     * @crossplatform
753     * @since 12
754     */
755    fetchAlbumCover(): Promise<image.PixelMap>;
756
757    /**
758     * Sets the network media source URL and configures request headers.
759     * @param { string } url - The URL of the media resource.
760     * @param { Record<string, string> } [headers] - Optional request headers.
761     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
762     * @since 20
763     * @arkts 1.1&1.2
764     */
765    setUrlSource(url: string, headers?: Record<string, string>): void;
766
767    /**
768     * It will decode the given video resource. Then fetch a picture
769     * at @timeUs according the given @options and @param .
770     * @param { number } timeUs - The time expected to fetch picture from the video resource.
771     * The unit is microsecond(us).
772     * @param { AVImageQueryOptions } options - The time options about the relationship
773     * between the given timeUs and a key frame, see @AVImageQueryOptions .
774     * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams .
775     * @returns { Promise<image.PixelMap> } A Promise instance used to return the pixel map
776     * when fetchFrameByTime completed.
777     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
778     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
779     * @throws { BusinessError } 5400108 - Parameter check failed. Returned by promise.
780     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
781     * @since 20
782     */
783    fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams): Promise<image.PixelMap>;
784
785    /**
786     * Obtains the video timestamp corresponding to a video frame number. Only MP4 video files are supported.
787     * @param { number } index - Video frame number.
788     * @returns { Promise<number> } Promise used to return the timestamp, in microseconds.
789     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
790     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
791     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
792     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
793     * @systemapi
794     * @since 12
795     */
796    getTimeByFrameIndex(index: number): Promise<number>;
797
798    /**
799     * Obtains the video frame number corresponding to a video timestamp. Only MP4 video files are supported.
800     * @param { number } timeUs - Video timestamp, in microseconds.
801     * @returns { Promise<number> } Promise used to return the video frame number.
802     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
803     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
804     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
805     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
806     * @systemapi
807     * @since 12
808     */
809    getFrameIndexByTime(timeUs: number): Promise<number>;
810
811    /**
812     * Release resources used for AVMetadataExtractor.
813     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
814     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
815     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
816     * @since 11
817     */
818    /**
819     * Releases this **AVMetadataExtractor** instance. This API uses an asynchronous callback to return the result.
820     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
821     * **err** is **undefined**; otherwise, **err** is an error object.
822     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
823     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
824     * @crossplatform
825     * @since 12
826     */
827    release(callback: AsyncCallback<void>): void;
828
829    /**
830     * Release resources used for AVMetadataExtractor.
831     * @returns { Promise<void> } A Promise instance used to return when release completed.
832     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
833     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
834     * @since 11
835     */
836    /**
837     * Releases this **AVMetadataExtractor** instance. This API uses a promise to return the result.
838     * @returns { Promise<void> } Promise that returns no value.
839     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
840     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
841     * @crossplatform
842     * @since 12
843     */
844    release(): Promise<void>;
845  }
846
847  /**
848   * Provides the container definition for media meta data.
849   * @typedef AVMetadata
850   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
851   * @since 11
852   */
853  /**
854   * Defines the audio and video metadata. Parameters that are not declared as read-only in
855   * [AVRecorderConfig]{@link #AVRecorderConfig} can be used as input parameters for recording of
856   * [AVRecorder]{@link #AVRecorder}.
857   * @typedef AVMetadata
858   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
859   * @crossplatform
860   * @since 12
861   */
862  interface AVMetadata {
863    /**
864     * The metadata to retrieve the information about the album title
865     * of the media source.
866     * @type { ?string }
867     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
868     * @since 11
869     */
870    /**
871     * Title of the album. This parameter is read-only in the current version.
872     * @type { ?string }
873     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
874     * @crossplatform
875     * @since 12
876     */
877    album?: string;
878
879    /**
880     * The metadata to retrieve the information about the performer or
881     * artist associated with the media source.
882     * @type { ?string }
883     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
884     * @since 11
885     */
886    /**
887     * Artist of the album. This parameter is read-only in the current version.
888     * @type { ?string }
889     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
890     * @crossplatform
891     * @since 12
892     */
893    albumArtist?: string;
894
895    /**
896     * The metadata to retrieve the information about the artist of
897     * the media source.
898     * @type { ?string }
899     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
900     * @since 11
901     */
902    /**
903     * Artist of the media asset. This parameter is read-only in the current version.
904     * @type { ?string }
905     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
906     * @crossplatform
907     * @since 12
908     */
909    artist?: string;
910
911    /**
912     * The metadata to retrieve the information about the author of
913     * the media source.
914     * @type { ?string }
915     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
916     * @since 11
917     */
918    /**
919     * Author of the media asset. This parameter is read-only in the current version.
920     * @type { ?string }
921     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
922     * @crossplatform
923     * @since 12
924     */
925    author?: string;
926
927    /**
928     * The metadata to retrieve the information about the created time of
929     * the media source.
930     * @type { ?string }
931     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
932     * @since 11
933     */
934    /**
935     * Time when the media asset is created. This parameter is read-only in the current version.
936     * @type { ?string }
937     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
938     * @crossplatform
939     * @since 12
940     */
941    dateTime?: string;
942
943    /**
944     * The metadata to retrieve the information about the created or modified time
945     * with the specific date format of the media source.
946     * @type { ?string }
947     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
948     * @since 11
949     */
950    /**
951     * Time when the media asset is created. The value is in the YYYY-MM-DD HH:mm:ss format.
952     * This parameter is read-only in the current version.
953     * @type { ?string }
954     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
955     * @crossplatform
956     * @since 12
957     */
958    dateTimeFormat?: string;
959
960    /**
961     * The metadata to retrieve the information about the composer of
962     * the media source.
963     * @type { ?string }
964     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
965     * @since 11
966     */
967    /**
968     * Composer of the media asset. This parameter is read-only in the current version.
969     * @type { ?string }
970     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
971     * @crossplatform
972     * @since 12
973     */
974    composer?: string;
975
976    /**
977     * The metadata to retrieve the playback duration of the media source.
978     * @type { ?string }
979     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
980     * @since 11
981     */
982    /**
983     * Duration of the media asset. This parameter is read-only in the current version.
984     * @type { ?string }
985     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
986     * @crossplatform
987     * @since 12
988     */
989    duration?: string;
990
991    /**
992     * The metadata to retrieve the content type or genre of the data
993     * source.
994     * @type { ?string }
995     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
996     * @since 11
997     */
998    /**
999     * Type or genre of the media asset.
1000     * @type { ?string }
1001     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1002     * @crossplatform
1003     * @since 12
1004     */
1005    genre?: string;
1006
1007    /**
1008     * If this value exists the media contains audio content.
1009     * @type { ?string }
1010     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1011     * @since 11
1012     */
1013    /**
1014     * Whether the media asset contains audio. This parameter is read-only in the current version.
1015     * @type { ?string }
1016     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1017     * @crossplatform
1018     * @since 12
1019     */
1020    hasAudio?: string;
1021
1022    /**
1023     * If this value exists the media contains video content.
1024     * @type { ?string }
1025     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1026     * @since 11
1027     */
1028    /**
1029     * Whether the media asset contains a video. This parameter is read-only in the current version.
1030     * @type { ?string }
1031     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1032     * @crossplatform
1033     * @since 12
1034     */
1035    hasVideo?: string;
1036
1037    /**
1038     * The metadata to retrieve the mime type of the media source. Some
1039     * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb",
1040     * @type { ?string }
1041     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1042     * @since 11
1043     */
1044    /**
1045     * MIME type of the media asset. This parameter is read-only in the current version.
1046     * Some example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb".
1047     * @type { ?string }
1048     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1049     * @crossplatform
1050     * @since 12
1051     */
1052    mimeType?: string;
1053
1054    /**
1055     * The metadata to retrieve the number of tracks, such as audio, video,
1056     * text, in the media source, such as a mp4 or 3gpp file.
1057     * @type { ?string }
1058     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1059     * @since 11
1060     */
1061    /**
1062     * Number of tracks of the media asset. This parameter is read-only in the current version.
1063     * @type { ?string }
1064     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1065     * @crossplatform
1066     * @since 12
1067     */
1068    trackCount?: string;
1069
1070    /**
1071     * It is the audio sample rate, if available.
1072     * @type { ?string }
1073     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1074     * @since 11
1075     */
1076    /**
1077     * Audio sampling rate, in Hz. This parameter is read-only in the current version.
1078     * @type { ?string }
1079     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1080     * @crossplatform
1081     * @since 12
1082     */
1083    sampleRate?: string;
1084
1085    /**
1086     * The metadata to retrieve the media source title.
1087     * @type { ?string }
1088     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1089     * @since 11
1090     */
1091    /**
1092     * Title of the media asset. This parameter is read-only in the current version.
1093     * This parameter is read-only in the current version.
1094     * @type { ?string }
1095     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1096     * @crossplatform
1097     * @since 12
1098     */
1099    title?: string;
1100
1101    /**
1102     * If the media contains video, this key retrieves its height.
1103     * @type { ?string }
1104     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1105     * @since 11
1106     */
1107    /**
1108     * Video height, in px. This parameter is read-only in the current version.
1109     * @type { ?string }
1110     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1111     * @crossplatform
1112     * @since 12
1113     */
1114    videoHeight?: string;
1115
1116    /**
1117     * If the media contains video, this key retrieves its width.
1118     * @type { ?string }
1119     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1120     * @since 11
1121     */
1122    /**
1123     * Video width, in px. This parameter is read-only in the current version.
1124     * @type { ?string }
1125     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1126     * @crossplatform
1127     * @since 12
1128     */
1129    videoWidth?: string;
1130
1131    /**
1132     * The metadata to retrieve the information about the video
1133     * orientation.
1134     * @type { ?string }
1135     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1136     * @since 11
1137     */
1138    /**
1139     * Video rotation direction, in degrees.
1140     * @type { ?string }
1141     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1142     * @crossplatform
1143     * @since 12
1144     */
1145    videoOrientation?: string;
1146
1147     /**
1148     * HDR type of the media asset. This parameter is read-only in the current version.
1149     * @type { ?HdrType }
1150     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1151     * @crossplatform
1152     * @since 12
1153     */
1154    hdrType?: HdrType;
1155
1156    /**
1157     * Geographical location of the media asset.
1158     * @type { ?Location }
1159     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1160     * @since 12
1161     */
1162    location?: Location;
1163
1164    /**
1165     * Custom key-value mappings obtained from **moov.meta.list**.
1166     * @type { ?Record<string, string> }
1167     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1168     * @since 12
1169     */
1170    customInfo?: Record<string, string>;
1171
1172    /**
1173     * Tracks info of the media asset. This parameter is read-only in the current version.
1174     * @type { ?Array<MediaDescription> }
1175     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
1176     * @since 20
1177     * @arkts 1.1&1.2
1178     */
1179    tracks?: Array<MediaDescription>;
1180  }
1181
1182  /**
1183   * This interface is used to define the output image size.
1184   * @typedef OutputSize
1185   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1186   * @since 20
1187   */
1188  declare interface OutputSize {
1189    /**
1190     * The expected output frame image width.
1191     * If the value is less than 0, the width will be the orginal width of the video.
1192     * If the value is 0 or no value is assigned, the scaling ratio will follow the specified height.
1193     * If both width and height is not assigned, the output will be the original size of video frame.
1194     * @type { ?number }
1195     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1196     * @since 20
1197     */
1198    width?:number;
1199    /**
1200     * The expected output frame image height.
1201     * If the value is less than 0, the height will be the orginal height of the video.
1202     * If the value is 0 or no value is assigned, the scaling ratio will follow the specified width.
1203     * If both width and height is not assigned, the output will be the original size of video frame.
1204     * @type { ?number }
1205     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1206     * @since 20
1207     */
1208    height?: number;
1209  }
1210
1211  /**
1212   * Enumerates options about the HDR Type of the video.
1213   * @enum { number }
1214   * @syscap SystemCapability.Multimedia.Media.Core
1215   * @crossplatform
1216   * @since 12
1217   */
1218  enum HdrType {
1219    /**
1220     * This option is used to mark none HDR type.
1221     * @syscap SystemCapability.Multimedia.Media.Core
1222     * @crossplatform
1223     * @since 12
1224     */
1225    AV_HDR_TYPE_NONE = 0,
1226
1227    /**
1228     * This option is used to mark HDR Vivid type.
1229     * @syscap SystemCapability.Multimedia.Media.Core
1230     * @crossplatform
1231     * @since 12
1232     */
1233    AV_HDR_TYPE_VIVID = 1,
1234  }
1235
1236  /**
1237   * Provides APIs to obtain a thumbnail from a video. Before calling any API of **AVImageGenerator**,
1238   * you must use [createAVImageGenerator()]{@link #createAVImageGenerator} to create an **AVImageGenerator** instance.
1239   *
1240   * @typedef AVImageGenerator
1241   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1242   * @since 12
1243   */
1244  interface AVImageGenerator {
1245    /**
1246     * Media file descriptor, which specifies the data source.
1247     *
1248     * **Example:**
1249     *
1250     * There is a media file that stores continuous assets, the address offset is 0, and the byte length is 100.
1251     * Its file descriptor is **AVFileDescriptor { fd = resourceHandle; offset = 0; length = 100; }**.
1252     *
1253     * **NOTE**
1254     * - After the resource handle (FD) is transferred to an **AVImageGenerator** instance,
1255     * do not use the resource handle to perform other read and write operations, including but not limited to
1256     * transferring this handle to other **AVPlayer**, **AVMetadataExtractor**, **AVImageGenerator**,
1257     * or **AVTranscoder** instance. Competition occurs when multiple **AVImageGenerator**
1258     * use the same resource handle to read and write files at the same time, resulting in errors in obtaining data.
1259     * @type { ?AVFileDescriptor }
1260     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1261     * @since 12
1262     */
1263    fdSrc ?: AVFileDescriptor;
1264
1265    /**
1266     * Obtains a video thumbnail. This API uses an asynchronous callback to return the result.
1267     * @param { number } timeUs - Time of the video for which a thumbnail is to be obtained, in μs.
1268     * @param { AVImageQueryOptions } options - Relationship between the time passed in and the video frame.
1269     * @param { PixelMapParams } param - Format parameters of the thumbnail to be obtained.
1270     * @param { AsyncCallback<image.PixelMap> } callback - Callback used to return the result. If the operation is
1271     * successful, **err** is **undefined** and **data** is the **PixelMap** instance obtained; otherwise,
1272     * **err** is an error object.
1273     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
1274     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
1275     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1276     * @since 12
1277     */
1278    fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams,
1279      callback: AsyncCallback<image.PixelMap>): void;
1280
1281    /**
1282     * Obtains a video thumbnail. This API uses a promise to return the result.
1283     * @param { number } timeUs - Time of the video for which a thumbnail is to be obtained, in μs.
1284     * @param { AVImageQueryOptions } options - Relationship between the time passed in and the video frame.
1285     * @param { PixelMapParams } param - Format parameters of the thumbnail to be obtained.
1286     * @returns { Promise<image.PixelMap> } Promise used to return the video thumbnail.
1287     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
1288     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
1289     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1290     * @since 12
1291     */
1292    fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams): Promise<image.PixelMap>;
1293
1294    /**
1295     * Supports extracting video thumbnails by proportional scaling
1296     * @param { number } timeUs - The time expected to fetch picture from the video resource.
1297     * The unit is microsecond(us).
1298     * @param { AVImageQueryOptions } queryMode - Specify how to position the video frame
1299     * @param { OutputSize } outputSize - This field is used to define the output size of frame.
1300     * @returns { Promise<image.PixelMap> }  Returns the output image object
1301     * @throws { BusinessError  } 5400102 Operation not allowed. Returned by promise.
1302     * @throws { BusinessError  } 5400106 Unsupported format. Returned by promise.
1303     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1304     * @since 20
1305     */
1306    fetchScaledFrameByTime(timeUs: number, queryMode: AVImageQueryOptions, outputSize?: OutputSize):
1307      Promise<image.PixelMap>;
1308
1309    /**
1310     * Releases this **AVImageGenerator** instance. This API uses an asynchronous callback to return the result.
1311     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
1312     * **err** is **undefined**; otherwise, **err** is an error object.
1313     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
1314     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1315     * @since 12
1316     */
1317    release(callback: AsyncCallback<void>): void;
1318
1319    /**
1320     * Releases this **AVImageGenerator** instance. This API uses a promise to return the result.
1321     * @returns { Promise<void> } Promise that returns no value.
1322     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
1323     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1324     * @since 12
1325     */
1326    release(): Promise<void>;
1327  }
1328
1329  /**
1330   * Enumerates the relationship between the video frame and the time at which the video thumbnail is obtained.
1331   *
1332   * The time passed in for obtaining the thumbnail may be different from the time of the video frame for which
1333   * the thumbnail is actually obtained. Therefore, you need to specify their relationship.
1334   * @enum { number }
1335   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1336   * @since 12
1337   */
1338  enum AVImageQueryOptions {
1339    /**
1340     * The key frame at or next to the specified time is selected.
1341     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1342     * @since 12
1343     */
1344    AV_IMAGE_QUERY_NEXT_SYNC,
1345
1346    /**
1347     * The key frame at or prior to the specified time is selected.
1348     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1349     * @since 12
1350     */
1351    AV_IMAGE_QUERY_PREVIOUS_SYNC,
1352
1353    /**
1354     * The key frame closest to the specified time is selected.
1355     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1356     * @since 12
1357     */
1358    AV_IMAGE_QUERY_CLOSEST_SYNC,
1359
1360    /**
1361     * The frame (not necessarily a key frame) closest to the specified time is selected.
1362     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1363     * @since 12
1364     */
1365    AV_IMAGE_QUERY_CLOSEST,
1366  }
1367
1368  /**
1369   * Defines the format parameters of the video thumbnail to be obtained.
1370   * @typedef PixelMapParams
1371   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1372   * @since 12
1373   */
1374  interface PixelMapParams {
1375    /**
1376     * Width of the thumbnail. The value must be greater than 0 and less than or equal to the width of the original
1377     * video. Otherwise, the returned thumbnail will not be scaled.
1378     * @type { ?number }
1379     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1380     * @since 12
1381     */
1382    width?: number;
1383
1384    /**
1385     * Height of the thumbnail. The value must be greater than 0 and less than or equal to the height of the original
1386     * video. Otherwise, the returned thumbnail will not be scaled.
1387     * @type { ?number }
1388     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1389     * @since 12
1390     */
1391    height?: number;
1392
1393    /**
1394     * Color format of the thumbnail.
1395     *
1396     * **System API**: This is a system API.
1397     * @type { ?PixelFormat }
1398     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1399     * @systemapi
1400     * @since 11
1401     */
1402    colorFormat?: PixelFormat;
1403  }
1404
1405  /**
1406   * Enumerates the color formats supported by the video thumbnail.
1407   * @enum { number }
1408   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1409   * @systemapi
1410   * @since 11
1411   */
1412  enum PixelFormat {
1413    /**
1414     * RGB_565.
1415     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1416     * @systemapi
1417     * @since 11
1418     */
1419    RGB_565 = 2,
1420
1421    /**
1422     * RGBA_8888.
1423     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1424     * @systemapi
1425     * @since 11
1426     */
1427    RGBA_8888 = 3,
1428
1429    /**
1430     * RGB_888.
1431     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1432     * @systemapi
1433     * @since 11
1434     */
1435    RGB_888 = 5,
1436  }
1437
1438  /**
1439    * Enumerates ErrorCode types, return in BusinessError::code.
1440    *
1441    * @enum { number }
1442    * @syscap SystemCapability.Multimedia.Media.Core
1443    * @since 9
1444    */
1445  /**
1446   * Enumerates ErrorCode types, return in BusinessError::code.
1447   *
1448   * @enum { number }
1449   * @syscap SystemCapability.Multimedia.Media.Core
1450   * @atomicservice
1451   * @since 11
1452   */
1453  /**
1454   * Enumerates the media error codes, return in BusinessError::code.
1455   *
1456   * @enum { number }
1457   * @syscap SystemCapability.Multimedia.Media.Core
1458   * @crossplatform
1459   * @atomicservice
1460   * @since 12
1461   */
1462  enum AVErrorCode {
1463    /**
1464     * Operation success.
1465     * @syscap SystemCapability.Multimedia.Media.Core
1466     * @since 9
1467     */
1468    /**
1469     * Operation success.
1470     * @syscap SystemCapability.Multimedia.Media.Core
1471     * @atomicservice
1472     * @since 11
1473     */
1474    /**
1475     * Operation success.
1476     * @syscap SystemCapability.Multimedia.Media.Core
1477     * @crossplatform
1478     * @atomicservice
1479     * @since 12
1480     */
1481    AVERR_OK = 0,
1482
1483    /**
1484     * Permission denied.
1485     * @syscap SystemCapability.Multimedia.Media.Core
1486     * @since 9
1487     */
1488    /**
1489     * Permission denied.
1490     * @syscap SystemCapability.Multimedia.Media.Core
1491     * @atomicservice
1492     * @since 11
1493     */
1494    /**
1495     * Permission denied.
1496     * @syscap SystemCapability.Multimedia.Media.Core
1497     * @crossplatform
1498     * @atomicservice
1499     * @since 12
1500     */
1501    AVERR_NO_PERMISSION = 201,
1502
1503    /**
1504     * Invalid parameter.
1505     * @syscap SystemCapability.Multimedia.Media.Core
1506     * @since 9
1507     */
1508    /**
1509     * Invalid parameter.
1510     * @syscap SystemCapability.Multimedia.Media.Core
1511     * @atomicservice
1512     * @since 11
1513     */
1514    /**
1515     * Invalid parameter.
1516     * @syscap SystemCapability.Multimedia.Media.Core
1517     * @crossplatform
1518     * @atomicservice
1519     * @since 12
1520     */
1521    AVERR_INVALID_PARAMETER = 401,
1522
1523    /**
1524     * The api is not supported in the current version.
1525     * @syscap SystemCapability.Multimedia.Media.Core
1526     * @since 9
1527     */
1528    /**
1529     * The api is not supported in the current version.
1530     * @syscap SystemCapability.Multimedia.Media.Core
1531     * @atomicservice
1532     * @since 11
1533     */
1534    /**
1535     * The api is not supported in the current version.
1536     * @syscap SystemCapability.Multimedia.Media.Core
1537     * @crossplatform
1538     * @atomicservice
1539     * @since 12
1540     */
1541    AVERR_UNSUPPORT_CAPABILITY = 801,
1542
1543    /**
1544     * The system memory is insufficient or the number of services reaches the upper limit.
1545     * @syscap SystemCapability.Multimedia.Media.Core
1546     * @since 9
1547     */
1548    /**
1549     * The system memory is insufficient or the number of services reaches the upper limit.
1550     * @syscap SystemCapability.Multimedia.Media.Core
1551     * @atomicservice
1552     * @since 11
1553     */
1554    /**
1555     * The system memory is insufficient or the number of services reaches the upper limit.
1556     * @syscap SystemCapability.Multimedia.Media.Core
1557     * @crossplatform
1558     * @atomicservice
1559     * @since 12
1560     */
1561    AVERR_NO_MEMORY = 5400101,
1562
1563    /**
1564     * Current status does not allow or do not have permission to perform this operation.
1565     * @syscap SystemCapability.Multimedia.Media.Core
1566     * @since 9
1567     */
1568    /**
1569     * Current status does not allow or do not have permission to perform this operation.
1570     * @syscap SystemCapability.Multimedia.Media.Core
1571     * @atomicservice
1572     * @since 11
1573     */
1574    /**
1575     * Current status does not allow or do not have permission to perform this operation.
1576     * @syscap SystemCapability.Multimedia.Media.Core
1577     * @crossplatform
1578     * @atomicservice
1579     * @since 12
1580     */
1581    AVERR_OPERATE_NOT_PERMIT = 5400102,
1582
1583    /**
1584     * Data flow exception information.
1585     * @syscap SystemCapability.Multimedia.Media.Core
1586     * @since 9
1587     */
1588    /**
1589     * Data flow exception information.
1590     * @syscap SystemCapability.Multimedia.Media.Core
1591     * @atomicservice
1592     * @since 11
1593     */
1594    /**
1595     * Data flow exception information.
1596     * @syscap SystemCapability.Multimedia.Media.Core
1597     * @crossplatform
1598     * @atomicservice
1599     * @since 12
1600     */
1601    AVERR_IO = 5400103,
1602
1603    /**
1604     * System or network response timeout.
1605     * @syscap SystemCapability.Multimedia.Media.Core
1606     * @since 9
1607     */
1608    /**
1609     * System or network response timeout.
1610     * @syscap SystemCapability.Multimedia.Media.Core
1611     * @atomicservice
1612     * @since 11
1613     */
1614    /**
1615     * System or network response timeout.
1616     * @syscap SystemCapability.Multimedia.Media.Core
1617     * @crossplatform
1618     * @atomicservice
1619     * @since 12
1620     */
1621    AVERR_TIMEOUT = 5400104,
1622
1623    /**
1624     * Service process died.
1625     * @syscap SystemCapability.Multimedia.Media.Core
1626     * @since 9
1627     */
1628    /**
1629     * Service process died.
1630     * @syscap SystemCapability.Multimedia.Media.Core
1631     * @atomicservice
1632     * @since 11
1633     */
1634    /**
1635     * Service process died.
1636     * @syscap SystemCapability.Multimedia.Media.Core
1637     * @crossplatform
1638     * @atomicservice
1639     * @since 12
1640     */
1641    AVERR_SERVICE_DIED = 5400105,
1642
1643    /**
1644     * Unsupported media format.
1645     * @syscap SystemCapability.Multimedia.Media.Core
1646     * @since 9
1647     */
1648    /**
1649     * Unsupported media format.
1650     * @syscap SystemCapability.Multimedia.Media.Core
1651     * @atomicservice
1652     * @since 11
1653     */
1654    /**
1655     * Unsupported media format.
1656     * @syscap SystemCapability.Multimedia.Media.Core
1657     * @crossplatform
1658     * @atomicservice
1659     * @since 12
1660     */
1661    AVERR_UNSUPPORT_FORMAT = 5400106,
1662
1663    /**
1664     * Audio interrupted.
1665     * @syscap SystemCapability.Multimedia.Media.Core
1666     * @atomicservice
1667     * @since 11
1668     */
1669    /**
1670     * Audio interrupted.
1671     * @syscap SystemCapability.Multimedia.Media.Core
1672     * @crossplatform
1673     * @atomicservice
1674     * @since 12
1675     */
1676    AVERR_AUDIO_INTERRUPTED = 5400107,
1677    /**
1678     * The parameter value means session does not exist
1679     * @syscap SystemCapability.Multimedia.Media.Core
1680     * @systemapi
1681     * @since 20
1682     * @arkts 1.1&1.2
1683     */
1684    AVERR_SESSION_NOT_EXIST = 5400109,
1685    /**
1686     * The address of server is incorrect, and IO can not find host.
1687     * @syscap SystemCapability.Multimedia.Media.Core
1688     * @crossplatform
1689     * @atomicservice
1690     * @since 14
1691     */
1692    AVERR_IO_HOST_NOT_FOUND = 5411001,
1693    /**
1694     * Network connection timeout.
1695     * @syscap SystemCapability.Multimedia.Media.Core
1696     * @crossplatform
1697     * @atomicservice
1698     * @since 14
1699     */
1700    AVERR_IO_CONNECTION_TIMEOUT = 5411002,
1701    /**
1702     * Failed link due to abnormal network.
1703     * @syscap SystemCapability.Multimedia.Media.Core
1704     * @crossplatform
1705     * @atomicservice
1706     * @since 14
1707     */
1708    AVERR_IO_NETWORK_ABNORMAL = 5411003,
1709    /**
1710     * Failed link due to unavailable network.
1711     * @syscap SystemCapability.Multimedia.Media.Core
1712     * @crossplatform
1713     * @atomicservice
1714     * @since 14
1715     */
1716    AVERR_IO_NETWORK_UNAVAILABLE = 5411004,
1717    /**
1718     * Network permission dennied.
1719     * @syscap SystemCapability.Multimedia.Media.Core
1720     * @crossplatform
1721     * @atomicservice
1722     * @since 14
1723     */
1724    AVERR_IO_NO_PERMISSION = 5411005,
1725    /**
1726     * The client request parameters are incorrect or exceed the processing capacity.
1727     * @syscap SystemCapability.Multimedia.Media.Core
1728     * @crossplatform
1729     * @atomicservice
1730     * @since 14
1731     */
1732    AVERR_IO_REQUEST_DENIED = 5411006,
1733    /**
1734     * Cannot find available network resources.
1735     * @syscap SystemCapability.Multimedia.Media.Core
1736     * @crossplatform
1737     * @atomicservice
1738     * @since 14
1739     */
1740    AVERR_IO_RESOURCE_NOT_FOUND = 5411007,
1741    /**
1742     * The server failS to verify the client certificate because the certificate is not carried,
1743     * the certificate is invalid, or the certificate is expired.
1744     * @syscap SystemCapability.Multimedia.Media.Core
1745     * @crossplatform
1746     * @atomicservice
1747     * @since 14
1748     */
1749    AVERR_IO_SSL_CLIENT_CERT_NEEDED = 5411008,
1750    /**
1751     * The client fails to verify the server certificate because the certificate is not carried,
1752     * the certificate is invalid, or the certificate is expired.
1753     * @syscap SystemCapability.Multimedia.Media.Core
1754     * @crossplatform
1755     * @atomicservice
1756     * @since 14
1757     */
1758    AVERR_IO_SSL_CONNECTION_FAILED = 5411009,
1759    /**
1760     * IO SSL server cert untrusted.
1761     * @syscap SystemCapability.Multimedia.Media.Core
1762     * @crossplatform
1763     * @atomicservice
1764     * @since 14
1765     */
1766    AVERR_IO_SSL_SERVER_CERT_UNTRUSTED = 5411010,
1767    /**
1768     * Unsupported request due to network protocols.
1769     * @syscap SystemCapability.Multimedia.Media.Core
1770     * @crossplatform
1771     * @atomicservice
1772     * @since 14
1773     */
1774    AVERR_IO_UNSUPPORTED_REQUEST = 5411011,
1775    /**
1776     * Seek continuous unsupported.
1777     * @syscap SystemCapability.Multimedia.Media.Core
1778     * @atomicservice
1779     * @since 18
1780     */
1781    AVERR_SEEK_CONTINUOUS_UNSUPPORTED = 5410002,
1782
1783    /**
1784     * Super-resolution unsupported.
1785     * @syscap SystemCapability.Multimedia.Media.Core
1786     * @atomicservice
1787     * @since 18
1788     */
1789    AVERR_SUPER_RESOLUTION_UNSUPPORTED = 5410003,
1790
1791    /**
1792     * No PlaybackStrategy set to enable super-resolution feature.
1793     * @syscap SystemCapability.Multimedia.Media.Core
1794     * @atomicservice
1795     * @since 18
1796     */
1797    AVERR_SUPER_RESOLUTION_NOT_ENABLED = 5410004,
1798
1799    /**
1800     * The parameter value is out of the specified range.
1801     * @syscap SystemCapability.Multimedia.Media.Core
1802     * @atomicservice
1803     * @since 20
1804     * @arkts 1.1&1.2
1805     */
1806    AVERR_PARAMETER_OUT_OF_RANGE = 5400108,
1807  }
1808
1809  /**
1810   * Describes AVPlayer states.
1811   * @typedef {'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'}
1812   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1813   * @since 9
1814
1815   */
1816  /**
1817   * Describes AVPlayer states.
1818   * @typedef {'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'}
1819   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1820   * @atomicservice
1821   * @since 11
1822
1823   */
1824  /**
1825   * Enumerates the states of the AVPlayer. Your application can proactively obtain the AVPlayer state through the
1826   * **state** attribute or obtain the reported AVPlayer state by subscribing to the
1827   * [stateChange]{@link #stateChange} event.
1828   * @typedef {'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'}
1829   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1830   * @crossplatform
1831   * @atomicservice
1832   * @since 12
1833   */
1834  type AVPlayerState = 'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error';
1835
1836  /**
1837   * Describes the callback invoked for the track change event.
1838   * @typedef { function } OnTrackChangeHandler
1839   * @param { number } index - index number for change Track.
1840   * @param { boolean } isSelected - Status of the track, that is, whether the track is selected.
1841   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1842   * @atomicservice
1843   * @since 12
1844   */
1845  type OnTrackChangeHandler = (index: number, isSelected: boolean) => void;
1846
1847  /**
1848   * Describes the callback invoked for the AVPlayer state change event.
1849   *
1850   * @typedef { function } OnAVPlayerStateChangeHandle
1851   * @param { AVPlayerState } state - state for AVPlayer.
1852   * @param { StateChangeReason } reason - reason for state change.
1853   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1854   * @crossplatform
1855   * @atomicservice
1856   * @since 12
1857   */
1858  type OnAVPlayerStateChangeHandle = (state: AVPlayerState, reason: StateChangeReason) => void;
1859
1860  /**
1861   * Describes the callback invoked for the buffering update event.
1862   *
1863   * @typedef { function } OnBufferingUpdateHandler
1864   * @param { BufferingInfoType } infoType - define the Buffering info Type.
1865   * @param { number } value - define the value of buffering info type if exist.
1866   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1867   * @crossplatform
1868   * @atomicservice
1869   * @since 12
1870   */
1871  type OnBufferingUpdateHandler = (infoType: BufferingInfoType, value: number) => void;
1872
1873  /**
1874   * Describes the callback invoked for the video size change event.
1875   *
1876   * @typedef { function } OnVideoSizeChangeHandler
1877   * @param { number } width - Value of video Width.
1878   * @param { number } height - Value of video Height.
1879   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1880   * @crossplatform
1881   * @atomicservice
1882   * @since 12
1883   */
1884  type OnVideoSizeChangeHandler = (width: number, height: number) => void;
1885
1886  /**
1887   * Describes the callback used to listen for video super resolution status changes. If super resolution is enabled by
1888   * using PlaybackStrategy, this callback is invoked to report the super resolution status changes. It is also invoked
1889   * to report the initial status when the video starts. However, this callback is not invoked when super resolution is
1890   * not enabled.
1891   *
1892   * Super resolution is automatically disabled in either of the following cases:
1893   *
1894   * 1.The current super resolution algorithm only works with videos that have a frame rate of 30 fps or lower. If the
1895   * video frame rate exceeds 30 fps, or if the input frame rate exceeds the processing capability of the super
1896   * resolution algorithm in scenarios such as fast playback, super resolution is automatically disabled.
1897   *
1898   * 2.The current super resolution algorithm supports input resolutions from 320 x 320 to 1920 x 1080, in px. If the
1899   * input video resolution exceeds the range during playback, super resolution is automatically disabled.
1900   *
1901   * @typedef { function } OnSuperResolutionChanged
1902   * @param { boolean } enabled - Whether super resolution is enabled. The value **true** means that it is enabled,
1903   * and **false** means the opposite.
1904   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1905   * @atomicservice
1906   * @since 18
1907   */
1908  type OnSuperResolutionChanged = (enabled: boolean) => void;
1909
1910  /**
1911   * Describes the information of an SEI message.
1912   *
1913   * @typedef SeiMessage
1914   * @syscap SystemCapability.Multimedia.Media.Core
1915   * @atomicservice
1916   * @since 18
1917   */
1918  interface SeiMessage {
1919    /**
1920     * Payload type of SEI message.
1921     * @type { number }
1922     * @syscap SystemCapability.Multimedia.Media.Core
1923     * @atomicservice
1924     * @since 18
1925     */
1926    payloadType: number;
1927
1928    /**
1929     * Payload data of SEI message.
1930     * @type { ArrayBuffer }
1931     * @syscap SystemCapability.Multimedia.Media.Core
1932     * @atomicservice
1933     * @since 18
1934     */
1935    payload: ArrayBuffer;
1936  }
1937
1938  /**
1939   * Describes the handle used to obtain SEI messages. This is used when in subscriptions to SEI message events,
1940   * and the callback returns detailed SEI information.
1941   *
1942   * @typedef { function } OnSeiMessageHandle
1943   * @param { Array<SeiMessage> } messages - SEI messages.
1944   * @param { ?number } playbackPosition - playback position.
1945   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1946   * @atomicservice
1947   * @since 18
1948   */
1949  type OnSeiMessageHandle = (messages: Array<SeiMessage>, playbackPosition?: number) => void;
1950
1951  /**
1952   * Defines the OnPlaybackRateDone callback.
1953   *
1954   * @typedef { function } OnPlaybackRateDone
1955   * @param { number } rate - playback rate.
1956   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1957   * @atomicservice
1958   * @since 20
1959   */
1960  type OnPlaybackRateDone = (rate: number) => void;
1961
1962  /**
1963   * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer()
1964   * to create an AVPlayer instance.
1965   *
1966   * @typedef AVPlayer
1967   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1968   * @since 9
1969   */
1970  /**
1971   * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer()
1972   * to create an AVPlayer instance.
1973   *
1974   * @typedef AVPlayer
1975   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1976   * @atomicservice
1977   * @since 11
1978   */
1979  /**
1980   * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer()
1981   * to create an **AVPlayer** instance.
1982   * <br>For details about the audio and video playback demo, see Audio Playback and Video Playback.
1983   * <br>**NOTE:**<br>
1984   * When using the **AVPlayer** instance, you are advised to register the following callbacks to proactively
1985   * obtain status changes:
1986   *
1987   * on('stateChange'): listens for AVPlayer state changes.
1988   *
1989   * on('error'): listens for error events.
1990   *
1991   * @typedef AVPlayer
1992   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1993   * @crossplatform
1994   * @atomicservice
1995   * @since 12
1996   */
1997  interface AVPlayer {
1998    /**
1999     * Prepare audio/video playback, it will request resource for playing. This API can be called
2000     * only when the AVPlayer is in the initialized state.
2001     * @param { AsyncCallback<void> } callback used to return the result when prepare completed.
2002     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2003     * @throws { BusinessError } 5400106 - Unsupported format. Return by callback.
2004     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2005     * @since 9
2006     */
2007    /**
2008     * Prepare audio/video playback, it will request resource for playing. This API can be called
2009     * only when the AVPlayer is in the initialized state.
2010     * @param { AsyncCallback<void> } callback used to return the result when prepare completed.
2011     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2012     * @throws { BusinessError } 5400106 - Unsupported format. Return by callback.
2013     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2014     * @atomicservice
2015     * @since 11
2016     */
2017    /**
2018     * Prepare audio/video playback, it will request resource for playing. This API can be called only
2019     * when the AVPlayer is in the initialized state.
2020     *
2021     * <p>If your application frequently switches between short videos, you can create multiple AVPlayer
2022     * objects to prepare the next video in advance, thereby improving the switching performance.
2023     * For details, see [Smooth Switchover Between Online Short Videos]{@link
2024     * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.</p>
2025     *
2026     * @param { AsyncCallback<void> } callback used to return the result when prepare completed.
2027     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2028     * @throws { BusinessError } 5400106 - Unsupported format. Return by callback.
2029     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2030     * @crossplatform
2031     * @atomicservice
2032     * @since 12
2033     */
2034    prepare(callback: AsyncCallback<void>): void;
2035
2036    /**
2037     * Prepare audio/video playback, it will request resource for playing. This API can be called
2038     * only when the AVPlayer is in the initialized state.
2039     * @returns { Promise<void> } A Promise instance used to return the operation result.
2040     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2041     * @throws { BusinessError } 5400106 - Unsupported format. Return by promise.
2042     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2043     * @since 9
2044     */
2045    /**
2046     * Prepare audio/video playback, it will request resource for playing. This API can be called
2047     * only when the AVPlayer is in the initialized state.
2048     * @returns { Promise<void> } A Promise instance used to return the operation result.
2049     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2050     * @throws { BusinessError } 5400106 - Unsupported format. Return by promise.
2051     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2052     * @atomicservice
2053     * @since 11
2054     */
2055    /**
2056     * Prepare audio/video playback, it will request resource for playing. This API can be called
2057     * only when the AVPlayer is in the initialized state.
2058     *
2059     * <p>If your application frequently switches between short videos, you can create multiple AVPlayer
2060     * objects to prepare the next video in advance, thereby improving the switching performance.
2061     * For details, see [Smooth Switchover Between Online Short Videos]{@link
2062     * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.</p>
2063     *
2064     * @returns { Promise<void> } A Promise instance used to return the operation result.
2065     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2066     * @throws { BusinessError } 5400106 - Unsupported format. Return by promise.
2067     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2068     * @crossplatform
2069     * @atomicservice
2070     * @since 12
2071     */
2072    prepare(): Promise<void>;
2073
2074    /**
2075     * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state.
2076     * @param { AsyncCallback<void> } callback used to return the result when play completed.
2077     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2078     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2079     * @since 9
2080     */
2081    /**
2082     * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state.
2083     * @param { AsyncCallback<void> } callback used to return the result when play completed.
2084     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2085     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2086     * @atomicservice
2087     * @since 11
2088     */
2089    /**
2090     * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state.
2091     * @param { AsyncCallback<void> } callback used to return the result when play completed.
2092     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2093     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2094     * @crossplatform
2095     * @atomicservice
2096     * @since 12
2097     */
2098    play(callback: AsyncCallback<void>): void;
2099
2100    /**
2101     * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state.
2102     * @returns { Promise<void> } A Promise instance used to return the operation result.
2103     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2104     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2105     * @since 9
2106     */
2107    /**
2108     * Play audio/video playback. This API can be called only when the AVplayer is in the prepared, paused or completed state.
2109     * @returns { Promise<void> } A Promise instance used to return the operation result.
2110     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2111     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2112     * @atomicservice
2113     * @since 11
2114     */
2115    /**
2116     * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state.
2117     * @returns { Promise<void> } A Promise instance used to return the operation result.
2118     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2119     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2120     * @crossplatform
2121     * @atomicservice
2122     * @since 12
2123     */
2124    play(): Promise<void>;
2125
2126    /**
2127     * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state.
2128     * @param { AsyncCallback<void> } callback used to return the result when pause completed.
2129     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2130     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2131     * @since 9
2132     */
2133    /**
2134     * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state.
2135     * @param { AsyncCallback<void> } callback used to return the result when pause completed.
2136     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2137     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2138     * @atomicservice
2139     * @since 11
2140     */
2141    /**
2142     * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state.
2143     * @param { AsyncCallback<void> } callback used to return the result when pause completed.
2144     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2145     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2146     * @crossplatform
2147     * @atomicservice
2148     * @since 12
2149     */
2150    pause(callback: AsyncCallback<void>): void;
2151
2152    /**
2153     * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state.
2154     * @returns { Promise<void> } A Promise instance used to return the operation result.
2155     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2156     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2157     * @since 9
2158     */
2159    /**
2160     * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state.
2161     * @returns { Promise<void> } A Promise instance used to return the operation result.
2162     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2163     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2164     * @atomicservice
2165     * @since 11
2166     */
2167    /**
2168     * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state.
2169     * @returns { Promise<void> } A Promise instance used to return the operation result.
2170     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2171     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2172     * @crossplatform
2173     * @atomicservice
2174     * @since 12
2175     */
2176    pause(): Promise<void>;
2177
2178    /**
2179     * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared,
2180     * playing, paused or completed state.
2181     * @param { AsyncCallback<void> } callback used to return the result when stop completed.
2182     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2183     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2184     * @since 9
2185     */
2186    /**
2187     * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared,
2188     * playing, paused or completed state.
2189     * @param { AsyncCallback<void> } callback used to return the result when stop completed.
2190     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2191     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2192     * @atomicservice
2193     * @since 11
2194     */
2195    /**
2196     * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared,
2197     * playing, paused or completed state.
2198     * @param { AsyncCallback<void> } callback used to return the result when stop completed.
2199     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2200     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2201     * @crossplatform
2202     * @atomicservice
2203     * @since 12
2204     */
2205    stop(callback: AsyncCallback<void>): void;
2206
2207    /**
2208     * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared,
2209     * playing, paused or completed state.
2210     * @returns { Promise<void> } A Promise instance used to return the operation result.
2211     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2212     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2213     * @since 9
2214     */
2215    /**
2216     * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared,
2217     * playing, paused or completed state.
2218     * @returns { Promise<void> } A Promise instance used to return the operation result.
2219     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2220     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2221     * @atomicservice
2222     * @since 11
2223     */
2224    /**
2225     * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared,
2226     * playing, paused or completed state.
2227     * @returns { Promise<void> } A Promise instance used to return the operation result.
2228     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2229     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2230     * @crossplatform
2231     * @atomicservice
2232     * @since 12
2233     */
2234    stop(): Promise<void>;
2235
2236    /**
2237     * Reset AVPlayer, it will be set to idle state and can set src again. This API can be called only when
2238     * the AVPlayer is in the initialized, prepared, playing, paused, completed, stopped or error state.
2239     * @param { AsyncCallback<void> } callback used to return the result when reset completed.
2240     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2241     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2242     * @since 9
2243     */
2244    /**
2245     * Reset AVPlayer, it will be set to idle state and can set src again. This API can be called only when
2246     * the AVPlayer is in the initialized, prepared, playing, paused, completed, stopped or error state.
2247     * @param { AsyncCallback<void> } callback used to return the result when reset completed.
2248     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2249     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2250     * @atomicservice
2251     * @since 11
2252     */
2253    /**
2254     * Reset AVPlayer, it will be set to idle state and can set src again. This API can be called only when
2255     * the AVPlayer is in the initialized, prepared, playing, paused, completed, stopped or error state.
2256     * @param { AsyncCallback<void> } callback used to return the result when reset completed.
2257     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2258     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2259     * @crossplatform
2260     * @atomicservice
2261     * @since 12
2262     */
2263    reset(callback: AsyncCallback<void>): void;
2264
2265    /**
2266     * Reset AVPlayer, it will be set to idle state and can set src again. This API can be called only when
2267     * the AVPlayer is in the initialized, prepared, playing, paused, completed, stopped or error state.
2268     * @returns { Promise<void> } A Promise instance used to return the operation result.
2269     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2270     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2271     * @since 9
2272     */
2273    /**
2274     * Reset AVPlayer, it will be set to idle state and can set src again. This API can be called only when
2275     * the AVPlayer is in the initialized, prepared, playing, paused, completed, stopped or error state.
2276     * @returns { Promise<void> } A Promise instance used to return the operation result.
2277     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2278     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2279     * @atomicservice
2280     * @since 11
2281     */
2282    /**
2283     * Reset AVPlayer, it will be set to idle state and can set src again. This API can be called only when
2284     * the AVPlayer is in the initialized, prepared, playing, paused, completed, stopped or error state.
2285     * @returns { Promise<void> } A Promise instance used to return the operation result.
2286     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2287     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2288     * @crossplatform
2289     * @atomicservice
2290     * @since 12
2291     */
2292    reset(): Promise<void>;
2293
2294    /**
2295     * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released.
2296     * @param { AsyncCallback<void> } callback used to return the result when release completed.
2297     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2298     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2299     * @since 9
2300     */
2301    /**
2302     * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released.
2303     * @param { AsyncCallback<void> } callback used to return the result when release completed.
2304     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2305     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2306     * @atomicservice
2307     * @since 11
2308     */
2309    /**
2310     * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released.
2311     * @param { AsyncCallback<void> } callback used to return the result when release completed.
2312     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2313     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2314     * @crossplatform
2315     * @atomicservice
2316     * @since 12
2317     */
2318    release(callback: AsyncCallback<void>): void;
2319
2320    /**
2321     * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released.
2322     * @returns { Promise<void> } A Promise instance used to return the operation result.
2323     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2324     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2325     * @since 9
2326     */
2327    /**
2328     * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released.
2329     * @returns { Promise<void> } A Promise instance used to return the operation result.
2330     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2331     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2332     * @atomicservice
2333     * @since 11
2334     */
2335    /**
2336     * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released.
2337     * @returns { Promise<void> } A Promise instance used to return the operation result.
2338     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2339     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2340     * @crossplatform
2341     * @atomicservice
2342     * @since 12
2343     */
2344    release(): Promise<void>;
2345
2346    /**
2347     * Jumps to the specified playback position. This API can be called only when the AVPlayer is in the prepared,
2348     * playing, paused, or completed state.
2349     * @param { number } timeMs - Playback position to jump, should be in [0, duration].
2350     * @param { SeekMode } mode - See @SeekMode .
2351     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2352     * @since 9
2353     */
2354    /**
2355     * Jumps to the specified playback position. This API can be called only when the AVPlayer is in the prepared,
2356     * playing, paused, or completed state.
2357     * @param { number } timeMs - Playback position to jump, should be in [0, duration].
2358     * @param { SeekMode } mode - See @SeekMode .
2359     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2360     * @atomicservice
2361     * @since 11
2362     */
2363    /**
2364     * Jumps to the specified playback position. This API can be called only when the AVPlayer is in the prepared,
2365     * playing, paused, or completed state.
2366     * You can check whether the seek operation takes effect by subscribing to the [seekDone]{@link #seekDone} event.
2367     * This API is not supported in live mode.
2368     * @param { number } timeMs - Playback position to jump, should be in [0, duration]. In SEEK_CONTINUOU mode,
2369     * the value -1 can be used to indicate the end of SEEK_CONTINUOUS mode.
2370     * @param { SeekMode } mode - See @SeekMode . The default value is **SEEK_PREV_SYNC**.
2371     * Set this parameter only for video playback.
2372     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2373     * @crossplatform
2374     * @atomicservice
2375     * @since 12
2376     */
2377    seek(timeMs: number, mode?: SeekMode): void;
2378
2379    /**
2380     * Sets the volume.
2381     * @param { number } volume - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
2382     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2383     * @since 9
2384     */
2385    /**
2386     * Sets the volume. This API can be called only when the AVPlayer is in the prepared, playing,
2387     * paused, or completed state.
2388     * You can check whether the setting takes effect by subscribing to the volumeChange event.
2389     * @param { number } volume - Relative volume. The value ranges from 0.00 to 1.00.
2390     * The value **1.00** indicates the maximum volume (100%).
2391     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2392     * @crossplatform
2393     * @atomicservice
2394     * @since 12
2395     */
2396    setVolume(volume: number): void;
2397
2398    /**
2399     * Get all track infos in MediaDescription, should be called after data loaded callback.
2400     * @param { AsyncCallback<Array<MediaDescription>> } callback - Async callback return track info in MediaDescription.
2401     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2402     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2403     * @since 9
2404     */
2405    /**
2406     * Get all track infos in MediaDescription, should be called after data loaded callback.
2407     * @param { AsyncCallback<Array<MediaDescription>> } callback - Async callback return track info in MediaDescription.
2408     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2409     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2410     * @atomicservice
2411     * @since 11
2412     */
2413    /**
2414     * Obtains the audio and video track information. This API can be called only when the AVPlayer is in the prepared,
2415     * playing, or paused state. To obtain information about all audio and video tracks, this API must be called after
2416     * the data loading callback is triggered. This API uses an asynchronous callback to return the result.
2417     * @param { AsyncCallback<Array<MediaDescription>> } callback - Async callback return track info in MediaDescription.
2418     * If the operation is successful, err is undefined and data is the MediaDescription array obtained;
2419     * otherwise, err is an error object.
2420     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
2421     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2422     * @crossplatform
2423     * @atomicservice
2424     * @since 12
2425     */
2426    getTrackDescription(callback: AsyncCallback<Array<MediaDescription>>): void;
2427
2428    /**
2429     * Get all track infos in MediaDescription, should be called after data loaded callback.
2430     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
2431     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2432     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2433     * @since 9
2434     */
2435    /**
2436     * Get all track infos in MediaDescription, should be called after data loaded callback.
2437     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
2438     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2439     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2440     * @atomicservice
2441     * @since 11
2442     */
2443    /**
2444     * Obtains the audio and video track information. This API can be called only when the AVPlayer is in the prepared,
2445     * playing, or paused state. This API uses a promise to return the result.
2446     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
2447     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2448     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2449     * @crossplatform
2450     * @atomicservice
2451     * @since 12
2452     */
2453    getTrackDescription(): Promise<Array<MediaDescription>>;
2454
2455    /**
2456     * Obtains the indexes of the selected audio or video tracks. This API can be called only when the AVPlayer
2457     * is in the prepared, playing, or paused state. This API uses a promise to return the result.
2458     * @returns { Promise<Array<number>> } A Promise instance used to return selected track index.
2459     * @throws { BusinessError } 5400102 - Operation not allowed.
2460     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2461     * @atomicservice
2462     * @since 12
2463     */
2464    getSelectedTracks(): Promise<Array<number>>;
2465
2466    /**
2467     * Selects a track when the AVPlayer is used to play a resource with multiple audio and video tracks.
2468     * This API uses a promise to return the result.
2469     * @param { number } index - Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX
2470     * @param { SwitchMode } mode - set switchmode for track select behavior. The default mode is SMOOTH.
2471     * This parameter takes effect only for the switch of a video track for DASH streams.
2472     * @returns { Promise<void> } A Promise instance used to return when select track completed.
2473     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2474     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2475     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2476     * @atomicservice
2477     * @since 12
2478     */
2479    selectTrack(index: number, mode?: SwitchMode): Promise<void>;
2480
2481    /**
2482     * Deselects a track when the AVPlayer is used to play a resource with multiple audio and video tracks.
2483     * This API uses a promise to return the result.
2484     * @param { number } index : Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX
2485     * @returns { Promise<void> } A Promise instance used to return when deselect track completed.
2486     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2487     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2488     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2489     * @atomicservice
2490     * @since 12
2491     */
2492    deselectTrack(index: number): Promise<void>;
2493
2494    /**
2495     * Sets a source of streaming media that can be pre-downloaded, downloads the media data, and temporarily stores
2496     * the data in the memory. For details about how to use the API, see Video Playback This API uses a promise to
2497     * return the result.
2498     * @param { MediaSource } src : Source of the streaming media to pre-download.
2499     * @param { PlaybackStrategy } strategy : strategy for playing the pre-downloaded streaming media.
2500     * @returns { Promise<void> } A Promise instance used to return when setMediaSource completed.
2501     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2502     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2503     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2504     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2505     * @atomicservice
2506     * @since 12
2507     */
2508    setMediaSource(src: MediaSource, strategy?: PlaybackStrategy): Promise<void>;
2509
2510    /**
2511     * Add subtitle resource represented by FD to the player. Currently, the external subtitle must be set after
2512     * fdSrc of the video resource is set in an AVPlayer instance. This API uses a promise to return the result.
2513     * @param { number } fd : The file descriptor of subtitle source from file system, which is obtained by
2514     * calling resourceManager.getRawFd.
2515     * The caller is responsible to close the file descriptor.
2516     * @param { number } offset : The offset into the file where the data to be read, in bytes.
2517     * By default, the offset is zero.
2518     * @param { number } length : The length in bytes of the data to be read.
2519     * By default, the length is the rest of bytes in the file from the offset.
2520     * @returns { Promise<void> } Promise used to return the result.
2521     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2522     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2523     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2524     * @atomicservice
2525     * @since 12
2526     */
2527    addSubtitleFromFd(fd: number, offset?: number, length?: number): Promise<void>;
2528
2529    /**
2530     * Add subtitle resource represented by url to the player. Currently, the external subtitle must be set
2531     * after fdSrc of the video resource is set in an AVPlayer instance. After the Promise returns,
2532     * subtitle info can be obtained by @getTrackDescription
2533     * @param { string } url : Address of external subtitle file.
2534     * @returns { Promise<void> } Promise used to return the result.
2535     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2536     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2537     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2538     * @atomicservice
2539     * @since 12
2540     */
2541    addSubtitleFromUrl(url: string): Promise<void>;
2542
2543    /**
2544     * Get statistic infos of current player. This API can be called only when the AVPlayer is in the prepared,
2545     * playing, or paused state.
2546     * @returns { Promise<PlaybackInfo> } Statistic infos of current player.
2547     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2548     * @since 12
2549     */
2550    getPlaybackInfo(): Promise<PlaybackInfo>;
2551
2552    /**
2553     * Set playback strategy to AVPlayer. This API can be called only when the AVPlayer is in the initialized state.
2554     * @param { PlaybackStrategy } strategy : specified strategy of the AVPlayer.
2555     * @returns { Promise<void> }  A Promise instance used to return when setPlaybackStrategy completed.
2556     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 2. Parameter verification failed.
2557     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2558     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2559     * @atomicservice
2560     * @since 12
2561     */
2562    setPlaybackStrategy(strategy: PlaybackStrategy): Promise<void>;
2563
2564    /**
2565     * Mute specified media stream. This API can be called only when the AVPlayer is in the prepared, playing,
2566     * paused, or completed state.
2567     * @param { MediaType } mediaType - specified media Type, see [MediaType]{@link #MediaType}.
2568     * @param { boolean } muted - true for mute, false for unmute.
2569     * @returns { Promise<void> } A Promise instance used to return when setMediaMuted completed.
2570     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2571     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2572     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2573     * @atomicservice
2574     * @since 12
2575     */
2576    setMediaMuted(mediaType: MediaType, muted: boolean): Promise<void>;
2577
2578    /**
2579     * Set playback start position and end position. After the setting, only the content in the specified range of
2580     * the audio or video file is played. This API uses a promise to return the result. It can be used in the
2581     * initialized, prepared, paused, stopped, or completed state.
2582     * @param { number } startTimeMs - Playback start position, should be in [0, duration),
2583     *                                 -1 means that the start position is not set,
2584     *                                 and the playback will start from 0.
2585     * @param { number } endTimeMs - Playback end position, which should usually be in (startTimeMs, duration],
2586     *                               -1 means that the end position is not set,
2587     *                               and the playback will be ended at the end of the stream.
2588     * @param { SeekMode } [mode] - Use the specified seek mode to jump to the playback start position,
2589     *                             currently support SeekMode.SEEK_PREV_SYNC and SeekMode.SEEK_CLOSEST,
2590     *                             other values are invalid, the default value is SeekMode.SEEK_PREV_SYNC.
2591     * @returns { Promise<void> } Promise used to return the result.
2592     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2593     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2594     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2595     * @atomicservice
2596     * @since 18
2597     */
2598    setPlaybackRange(startTimeMs: number, endTimeMs: number, mode?: SeekMode) : Promise<void>;
2599
2600    /**
2601     * Checks whether the media source supports seek in SEEK_CONTINUOUS mode ([SeekMode]{@link #SeekMode}).
2602     * The actual value is returned when this API is called in the prepared, playing, paused, or completed state.
2603     * The value **false** is returned if it is called in other states. For devices that do not support the seek
2604     * operation in SEEK_CONTINUOUS mode, false is returned.
2605     * Should be called after {@link #prepare}.
2606     * @returns { boolean } true: seek continuous is supported;
2607     * false: seek continuous is not supported or the support status is uncertain.
2608     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2609     * @atomicservice
2610     * @since 18
2611     */
2612    isSeekContinuousSupported() : boolean;
2613
2614    /**
2615     * Get current playback position. This API can be used in the prepared, playing, paused, or completed state.
2616     * @returns { number } return the time of current playback position - millisecond(ms)
2617     * @throws { BusinessError } 5400102 - Operation not allowed.
2618     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2619     * @atomicservice
2620     * @since 18
2621     */
2622    getPlaybackPosition() : number;
2623
2624    /**
2625     * Enable or disable super-resolution dynamically. This API can be called when the AVPlayer is in the
2626     * initialized, prepared, playing, paused, completed, or stopped state.
2627     * Must enable super-resolution feature in {@link PlaybackStrategy} before calling {@link #prepare}.
2628     * See {@link #setPlaybackStrategy}, {@link #setMediaSource}.
2629     * @param { boolean } enabled - true: super-resolution enabled; false: super-resolution disabled.
2630     * @returns { Promise<void> } Promise used to return the result.
2631     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2632     * @throws { BusinessError } 5410003 - Super-resolution not supported. Return by promise.
2633     * @throws { BusinessError } 5410004 - Missing enable super-resolution feature in {@link PlaybackStrategy}.
2634     *                                     Return by promise.
2635     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2636     * @atomicservice
2637     * @since 18
2638     */
2639    setSuperResolution(enabled: boolean) : Promise<void>;
2640
2641    /**
2642     * Set video window size for super-resolution. This API can be called when the AVPlayer is in the initialized,
2643     * prepared, playing, paused, completed, or stopped state. The input parameter values s must be in the range
2644     * of 320 x 320 to 1920 x 1080 (in px).
2645     *
2646     * Must enable super-resolution feature in {@link PlaybackStrategy} before calling {@link #prepare}.
2647     * See {@link #setPlaybackStrategy}, {@link #setMediaSource}.
2648     * @param { number } width - width of the window. The value range is [320-1920], in px.
2649     * @param { number } height - height of the window. The value range is [320-1080], in px.
2650     * @returns { Promise<void> } Promise used to return the result.
2651     * @throws { BusinessError } 401 - Parameter error. Return by promise.
2652     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2653     * @throws { BusinessError } 5410003 - Super-resolution not supported. Return by promise.
2654     * @throws { BusinessError } 5410004 - Missing enable super-resolution feature in {@link PlaybackStrategy}.
2655     *                                     Return by promise.
2656     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2657     * @atomicservice
2658     * @since 18
2659     */
2660    setVideoWindowSize(width: number, height: number) : Promise<void>;
2661
2662    /**
2663     * Media URI. Mainstream media formats are supported.
2664     * Network:http://xxx
2665     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2666     * @since 9
2667     */
2668    /**
2669     * Media URI. Mainstream media formats are supported.
2670     * Network:http://xxx
2671     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2672     * @atomicservice
2673     * @since 11
2674     */
2675    /**
2676     * Media URI. It can be set only when the AVPlayer is in the idle state.
2677     * The video formats MP4, MPEG-TS, and MKV are supported.
2678     * The audio formats M4A, AAC, MP3, OGG, WAV, FLAC, and AMR are supported.
2679     *
2680     * <br>**NOTE:**<br>
2681     * To set a network playback path, you must declare the ohos.permission.INTERNET permission by following the
2682     * instructions provided in Declaring Permissions. The error code 201 may be reported.
2683     *
2684     * WebM is no longer supported since API version 11.
2685     *
2686     * After the resource handle (FD) is transferred to an **AVPlayer** instance, do not use the resource handle to
2687     * perform other read and write operations, including but not limited to transferring this handle to other
2688     * **AVPlayer**, **AVMetadataExtractor**, **AVImageGenerator**, or **AVTranscoder** instance. Competition
2689     * occurs when multiple AVPlayers use the same resource handle to read and write files at the same time,
2690     * resulting in errors in obtaining data.
2691     *
2692     * Network:http://xxx
2693     * @type { ?string }
2694     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2695     * @crossplatform
2696     * @atomicservice
2697     * @since 12
2698     */
2699    url?: string;
2700
2701    /**
2702     * Media file descriptor. Mainstream media formats are supported.
2703     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2704     * @since 9
2705     */
2706    /**
2707     * Media file descriptor. Mainstream media formats are supported.
2708     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2709     * @atomicservice
2710     * @since 11
2711     */
2712    /**
2713     * Media file descriptor. It can be set only when the AVPlayer is in the idle state.
2714     * This attribute is required when media assets of an application are continuously stored in a file.
2715     * The video formats MP4, MPEG-TS, and MKV are supported.
2716     * The audio formats M4A, AAC, MP3, OGG, WAV, FLAC, and AMR are supported.
2717     *
2718     * <br>**NOTE:**<br>
2719     * WebM is no longer supported since API version 11.
2720     *
2721     * @type { ?AVFileDescriptor }
2722     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2723     * @crossplatform
2724     * @atomicservice
2725     * @since 12
2726     */
2727    fdSrc?: AVFileDescriptor;
2728
2729    /**
2730     * DataSource descriptor. Supports mainstream media formats.
2731     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2732     * @since 10
2733     */
2734    /**
2735     * DataSource descriptor. Supports mainstream media formats.
2736     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2737     * @atomicservice
2738     * @since 11
2739     */
2740    /**
2741     * DataSource descriptor. It can be set only when the AVPlayer is in the idle state. Use scenario: An application
2742     * starts playing a media file while the file is still being downloaded from the remote to the local host.
2743     * The video formats MP4, MPEG-TS, and MKV are supported.
2744     * The audio formats M4A, AAC, MP3, OGG, WAV, FLAC, and AMR are supported.
2745     * @type { ?AVDataSrcDescriptor }
2746     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2747     * @crossplatform
2748     * @atomicservice
2749     * @since 12
2750     */
2751    dataSrc?: AVDataSrcDescriptor;
2752
2753    /**
2754     * Whether to loop media playback.
2755     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2756     * @since 9
2757     */
2758    /**
2759     * Whether to loop media playback. The value true means to loop playback, and false (default) means the opposite.
2760     * It is a dynamic attribute and can be set only when the AVPlayer is in the prepared, playing, paused,
2761     * or completed state. This setting is not supported in live mode.
2762     * @type { boolean }
2763     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2764     * @crossplatform
2765     * @atomicservice
2766     * @since 12
2767     */
2768    loop: boolean;
2769
2770    /**
2771     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
2772     * set, the default mode will be used. Set it before calling the {@link #play()} in the
2773     * first time in order for the interrupt mode to become effective thereafter.
2774     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2775     * @since 9
2776     */
2777    /**
2778     * Describes audio interrupt mode. If it is not set, the default mode will be used. The default value is
2779     * **SHARE_MODE**. It is a dynamic attribute and can be set only when the AVPlayer is in the prepared,
2780     * playing, paused, or completed state. Set it before calling the {@link #play()} in the first time in order
2781     * for the interrupt mode to become effective thereafter.
2782     * @type { ?audio.InterruptMode }
2783     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2784     * @atomicservice
2785     * @since 12
2786     */
2787    audioInterruptMode?: audio.InterruptMode;
2788
2789    /**
2790     * Describes audio renderer info, refer to {@link #audio.AudioRendererInfo}. Set it before
2791     * calling the {@link #prepare()} in the first time in order for the audio renderer info to
2792     * become effective thereafter.
2793     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2794     * @since 10
2795     */
2796    /**
2797     * Describes audio renderer info. If the media source contains videos, the default value of usage is
2798     * **STREAM_USAGE_MOVIE**. Otherwise, the default value of usage is **STREAM_USAGE_MUSIC**. This parameter can
2799     * be set only when the AVPlayer is in the initialized state.
2800     * Set it before calling the {@link #prepare()} in the first time in order for the audio renderer info to
2801     * become effective thereafter.
2802     * @type { ?audio.AudioRendererInfo }
2803     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2804     * @atomicservice
2805     * @since 12
2806     */
2807    audioRendererInfo?: audio.AudioRendererInfo;
2808
2809    /**
2810     * Obtains the current audio effect mode, refer to {@link #audio.AudioEffectMode}.
2811     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2812     * @since 10
2813     */
2814    /**
2815     * Obtains the current audio effect mode. The audio effect mode is a dynamic attribute and is restored
2816     * to the default value **EFFECT_DEFAULT** when usage of audioRendererInfo is changed.
2817     * It can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.
2818     * @type { ?audio.AudioEffectMode }
2819     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2820     * @atomicservice
2821     * @since 12
2822     */
2823    audioEffectMode ?: audio.AudioEffectMode;
2824
2825    /**
2826     * Current playback position.
2827     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2828     * @since 9
2829     */
2830    /**
2831     * Current playback position, in ms. It can be used as a query parameter when the AVPlayer is in the prepared,
2832     * playing, paused, or completed state. The value -1 indicates an invalid value.
2833     * In live mode, -1 is returned by default.
2834     * @type { number }
2835     * @readonly
2836     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2837     * @crossplatform
2838     * @atomicservice
2839     * @since 12
2840     */
2841    readonly currentTime: number;
2842
2843    /**
2844     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
2845     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2846     * @since 9
2847     */
2848    /**
2849     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
2850     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2851     * @atomicservice
2852     * @since 11
2853     */
2854    /**
2855     * Playback duration, in ms. It can be used as a query parameter when the AVPlayer is in the prepared,
2856     * playing, paused, or completed state.
2857     * When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
2858     * @type { number }
2859     * @readonly
2860     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2861     * @crossplatform
2862     * @atomicservice
2863     * @since 12
2864     */
2865    readonly duration: number;
2866
2867    /**
2868     * Playback state.
2869     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2870     * @since 9
2871     */
2872    /**
2873     * Playback state. It can be used as a query parameter when the AVPlayer is in any state.
2874     * @type { AVPlayerState }
2875     * @readonly
2876     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2877     * @crossplatform
2878     * @atomicservice
2879     * @since 12
2880     */
2881    readonly state: AVPlayerState;
2882
2883    /**
2884     * Video player will use this id get a surface instance.
2885     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2886     * @since 9
2887     */
2888    /**
2889     * Video player will use this id get a surface instance.
2890     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2891     * @atomicservice
2892     * @since 11
2893     */
2894    /**
2895     * Video player will use this id get a surface instance. This parameter can be set when the AVPlayer
2896     * is in the initialized state. It can be set again when the AVPlayer is in the prepared, playing, paused,
2897     * completed, or stopped state, in the prerequisite that the video window ID has been set in the initialized state.
2898     * After the new setting is performed, the video is played in the new window. It is used to render the window
2899     * for video playback and therefore is not required in audio-only playback scenarios.
2900     * @type { ?string }
2901     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2902     * @crossplatform
2903     * @atomicservice
2904     * @since 12
2905     */
2906    surfaceId?: string;
2907
2908    /**
2909     * Video width, valid after prepared.
2910     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2911     * @since 9
2912     */
2913    /**
2914     * Video width, in px, valid after prepared. It can be used as a query parameter when the AVPlayer is in the
2915     * prepared, playing, paused, or completed state.
2916     * @type { number }
2917     * @readonly
2918     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2919     * @crossplatform
2920     * @atomicservice
2921     * @since 12
2922     */
2923    readonly width: number;
2924
2925    /**
2926     * Video height, in px, valid after prepared.
2927     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2928     * @since 9
2929     */
2930    /**
2931     * Video height, in px, valid after prepared. It can be used as a query parameter when the AVPlayer is in the
2932     * prepared, playing, paused, or completed state.
2933     * @type { number }
2934     * @readonly
2935     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2936     * @crossplatform
2937     * @atomicservice
2938     * @since 12
2939     */
2940    readonly height: number;
2941
2942    /**
2943     * Video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more
2944     * information, refer to {@link #VideoScaleType} .
2945     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2946     * @since 9
2947     */
2948    /**
2949     * Video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more
2950     * information, refer to {@link #VideoScaleType} .
2951     * @type { ?VideoScaleType }
2952     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2953     * @crossplatform
2954     * @atomicservice
2955     * @since 12
2956     */
2957    videoScaleType?: VideoScaleType;
2958
2959    /**
2960     * Set payback speed.
2961     * @param { PlaybackSpeed } speed - playback speed, see @PlaybackSpeed .
2962     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2963     * @since 9
2964     */
2965    /**
2966     * Set payback speed. This API can be called only when the AVPlayer is in the prepared, playing, paused,
2967     * or completed state. You can check whether the setting takes effect by subscribing to the speedDone event.
2968     * This API is not supported in live mode.
2969     * @param { PlaybackSpeed } speed - playback speed, see @PlaybackSpeed .
2970     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2971     * @crossplatform
2972     * @atomicservice
2973     * @since 12
2974     */
2975    setSpeed(speed: PlaybackSpeed): void;
2976
2977    /**
2978     * Set playback rate.
2979     * Supported states: prepared/playing/paused/completed.
2980     * @param { number } rate - playback rate, valid range is 0.125 ~ 4.
2981     * @throws { BusinessError } 5400108 - The parameter check failed, parameter value out of range.
2982     * @throws { BusinessError } 5400102 - Operation not allowed, if invalid state or live stream.
2983     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2984     * @atomicservice
2985     * @since 20
2986     */
2987    setPlaybackRate(rate: number): void;
2988
2989    /**
2990     * select a specified bitrate to playback, only valid for HLS protocol network stream. By default, the
2991     * player will select the appropriate bitrate according to the network connection speed. The
2992     * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select
2993     * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player
2994     * will select the minimal and closest one from the available bitrate list.
2995     * @param { number } bitrate - the playback bitrate must be expressed in bits per second.
2996     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2997     * @since 9
2998     */
2999    /**
3000     * Select a specified bitrate to playback, only valid for HLS protocol network stream. By default, the
3001     * player will select the appropriate bitrate according to the network connection speed. The
3002     * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select
3003     * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player
3004     * will select the minimal and closest one from the available bitrate list.This API can be called
3005     * only when the AVPlayer is in the prepared, playing, paused, or completed state.
3006     * @param { number } bitrate - 	Bit rate to set. Obtain the available bit rates of the current HLS/DASH
3007     * stream by subscribing to the {@link #on('availableBitrates')} event. If the bit rate to set is not in
3008     * the list of the available bit rates, the AVPlayer selects from the list the bit rate that is closed
3009     * to the bit rate to set. If the length of the available bit rate list obtained through the event is 0,
3010     * no bit rate can be set and the bitrateDone callback will not be triggered.
3011     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3012     * @crossplatform
3013     * @atomicservice
3014     * @since 12
3015     */
3016    setBitrate(bitrate: number): void;
3017
3018    /**
3019     * Set decryption session to codec module.
3020     * @param { drm.MediaKeySession } mediaKeySession - Handle of MediaKeySession to decrypt encrypted media.
3021     * @param { boolean } secureVideoPath - Secure video path required or not.
3022     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3023     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3024     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3025     * @since 11
3026     */
3027    /**
3028     * Set decryption session to codec module. When receiving a mediaKeySystemInfoUpdate event, create the related
3029     * configuration and set the decryption configuration based on the information in the reported event.
3030     * Otherwise, the playback fails.
3031     * @param { drm.MediaKeySession } mediaKeySession - Handle of MediaKeySession to decrypt encrypted media.
3032     * @param { boolean } secureVideoPath - Secure video path required or not. The value true means that a secure
3033     * video channel is selected, and false means that a non-secure video channel is selected.
3034     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3035     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3036     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3037     * @atomicservice
3038     * @since 12
3039     */
3040    setDecryptionConfig(mediaKeySession: drm.MediaKeySession, secureVideoPath: boolean): void;
3041
3042    /**
3043     * Get media key system info from media source.
3044     * @returns { Array<drm.MediaKeySystemInfo> } MediaKeySystemInfo with PSSH.
3045     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3046     * @since 11
3047     */
3048    /**
3049     * Get media key system info from media source.
3050     * @returns { Array<drm.MediaKeySystemInfo> } MediaKeySystemInfo with PSSH.
3051     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3052     * @atomicservice
3053     * @since 12
3054     */
3055    getMediaKeySystemInfos(): Array<drm.MediaKeySystemInfo>;
3056
3057    /**
3058     * Register listens for mediaKeySystemInfoUpdate events.
3059     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
3060     * @param { function } callback - Callback used to listen for the mediaKeySystemInfoUpdate event.
3061     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3062     * @since 11
3063     */
3064    /**
3065     * Register listens for mediaKeySystemInfoUpdate events.
3066     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
3067     * @param { Callback<Array<drm.MediaKeySystemInfo>> } callback - Callback used to listen for the mediaKeySystemInfoUpdate event.
3068     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3069     * @atomicservice
3070     * @since arkts {'1.1':'12','1.2':'20'}
3071     * @arkts 1.1&1.2
3072     */
3073    on(type: 'mediaKeySystemInfoUpdate', callback: Callback<Array<drm.MediaKeySystemInfo>>): void;
3074
3075    /**
3076     * Unregister listens for mediaKeySystemInfoUpdate events.
3077     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
3078     * @param { function } callback - Callback for event.
3079     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3080     * @since 11
3081     */
3082    /**
3083     * Unregister listens for mediaKeySystemInfoUpdate events.
3084     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
3085     * @param { Callback<Array<drm.MediaKeySystemInfo>> } callback - Callback for event.
3086     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3087     * @atomicservice
3088     * @since 12
3089     */
3090    off(type: 'mediaKeySystemInfoUpdate', callback?: Callback<Array<drm.MediaKeySystemInfo>>): void;
3091
3092    /**
3093     * Register listens for media playback stateChange event.
3094     * @param { 'stateChange' } type - Type of the playback event to listen for.
3095     * @param { function } callback - Callback used to listen for the playback stateChange event.
3096     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3097     * @since 9
3098     */
3099    /**
3100     * Register listens for media playback stateChange event.
3101     * @param { 'stateChange' } type - Type of the playback event to listen for.
3102     * @param { function } callback - Callback used to listen for the playback stateChange event.
3103     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3104     * @atomicservice
3105     * @since 11
3106     */
3107    /**
3108     * Register listens for media playback stateChange event.
3109     * @param { 'stateChange' } type - Event type, which is **'stateChange'** in this case.
3110     * This event can be triggered by both user operations and the system.
3111     * @param { OnAVPlayerStateChangeHandle } callback - Callback invoked when the event is triggered.
3112     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3113     * @crossplatform
3114     * @atomicservice
3115     * @since 12
3116     */
3117    on(type: 'stateChange', callback: OnAVPlayerStateChangeHandle): void;
3118    /**
3119     * Unregister listens for media playback stateChange event.
3120     * @param { 'stateChange' } type - Type of the playback event to listen for.
3121     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3122     * @since 9
3123     */
3124    /**
3125     * Unregister listens for media playback stateChange event.
3126     * @param { 'stateChange' } type - Type of the playback event to listen for.
3127     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3128     * @atomicservice
3129     * @since 11
3130     */
3131    /**
3132     * Unregister listens for media playback stateChange event.
3133     * @param { 'stateChange' } type - Type of the playback event to listen for.
3134     * @param { OnAVPlayerStateChangeHandle } callback - Callback invoked when the event is triggered.
3135     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3136     * @crossplatform
3137     * @atomicservice
3138     * @since 12
3139     */
3140    off(type: 'stateChange', callback?: OnAVPlayerStateChangeHandle): void;
3141    /**
3142     * Register listens for media playback volumeChange event.
3143     * @param { 'volumeChange' } type - Type of the playback event to listen for.
3144     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3145     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3146     * @since 9
3147     */
3148    /**
3149     * Subscribes to the event to check whether the volume is successfully set.
3150     * @param { 'volumeChange' } type - This event is triggered each time **setVolume()** is called.
3151     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3152     * It reports the effective volume.
3153     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3154     * @crossplatform
3155     * @atomicservice
3156     * @since 12
3157     */
3158    on(type: 'volumeChange', callback: Callback<number>): void;
3159    /**
3160     * Unregister listens for media playback volumeChange event.
3161     * @param { 'volumeChange' } type - Type of the playback event to listen for.
3162     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3163     * @since 9
3164     */
3165    /**
3166     * Unsubscribes from the event that checks whether the volume is successfully set.
3167     * @param { 'volumeChange' } type - Type of the playback event to listen for.
3168     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3169     * It reports the effective volume.
3170     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3171     * @crossplatform
3172     * @since 12
3173     */
3174    /**
3175     * Unsubscribes from the event that checks whether the volume is successfully set.
3176     * @param { 'volumeChange' } type - Type of the playback event to listen for.
3177     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3178     * It reports the effective volume.
3179     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3180     * @crossplatform
3181     * @atomicservice
3182     * @since 19
3183     */
3184    off(type: 'volumeChange', callback?: Callback<number>): void;
3185    /**
3186     * Register listens for media playback endOfStream event.
3187     * @param { 'endOfStream' } type - Type of the playback event to listen for.
3188     * @param { Callback<void> } callback - Callback used to listen for the playback end of stream.
3189     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3190     * @since 9
3191     */
3192    /**
3193     * Subscribes to the event that indicates the end of the stream being played. If {@link #loop} = true is set,
3194     * the AVPlayer seeks to the beginning of the stream and plays the stream again. If loop is not set,
3195     * the completed state is reported through the {@link #stateChange} event.
3196     * @param { 'endOfStream' } type - Type of the playback event to listen for. This event is triggered
3197     * when the AVPlayer finishes playing the media asset.
3198     * @param { Callback<void> } callback - Callback invoked when the event is triggered.
3199     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3200     * @crossplatform
3201     * @atomicservice
3202     * @since 12
3203     */
3204    on(type: 'endOfStream', callback: Callback<void>): void;
3205    /**
3206     * Unregister listens for media playback endOfStream event.
3207     * @param { 'endOfStream' } type - Type of the playback event to listen for.
3208     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3209     * @since 9
3210     */
3211    /**
3212     * Unsubscribes from the event that indicates the end of the stream being played.
3213     * @param { 'endOfStream' } type - Type of the playback event to listen for.
3214     * @param { Callback<void> } callback - Callback invoked when the event is triggered.
3215     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3216     * @crossplatform
3217     * @since 12
3218     */
3219    /**
3220     * Unregister listens for media playback endOfStream event.
3221     * @param { 'endOfStream' } type - Type of the playback event to listen for.
3222     * @param { Callback<void> } [callback] - Callback used to listen for the playback end of stream.
3223     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3224     * @crossplatform
3225     * @atomicservice
3226     * @since 19
3227     */
3228    off(type: 'endOfStream', callback?: Callback<void>): void;
3229    /**
3230     * Register listens for media playback seekDone event.
3231     * @param { 'seekDone' } type - Type of the playback event to listen for.
3232     * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event.
3233     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3234     * @since 9
3235     */
3236    /**
3237     * Register listens for media playback seekDone event.
3238     * @param { 'seekDone' } type - Type of the playback event to listen for.
3239     * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event.
3240     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3241     * @atomicservice
3242     * @since 11
3243     */
3244    /**
3245     * Subscribes to the event to check whether the seek operation takes effect.
3246     * @param { 'seekDone' } type - Type of the playback event to listen for. This event is triggered each time
3247     * **seek()** is called, except in SEEK_CONTINUOUS mode.
3248     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3249     * It reports the time position requested by the user.
3250     *
3251     * For video playback, {@link #SeekMode} may cause the actual position to be different from that requested by
3252     * the user.The exact position can be obtained from the currentTime attribute. The time in this callback
3253     * only means that the requested seek operation is complete.
3254     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3255     * @crossplatform
3256     * @atomicservice
3257     * @since 12
3258     */
3259    on(type: 'seekDone', callback: Callback<number>): void;
3260    /**
3261     * Unregister listens for media playback seekDone event.
3262     * @param { 'seekDone' } type - Type of the playback event to listen for.
3263     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3264     * @since 9
3265     */
3266    /**
3267     * Unregister listens for media playback seekDone event.
3268     * @param { 'seekDone' } type - Type of the playback event to listen for.
3269     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3270     * @atomicservice
3271     * @since 11
3272     */
3273    /**
3274     * Unsubscribes from the event that checks whether the seek operation takes effect.
3275     * @param { 'seekDone' } type - Type of the playback event to listen for.
3276     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3277     * It reports the time position requested by the user.
3278     *
3279     * For video playback, SeekMode may cause the actual position to be different from that requested by the user.
3280     * The exact position can be obtained from the currentTime attribute. The time in this callback only means
3281     * that the requested seek operation is complete.
3282     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3283     * @crossplatform
3284     * @atomicservice
3285     * @since 12
3286     */
3287    off(type: 'seekDone', callback?: Callback<number>): void;
3288    /**
3289     * Register listens for media playback speedDone event.
3290     * @param { 'speedDone' } type - Type of the playback event to listen for.
3291     * @param { Callback<number> } callback - Callback used to listen for the playback speedDone event.
3292     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3293     * @since 9
3294     */
3295    /**
3296     * Subscribes to the event to check whether the playback speed is successfully set.
3297     * @param { 'speedDone' } type - Type of the playback event to listen for.
3298     * This event is triggered each time **setSpeed()** is called.
3299     * @param { Callback<number> } callback - Callback used to return the result. When the call of
3300     * setSpeed is successful, the effective speed mode is reported. For details, see {@link #PlaybackSpeed}.
3301     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3302     * @crossplatform
3303     * @atomicservice
3304     * @since 12
3305     */
3306    on(type: 'speedDone', callback: Callback<number>): void;
3307    /**
3308     * Unregister listens for media playback speedDone event.
3309     * @param { 'speedDone' } type - Type of the playback event to listen for.
3310     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3311     * @since 9
3312     */
3313    /**
3314     * Unsubscribes from the event that checks whether the playback speed is successfully set.
3315     * @param { 'speedDone' } type - Type of the playback event to listen for.
3316     * @param { Callback<number> } callback - Callback used to return the result. When the call of
3317     * setSpeed is successful, the effective speed mode is reported. For details, see {@link #PlaybackSpeed}.
3318     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3319     * @crossplatform
3320     * @since 12
3321     */
3322    /**
3323     * Unsubscribes from the event that checks whether the playback speed is successfully set.
3324     * @param { 'speedDone' } type - Type of the playback event to listen for.
3325     * @param { Callback<number> } callback - Callback used to return the result. When the call of
3326     * setSpeed is successful, the effective speed mode is reported. For details, see {@link #PlaybackSpeed}.
3327     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3328     * @crossplatform
3329     * @atomicservice
3330     * @since 19
3331     */
3332    off(type: 'speedDone', callback?: Callback<number>): void;
3333    /**
3334     * Register listens for media playbackRateDone event.
3335     * @param { 'playbackRateDone' } type - Type of the playback event to listen for.
3336     * @param { OnPlaybackRateDone } callback - Callback used to listen for the playbackRateDone event.
3337     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3338     * @atomicservice
3339     * @since 20
3340     */
3341    on(type: 'playbackRateDone', callback: OnPlaybackRateDone): void;
3342
3343    /**
3344     * Unregister listens for media playbackRateDone event.
3345     * @param { 'playbackRateDone' } type - Type of the playback event to listen for.
3346     * @param { OnPlaybackRateDone } callback - Callback used to listen for the playbackRateDone event.
3347     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3348     * @atomicservice
3349     * @since 20
3350     */
3351    off(type: 'playbackRateDone', callback?: OnPlaybackRateDone): void;
3352    /**
3353     * Register listens for media playback setBitrateDone event.
3354     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
3355     * @param { Callback<number> } callback - Callback used to listen for the playback setBitrateDone event.
3356     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3357     * @since 9
3358     */
3359    /**
3360     * Subscribes to the event to check whether the bit rate is successfully set.
3361     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
3362     * This event is triggered each time **setBitrate()** is called.
3363     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3364     * It reports the effective bit rate.
3365     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3366     * @atomicservice
3367     * @since 12
3368     */
3369    on(type: 'bitrateDone', callback: Callback<number>): void;
3370    /**
3371     * Unregister listens for media playback setBitrateDone event.
3372     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
3373     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3374     * @since 9
3375     */
3376    /**
3377     * Unsubscribes from the event that checks whether the bit rate is successfully set.
3378     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
3379     * @param { Callback<number> } [callback] - Callback invoked when the event is triggered.
3380     * It reports the effective bit rate.
3381     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3382     * @since 12
3383     */
3384    /**
3385     * Unsubscribes from the event that checks whether the bit rate is successfully set.
3386     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
3387     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
3388     * It reports the effective bit rate.
3389     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3390     * @atomicservice
3391     * @since 19
3392     */
3393    off(type: 'bitrateDone', callback?: Callback<number>): void;
3394    /**
3395     * Register listens for media playback timeUpdate event.
3396     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3397     * @param { Callback<number> } callback - Callback used to listen for the playback timeUpdate event.
3398     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3399     * @since 9
3400     */
3401    /**
3402     * Register listens for media playback timeUpdate event.
3403     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3404     * @param { Callback<number> } callback - Callback used to listen for the playback timeUpdate event.
3405     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3406     * @atomicservice
3407     * @since 11
3408     */
3409    /**
3410     * Subscribes to playback position changes. It is used to refresh the current position of the progress bar.
3411     * By default, this event is reported every 100 ms. However, it is reported immediately upon
3412     * a successful seek operation.
3413     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3414     * @param { Callback<number> } callback - Callback used to return the current time.
3415     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3416     * @crossplatform
3417     * @atomicservice
3418     * @since 12
3419     */
3420    on(type: 'timeUpdate', callback: Callback<number>): void;
3421    /**
3422     * Unregister listens for media playback timeUpdate event.
3423     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3424     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3425     * @since 9
3426     */
3427    /**
3428     * Unregister listens for media playback timeUpdate event.
3429     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3430     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3431     * @atomicservice
3432     * @since 11
3433     */
3434    /**
3435     * Unsubscribes from playback position changes.
3436     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3437     * @param { Callback<number> } callback - Callback used to return the current time.
3438     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3439     * @crossplatform
3440     * @atomicservice
3441     * @since 12
3442     */
3443    off(type: 'timeUpdate', callback?: Callback<number>): void;
3444    /**
3445     * Register listens for media playback durationUpdate event.
3446     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
3447     * @param { Callback<number> } callback - Callback used to listen for the playback durationUpdate event.
3448     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3449     * @since 9
3450     */
3451    /**
3452     * Subscribes to media asset duration changes. It is used to refresh the length of the progress bar. By
3453     * default, this event is reported once in the prepared state. However, it can be repeatedly reported for
3454     * special streams that trigger duration changes. The **'durationUpdate'** event is not supported in live mode.
3455     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
3456     * @param { Callback<number> } callback - Callback used to return the resource duration.
3457     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3458     * @crossplatform
3459     * @atomicservice
3460     * @since 12
3461     */
3462    on(type: 'durationUpdate', callback: Callback<number>): void;
3463    /**
3464     * Unregister listens for media playback durationUpdate event.
3465     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
3466     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3467     * @since 9
3468     */
3469    /**
3470     * Unsubscribes from media asset duration changes.
3471     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
3472     * @param { Callback<number> } callback - Callback used to return the resource duration.
3473     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3474     * @crossplatform
3475     * @since 12
3476     */
3477    /**
3478     * Unsubscribes from media asset duration changes.
3479     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
3480     * @param { Callback<number> } callback - Callback used to return the resource duration.
3481     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3482     * @crossplatform
3483     * @atomicservice
3484     * @since 19
3485     */
3486    off(type: 'durationUpdate', callback?: Callback<number>): void;
3487
3488    /**
3489     * Register listens for video playback buffering events.
3490     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
3491     * @param { function } callback - Callback used to listen for the buffering update event,
3492	   * return BufferingInfoType and the value.
3493     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3494     * @since 9
3495     */
3496    /**
3497     * Subscribes to audio and video buffer changes. This subscription is supported only in network
3498     * playback scenarios.
3499     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
3500     * @param { OnBufferingUpdateHandler } callback - Callback invoked when the event is triggered,
3501	   * and return BufferingInfoType and the value.
3502     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3503     * @crossplatform
3504     * @atomicservice
3505     * @since 12
3506     */
3507    on(type: 'bufferingUpdate', callback: OnBufferingUpdateHandler): void;
3508
3509    /**
3510     * Unregister listens for video playback buffering events.
3511     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
3512	   * return BufferingInfoType and the value.
3513     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3514     * @since 9
3515     */
3516    /**
3517     * Unsubscribes from audio and video buffer changes.
3518     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
3519     * @param { OnBufferingUpdateHandler } callback - Callback invoked when the event is triggered.,
3520	   * and return BufferingInfoType and the value.
3521     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3522     * @crossplatform
3523     * @atomicservice
3524     * @since 12
3525     */
3526    off(type: 'bufferingUpdate', callback?: OnBufferingUpdateHandler): void;
3527    /**
3528     * Register listens for start render video frame events.
3529     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
3530     * @param { Callback<void> } callback - Callback used to listen for the playback event return .
3531     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3532     * @since 9
3533     */
3534    /**
3535     * Subscribes to the event that indicates rendering starts for the first frame. This subscription is
3536     * supported only in video playback scenarios. This event only means that the playback service sends
3537     * the first frame to the display module. The actual rendering effect depends on the rendering performance
3538     * of the display service.
3539     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
3540     * @param { Callback<void> } callback - Callback invoked when the event is triggered.
3541     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3542     * @atomicservice
3543     * @since 12
3544     */
3545    on(type: 'startRenderFrame', callback: Callback<void>): void;
3546    /**
3547     * Unregister listens for start render video frame events.
3548     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
3549     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3550     * @since 9
3551     */
3552    /**
3553     * Unsubscribes from the event that indicates rendering starts for the first frame.
3554     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
3555     * @param { Callback<void> } callback - 	Callback invoked when the event is triggered.
3556     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3557     * @since 12
3558     */
3559    /**
3560     * Unregister listens for start render video frame events.
3561     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
3562     * @param { Callback<void> } [callback] - Callback used to listen for the playback event return .
3563     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3564     * @atomicservice
3565     * @since 19
3566     */
3567    off(type: 'startRenderFrame', callback?: Callback<void>): void;
3568
3569    /**
3570     * Register listens for video size change event.
3571     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
3572     * @param { function } callback - Callback used to listen for the playback event return video size.
3573     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3574     * @since 9
3575     */
3576    /**
3577     * Subscribes to video size (width and height) changes. This subscription is supported only in video playback
3578     * scenarios. By default, this event is reported only once in the prepared state. However, it is also reported
3579     * upon resolution changes in the case of HLS streams.
3580     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
3581     * @param { OnVideoSizeChangeHandler } callback - Callback invoked when the event is triggered.
3582     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3583     * @crossplatform
3584     * @atomicservice
3585     * @since 12
3586     */
3587    on(type: 'videoSizeChange', callback: OnVideoSizeChangeHandler): void;
3588    /**
3589     * Unregister listens for video size change event.
3590     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
3591     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3592     * @since 9
3593     */
3594    /**
3595     * Unsubscribes from video size changes.
3596     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
3597     * @param { OnVideoSizeChangeHandler } callback - Callback invoked when the event is triggered.
3598     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3599     * @crossplatform
3600     * @atomicservice
3601     * @since 12
3602     */
3603    off(type: 'videoSizeChange', callback?: OnVideoSizeChangeHandler): void;
3604    /**
3605     * Register listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
3606     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
3607     * @param { function } callback - Callback used to listen for the playback event return audio interrupt info.
3608     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3609     * @since 9
3610     */
3611    /**
3612     * Register listens for audio interrupt event, refer to {@link #audio.InterruptEvent}.
3613     * The application needs to perform corresponding processing based on different audio interruption events.
3614     * For details, see Handling Audio Interruption Events.
3615     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
3616     * @param { Callback<audio.InterruptEvent> } callback - Callback used to listen for the playback event return audio interrupt info.
3617     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3618     * @crossplatform
3619     * @atomicservice
3620     * @since 12
3621     */
3622    on(type: 'audioInterrupt', callback: Callback<audio.InterruptEvent>): void;
3623    /**
3624     * Unregister listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
3625     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
3626     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3627     * @since 9
3628     */
3629    /**
3630     * Unregister listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
3631     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
3632     * @param { Callback<audio.InterruptEvent> } callback - Callback used to listen for the playback event return audio interrupt info.
3633     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3634     * @crossplatform
3635     * @atomicservice
3636     * @since 12
3637     */
3638    off(type: 'audioInterrupt', callback?: Callback<audio.InterruptEvent>): void;
3639    /**
3640     * Register listens for available bitrate list collect completed events for HLS protocol stream playback.
3641     * This event will be reported after the {@link #prepare} called.
3642     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
3643     * @param { function } callback - Callback used to listen for the playback event return available bitrate list.
3644     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3645     * @since 9
3646     */
3647    /**
3648     * Register listens for available bitrate list collect completed events for HLS protocol stream playback.
3649     * This event will be reported after the {@link #prepare} called.
3650     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
3651     * This event is triggered once after the AVPlayer switches to the prepared state.
3652     * @param { Callback<Array<number>> } callback - Callback used to listen for the playback event return available bitrate list.
3653     * It returns an array that holds the available bit rates. If the array length is 0, no bit rate can be set.
3654     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3655     * @crossplatform
3656     * @atomicservice
3657     * @since 12
3658     */
3659    on(type: 'availableBitrates', callback: Callback<Array<number>>): void;
3660    /**
3661     * Unregister listens for available bitrate list collect completed events for HLS protocol stream playback.
3662     * This event will be reported after the {@link #prepare} called.
3663     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
3664     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3665     * @since 9
3666     */
3667    /**
3668     * Unregister listens for available bitrate list collect completed events for HLS protocol stream playback.
3669     * This event will be reported after the {@link #prepare} called.
3670     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
3671     * @param { Callback<Array<number>> } callback - Callback used to listen for the playback event return available bitrate list.
3672     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3673     * @crossplatform
3674     * @atomicservice
3675     * @since 12
3676     */
3677    off(type: 'availableBitrates', callback?: Callback<Array<number>>): void;
3678    /**
3679     * Register listens for playback error events.
3680     * @param { 'error' } type - Type of the playback error event to listen for.
3681     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
3682     * @throws { BusinessError } 201 - Permission denied.
3683     * @throws { BusinessError } 401 - The parameter check failed.
3684     * @throws { BusinessError } 801 - Capability not supported.
3685     * @throws { BusinessError } 5400101 - No memory.
3686     * @throws { BusinessError } 5400102 - Operation not allowed.
3687     * @throws { BusinessError } 5400103 - I/O error.
3688     * @throws { BusinessError } 5400104 - Time out.
3689     * @throws { BusinessError } 5400105 - Service died.
3690     * @throws { BusinessError } 5400106 - Unsupported format.
3691     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3692     * @since 9
3693     */
3694    /**
3695     * Register listens for playback error events.
3696     * @param { 'error' } type - Type of the playback error event to listen for.
3697     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
3698     * @throws { BusinessError } 201 - Permission denied.
3699     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3700     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3701     * @throws { BusinessError } 801 - Capability not supported.
3702     * @throws { BusinessError } 5400101 - No memory.
3703     * @throws { BusinessError } 5400102 - Operation not allowed.
3704     * @throws { BusinessError } 5400103 - I/O error.
3705     * @throws { BusinessError } 5400104 - Time out.
3706     * @throws { BusinessError } 5400105 - Service died.
3707     * @throws { BusinessError } 5400106 - Unsupported format.
3708     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3709     * @atomicservice
3710     * @since 11
3711     */
3712    /**
3713     * Register listens for playback error events.
3714     * @param { 'error' } type - Type of the playback error event to listen for.
3715     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
3716     * @throws { BusinessError } 201 - Permission denied.
3717     * @throws { BusinessError } 401 - The parameter check failed.
3718     * @throws { BusinessError } 801 - Capability not supported.
3719     * @throws { BusinessError } 5400101 - No memory.
3720     * @throws { BusinessError } 5400102 - Operation not allowed.
3721     * @throws { BusinessError } 5400103 - I/O error.
3722     * @throws { BusinessError } 5400104 - Time out.
3723     * @throws { BusinessError } 5400105 - Service died.
3724     * @throws { BusinessError } 5400106 - Unsupported format.
3725     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3726     * @crossplatform
3727     * @atomicservice
3728     * @since 12
3729     */
3730    /**
3731     * Register listens for playback error events.
3732     * @param { 'error' } type - Type of the playback error event to listen for.
3733     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
3734     * @throws { BusinessError } 201 - Permission denied.
3735     * @throws { BusinessError } 401 - The parameter check failed.
3736     * @throws { BusinessError } 801 - Capability not supported.
3737     * @throws { BusinessError } 5400101 - No memory.
3738     * @throws { BusinessError } 5400102 - Operation not allowed.
3739     * @throws { BusinessError } 5400104 - Time out.
3740     * @throws { BusinessError } 5400105 - Service died.
3741     * @throws { BusinessError } 5400106 - Unsupported format.
3742     * @throws { BusinessError } 5411001 - IO can not find host.
3743     * @throws { BusinessError } 5411002 - IO connection timeout.
3744     * @throws { BusinessError } 5411003 - IO network abnormal.
3745     * @throws { BusinessError } 5411004 - IO network unavailable.
3746     * @throws { BusinessError } 5411005 - IO no permission.
3747     * @throws { BusinessError } 5411006 - IO request denied.
3748     * @throws { BusinessError } 5411007 - IO resource not found.
3749     * @throws { BusinessError } 5411008 - IO SSL client cert needed.
3750     * @throws { BusinessError } 5411009 - IO SSL connect fail.
3751     * @throws { BusinessError } 5411010 - IO SSL server cert untrusted.
3752     * @throws { BusinessError } 5411011 - IO unsupported request.
3753     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3754     * @crossplatform
3755     * @atomicservice
3756     * @since 14
3757     */
3758    /**
3759     * Register listens for playback error events.
3760     * @param { 'error' } type - Type of the playback error event to listen for.
3761     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
3762     * @throws { BusinessError } 201 - Permission denied.
3763     * @throws { BusinessError } 401 - The parameter check failed.
3764     * @throws { BusinessError } 801 - Capability not supported.
3765     * @throws { BusinessError } 5400101 - No memory.
3766     * @throws { BusinessError } 5400102 - Operation not allowed.
3767     * @throws { BusinessError } 5400104 - Time out.
3768     * @throws { BusinessError } 5400105 - Service died.
3769     * @throws { BusinessError } 5400106 - Unsupported format.
3770     * @throws { BusinessError } 5410002 - Seek continuous unsupported.
3771     * @throws { BusinessError } 5411001 - IO can not find host.
3772     * @throws { BusinessError } 5411002 - IO connection timeout.
3773     * @throws { BusinessError } 5411003 - IO network abnormal.
3774     * @throws { BusinessError } 5411004 - IO network unavailable.
3775     * @throws { BusinessError } 5411005 - IO no permission.
3776     * @throws { BusinessError } 5411006 - IO request denied.
3777     * @throws { BusinessError } 5411007 - IO resource not found.
3778     * @throws { BusinessError } 5411008 - IO SSL client cert needed.
3779     * @throws { BusinessError } 5411009 - IO SSL connect fail.
3780     * @throws { BusinessError } 5411010 - IO SSL server cert untrusted.
3781     * @throws { BusinessError } 5411011 - IO unsupported request.
3782     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3783     * @crossplatform
3784     * @atomicservice
3785     * @since arkts{ '1.1':'18','1.2':'20'}
3786     * @arkts 1.1&1.2
3787     */
3788    on(type: 'error', callback: ErrorCallback): void;
3789    /**
3790     * Unregister listens for playback error events.
3791     * @param { 'error' } type - Type of the playback error event to listen for.
3792     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3793     * @since 9
3794     */
3795    /**
3796     * Unregister listens for playback error events.
3797     * @param { 'error' } type - Type of the playback error event to listen for.
3798     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3799     * @atomicservice
3800     * @since 11
3801     */
3802    /**
3803     * Unsubscribes from AVPlayer errors.
3804     * @param { 'error' } type - Event type, which is **'error'** in this case.
3805     * @param { ErrorCallback } callback - Callback used to return the error code ID and error message.
3806     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3807     * @crossplatform
3808     * @atomicservice
3809     * @since 12
3810     */
3811    off(type: 'error', callback?: ErrorCallback): void;
3812
3813    /**
3814     * Subscribes output device change event callback.
3815     * The event is triggered when output device change for this stream.
3816     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
3817     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event.
3818     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3819     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3820     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3821     * @since 11
3822     */
3823    /**
3824     * Subscribes to audio stream output device changes and reasons. This API uses an asynchronous callback
3825     * to return the result.
3826     *
3827     * When subscribing to this event, you are advised to implement the player behavior when the device is
3828     * connected or disconnected by referring to Responding to Audio Output Device Changes.
3829     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
3830     * The event is triggered when the output device is changed.
3831     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to return the output device
3832     * descriptor of the current audio stream and the change reason.
3833     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3834     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3835     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3836     * @atomicservice
3837     * @since 12
3838     */
3839    on(type: 'audioOutputDeviceChangeWithInfo', callback: Callback<audio.AudioStreamDeviceChangeInfo>): void;
3840
3841    /**
3842     * Unsubscribes output device change event callback.
3843     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
3844     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event.
3845     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3846     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3847     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3848     * @since 11
3849     */
3850    /**
3851     * Unsubscribes from audio stream output device changes and reasons. This API uses an asynchronous callback
3852     * to return the result.
3853     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
3854     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to return the output device
3855     * descriptor of the current audio stream and the change reason.
3856     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3857     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3858     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3859     * @atomicservice
3860     * @since 12
3861     */
3862    off(type: 'audioOutputDeviceChangeWithInfo', callback?: Callback<audio.AudioStreamDeviceChangeInfo>): void;
3863
3864    /**
3865     * Subscribes to subtitle update events. When external subtitles exist, the system notifies the application
3866     * through the subscribed-to callback. An application can subscribe to only one subtitle update event. When
3867     * the application initiates multiple subscriptions to this event, the last subscription is applied.
3868     * @param { 'subtitleUpdate' } type - Type of the event to listen for.
3869     * The event is triggered when the external subtitle is updated.
3870     * @param { Callback<SubtitleInfo> } callback - Callback invoked when the subtitle is updated.
3871     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3872     * @atomicservice
3873     * @since 12
3874     */
3875    on(type: 'subtitleUpdate', callback: Callback<SubtitleInfo>): void
3876
3877    /**
3878     * Unsubscribes from subtitle update events.
3879     * @param { 'subtitleUpdate' } type - Type of the event to listen for.
3880     * @param { Callback<SubtitleInfo> } callback - Callback that has been registered to listen for subtitle
3881     * update events.
3882     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3883     * @atomicservice
3884     * @since 12
3885     */
3886    off(type: 'subtitleUpdate', callback?: Callback<SubtitleInfo>): void
3887
3888    /**
3889     * Subscribes to track change events. When the track changes, the system notifies the application through
3890     * the subscribed-to callback. An application can subscribe to only one track change event. When the
3891     * application initiates multiple subscriptions to this event, the last subscription is applied.
3892     * @param { 'trackChange' } type - Type of the event to listen for.
3893     * The event is triggered when the track changes.
3894     * @param { OnTrackChangeHandler } callback - Callback invoked when the event is triggered.
3895     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3896     * @atomicservice
3897     * @since 12
3898     */
3899    on(type: 'trackChange', callback: OnTrackChangeHandler): void
3900
3901    /**
3902     * Unsubscribes from track change events.
3903     * @param { 'trackChange' } type - Type of the event to listen for.
3904     * The event is triggered when the track changes.
3905     * @param { OnTrackChangeHandler } callback - Callback that has been registered to listen for track changes.
3906     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3907     * @atomicservice
3908     * @since 12
3909     */
3910    off(type: 'trackChange', callback?: OnTrackChangeHandler): void
3911
3912    /**
3913     * Subscribes to track information update events. When the track information is updated, the system notifies the
3914     * application through the subscribed-to callback. An application can subscribe to only one track change event.
3915     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
3916     * @param { 'trackInfoUpdate' } type - Type of the event to listen for.
3917     * The event is triggered when the track information is updated.
3918     * @param { Callback<Array<MediaDescription>> } callback - Callback invoked when the event is triggered.
3919     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3920     * @atomicservice
3921     * @since 12
3922     */
3923    on(type: 'trackInfoUpdate', callback: Callback<Array<MediaDescription>>): void
3924
3925    /**
3926     * Unsubscribes from track information update events.
3927     * @param { 'trackInfoUpdate' } type - Type of the event to listen for.
3928     * The event is triggered when the track information is updated.
3929     * @param { Callback<Array<MediaDescription>> } callback - Callback that has been registered to listen for track
3930     * information updates.
3931     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3932     * @atomicservice
3933     * @since 12
3934     */
3935    off(type: 'trackInfoUpdate', callback?: Callback<Array<MediaDescription>>): void
3936
3937    /**
3938     * Subscribes to update events of the maximum audio level value, which is periodically reported when audio
3939     * resources are played.
3940     * @param { 'amplitudeUpdate' } type - Type of the event to listen for.
3941     * The event is triggered when the amplitude changes.
3942     * @param { Callback<Array<number>> } callback - Callback invoked when the event is triggered.
3943     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3944     * @since 13
3945     */
3946    on(type: 'amplitudeUpdate', callback: Callback<Array<number>>): void
3947
3948    /**
3949     * Unsubscribes from update events of the maximum amplitude.
3950     * @param { 'amplitudeUpdate' } type - Type of the event to listen for.
3951     * The event is triggered when the amplitude changes.
3952     * @param { Callback<Array<number>> } callback - Callback that has been registered to listen for amplitude updates.
3953     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3954     * @since 13
3955     */
3956    off(type: 'amplitudeUpdate', callback?: Callback<Array<number>>): void
3957
3958    /**
3959     * Subscribes to events indicating that a Supplemental Enhancement Information (SEI) message is received. This
3960     * applies only to HTTP-FLV live streaming and is triggered when SEI messages are present in the video stream.
3961     * You must initiate the subscription before calling {@link #prepare}. If you initiate multiple subscriptions
3962     * to this event, the last subscription is applied.
3963     * @param { 'seiMessageReceived' } type - Type of the playback event to listen for.
3964     * The event is triggered when an SEI message is received.
3965     * @param { Array<number> } payloadTypes - Array of subscribed-to payload types of SEI messages. Currently,
3966     * only payloadType = 5 is supported.
3967     * @param { OnSeiMessageHandle } callback - Callback used to listen for SEI message events and receive the
3968     * subscribed-to payload types.
3969     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3970     * @atomicservice
3971     * @since 18
3972     */
3973    on(type: 'seiMessageReceived', payloadTypes: Array<number>, callback: OnSeiMessageHandle): void;
3974
3975    /**
3976     * Unsubscribes from the events indicating that an SEI message is received.
3977     * @param { 'seiMessageReceived' } type - Type of the playback event to listen for.
3978     * The event is triggered when an SEI message is received.
3979     * @param { Array<number> } payloadTypes - The payload types of the SEI message.
3980     *                                        Null means unsubscribe all payload types.
3981
3982     * @param { OnSeiMessageHandle } callback -	Callback used to listen for SEI message events and receive the
3983     * subscribed-to payload types.
3984     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3985     * @atomicservice
3986     * @since 18
3987     */
3988    off(type: 'seiMessageReceived', payloadTypes?: Array<number>, callback?: OnSeiMessageHandle): void;
3989
3990    /**
3991     * Subscribes to the event indicating that super resolution is enabled or disabled.
3992     * @param { 'superResolutionChanged' } type - Type of the super-resolution event to listen for.
3993     * The event is triggered when super resolution is enabled or disabled.
3994     * @param { OnSuperResolutionChanged } callback - Callback used to listen for the super-resolution changed event.
3995     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3996     * @atomicservice
3997     * @since 18
3998     */
3999    on(type:'superResolutionChanged', callback: OnSuperResolutionChanged): void;
4000
4001    /**
4002     * Unsubscribes from the event indicating that super resolution is enabled or disabled.
4003     * @param { 'superResolutionChanged' } type - Type of the super-resolution event to listen for.
4004     * The event is triggered when super resolution is enabled or disabled.
4005     * @param { OnSuperResolutionChanged } [callback] - Callback used to listen for the super-resolution changed event.
4006     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4007     * @atomicservice
4008     * @since 18
4009     */
4010    off(type:'superResolutionChanged', callback?: OnSuperResolutionChanged): void;
4011  }
4012
4013  /**
4014   * Provides player statistic info.
4015   *
4016   * @typedef PlaybackInfo
4017   * @syscap SystemCapability.Multimedia.Media.Core
4018   * @since 12
4019   */
4020  interface PlaybackInfo {
4021    /**
4022     * key:value pair, key see @PlaybackInfoKey.
4023     * @syscap SystemCapability.Multimedia.Media.Core
4024     * @since 12
4025     */
4026    [key:string]: Object;
4027  }
4028
4029  /**
4030   * Enumerates statistics info keys for player.
4031   *
4032   * @enum { string }
4033   * @syscap SystemCapability.Multimedia.Media.Core
4034   * @since 12
4035   */
4036  enum PlaybackInfoKey {
4037    /**
4038     * IP address of current network stream.
4039     * @syscap SystemCapability.Multimedia.Media.Core
4040     * @since 12
4041     */
4042    SERVER_IP_ADDRESS = 'server_ip_address',
4043
4044    /**
4045     * Average download rate during playing except for suspend downloading.
4046     * @syscap SystemCapability.Multimedia.Media.Core
4047     * @since 12
4048     */
4049    AVG_DOWNLOAD_RATE = 'average_download_rate',
4050
4051    /**
4052     * Current download rate of the last second except for suspend downloading.
4053     * @syscap SystemCapability.Multimedia.Media.Core
4054     * @since 12
4055     */
4056    DOWNLOAD_RATE = 'download_rate',
4057
4058    /**
4059     * Boolean value, true for current is downloading, false for suspend downloading.
4060     * @syscap SystemCapability.Multimedia.Media.Core
4061     * @since 12
4062     */
4063    IS_DOWNLOADING = 'is_downloading',
4064
4065    /**
4066     * Cached duration in milliseconds.
4067     * @syscap SystemCapability.Multimedia.Media.Core
4068     * @since 12
4069     */
4070    BUFFER_DURATION = 'buffer_duration',
4071  }
4072
4073  /**
4074   * Enumerates ErrorCode types, return in BusinessError::code
4075   *
4076   * @enum { number }
4077   * @syscap SystemCapability.Multimedia.Media.Core
4078   * @since 8
4079   * @deprecated since 11
4080   * @useinstead ohos.multimedia.media/media.AVErrorCode
4081   */
4082  enum MediaErrorCode {
4083    /**
4084     * operation success.
4085     * @syscap SystemCapability.Multimedia.Media.Core
4086     * @since 8
4087     * @deprecated since 11
4088     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_OK
4089     */
4090    MSERR_OK = 0,
4091
4092    /**
4093     * malloc or new memory failed. maybe system have no memory.
4094     * @syscap SystemCapability.Multimedia.Media.Core
4095     * @since 8
4096     * @deprecated since 11
4097     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_NO_MEMORY
4098     */
4099    MSERR_NO_MEMORY = 1,
4100
4101    /**
4102     * no permission for the operation.
4103     * @syscap SystemCapability.Multimedia.Media.Core
4104     * @since 8
4105     * @deprecated since 11
4106     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_OPERATE_NOT_PERMIT
4107     */
4108    MSERR_OPERATION_NOT_PERMIT = 2,
4109
4110    /**
4111     * invalid argument.
4112     * @syscap SystemCapability.Multimedia.Media.Core
4113     * @since 8
4114     * @deprecated since 11
4115     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER
4116     */
4117    MSERR_INVALID_VAL = 3,
4118
4119    /**
4120     * an I/O error occurred.
4121     * @syscap SystemCapability.Multimedia.Media.Core
4122     * @since 8
4123     * @deprecated since 11
4124     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_IO
4125     */
4126    MSERR_IO = 4,
4127
4128    /**
4129     * operation time out.
4130     * @syscap SystemCapability.Multimedia.Media.Core
4131     * @since 8
4132     * @deprecated since 11
4133     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_TIMEOUT
4134     */
4135    MSERR_TIMEOUT = 5,
4136
4137    /**
4138     * unknown error.
4139     * @syscap SystemCapability.Multimedia.Media.Core
4140     * @since 8
4141     * @deprecated since 11
4142     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER
4143     */
4144    MSERR_UNKNOWN = 6,
4145
4146    /**
4147     * media service died.
4148     * @syscap SystemCapability.Multimedia.Media.Core
4149     * @since 8
4150     * @deprecated since 11
4151     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_SERVICE_DIED
4152     */
4153    MSERR_SERVICE_DIED = 7,
4154
4155    /**
4156     * operation is not permit in current state.
4157     * @syscap SystemCapability.Multimedia.Media.Core
4158     * @since 8
4159     * @deprecated since 11
4160     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER
4161     */
4162    MSERR_INVALID_STATE = 8,
4163
4164    /**
4165     * operation is not supported in current version.
4166     * @syscap SystemCapability.Multimedia.Media.Core
4167     * @since 8
4168     * @deprecated since 11
4169     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_UNSUPPORT_CAPABILITY
4170     */
4171    MSERR_UNSUPPORTED = 9,
4172  }
4173
4174  /**
4175   * Enumerates buffering info type, for network playback.
4176   *
4177   * @enum { number }
4178   * @syscap SystemCapability.Multimedia.Media.Core
4179   * @since 8
4180   */
4181  /**
4182   * Enumerates buffering info type, for network playback.
4183   *
4184   * @enum { number }
4185   * @syscap SystemCapability.Multimedia.Media.Core
4186   * @crossplatform
4187   * @atomicservice
4188   * @since 12
4189   */
4190  enum BufferingInfoType {
4191    /**
4192     * begin to buffering
4193     * @syscap SystemCapability.Multimedia.Media.Core
4194     * @since 8
4195     */
4196    /**
4197     * begin to buffering
4198     * @syscap SystemCapability.Multimedia.Media.Core
4199     * @crossplatform
4200     * @atomicservice
4201     * @since 12
4202     */
4203    BUFFERING_START = 1,
4204
4205    /**
4206     * end to buffering
4207     * @syscap SystemCapability.Multimedia.Media.Core
4208     * @since 8
4209     */
4210    /**
4211     * end to buffering
4212     * @syscap SystemCapability.Multimedia.Media.Core
4213     * @crossplatform
4214     * @atomicservice
4215     * @since 12
4216     */
4217    BUFFERING_END = 2,
4218
4219    /**
4220     * buffering percent
4221     * @syscap SystemCapability.Multimedia.Media.Core
4222     * @since 8
4223     */
4224    /**
4225     * buffering percent
4226     * @syscap SystemCapability.Multimedia.Media.Core
4227     * @crossplatform
4228     * @atomicservice
4229     * @since 12
4230     */
4231    BUFFERING_PERCENT = 3,
4232
4233    /**
4234     * cached duration in milliseconds
4235     * @syscap SystemCapability.Multimedia.Media.Core
4236     * @since 8
4237     */
4238    /**
4239     * cached duration in milliseconds
4240     * @syscap SystemCapability.Multimedia.Media.Core
4241     * @crossplatform
4242     * @atomicservice
4243     * @since 12
4244     */
4245    CACHED_DURATION = 4,
4246  }
4247
4248  /**
4249   * Defines the SourceOpenCallback function which is called by the service. client should process the incoming request
4250   * and return the unique handle to the open resource.
4251   * <br>**NOTE:**<br>
4252   * The client must return the handle immediately after processing the request.
4253   *
4254   * @typedef { function } SourceOpenCallback
4255   * @param { MediaSourceLoadingRequest } request - Parameters for the resource open request, including detailed
4256   * information about the requested resource and the data push method.
4257   * @returns { number } - return the handle of current resource open request.
4258   *                        A value greater than 0 means the request is successful.
4259   *                        A value less than or equal to 0 means it fails.
4260   *                     - The handle for the request object is unique.
4261   *                     - client should return immediately.
4262   * @syscap SystemCapability.Multimedia.Media.Core
4263   * @atomicservice
4264   * @since 18
4265   */
4266  type SourceOpenCallback = (request: MediaSourceLoadingRequest) => number;
4267
4268  /**
4269   * Defines the SourceReadCallback function which is called by the service. Client should record the read requests
4270   * and push the data through the {@link #response} method of the request object when there is sufficient data.
4271   * <br>**NOTE:**<br>
4272   * The client must return the handle immediately after processing the request.
4273   * @typedef { function } SourceReadCallback
4274   * @param { number } uuid - ID for the resource handle.
4275   * @param { number } requestedOffset - Offset of the current media data relative to the start of the resource.
4276   * @param { number } requestedLength - Length of the current request.
4277   *                                   - -1 means reaching the end of the source, need to inform the player
4278   *                                     of the end of the push through the {@link #finishLoading} method.
4279   * @returns { void } - client should return immediately.
4280   * @syscap SystemCapability.Multimedia.Media.Core
4281   * @atomicservice
4282   * @since 18
4283   */
4284  type SourceReadCallback = (uuid: number, requestedOffset: number, requestedLength: number) => void;
4285
4286  /**
4287   * Defines the SourceCloseCallback function which is called by the service. Client should release related resources.
4288   * <br>**NOTE:**<br>
4289   * The client must return the handle immediately after processing the request.
4290   * @typedef { function } SourceCloseCallback
4291   * @param { number } uuid - ID for the resource handle.
4292   * @returns { void } - client should return immediately.
4293   * @syscap SystemCapability.Multimedia.Media.Core
4294   * @atomicservice
4295   * @since 18
4296   */
4297  type SourceCloseCallback = (uuid: number) => void;
4298
4299  /**
4300   * Defines a media data loader, which needs to be implemented by applications.
4301   * @typedef MediaSourceLoader
4302   * @syscap SystemCapability.Multimedia.Media.Core
4303   * @atomicservice
4304   * @since 18
4305   */
4306  interface MediaSourceLoader {
4307    /**
4308     * Callback function is implemented by application, which is used to handle resource opening requests.
4309     * @type { SourceOpenCallback }
4310     * @syscap SystemCapability.Multimedia.Media.Core
4311     * @atomicservice
4312     * @since 18
4313     */
4314    open: SourceOpenCallback;
4315
4316    /**
4317     * Callback function is implemented by application, which is used to handle resource read requests.
4318     * @type { SourceReadCallback }
4319     * @syscap SystemCapability.Multimedia.Media.Core
4320     * @atomicservice
4321     * @since 18
4322     */
4323    read: SourceReadCallback;
4324
4325    /**
4326     * Callback function is implemented by application, which is used to handle resource close request.
4327     * @type { SourceCloseCallback }
4328     * @syscap SystemCapability.Multimedia.Media.Core
4329     * @atomicservice
4330     * @since 18
4331     */
4332    close: SourceCloseCallback;
4333  }
4334
4335  /**
4336   * Enumerates state change reason.
4337   * @enum { number }
4338   * @syscap SystemCapability.Multimedia.Media.Core
4339   * @atomicservice
4340   * @since 18
4341   */
4342  enum LoadingRequestError {
4343    /**
4344     * If reach the resource end, client should return.
4345     * @syscap SystemCapability.Multimedia.Media.Core
4346     * @atomicservice
4347     * @since 18
4348     */
4349    LOADING_ERROR_SUCCESS = 0,
4350
4351    /**
4352     * If resource not ready for access, client should return.
4353     * @syscap SystemCapability.Multimedia.Media.Core
4354     * @atomicservice
4355     * @since 18
4356     */
4357    LOADING_ERROR_NOT_READY = 1,
4358
4359    /**
4360     * If resource url not exist, client should return.
4361     * @syscap SystemCapability.Multimedia.Media.Core
4362     * @atomicservice
4363     * @since 18
4364     */
4365    LOADING_ERROR_NO_RESOURCE = 2,
4366
4367    /**
4368     * If the uuid of resource handle is valid, client should return.
4369     * @syscap SystemCapability.Multimedia.Media.Core
4370     * @atomicservice
4371     * @since 18
4372    */
4373    LOADING_ERROR_INVAID_HANDLE = 3,
4374
4375    /**
4376     * If client has no right to request the resource, client should return.
4377     * @syscap SystemCapability.Multimedia.Media.Core
4378     * @atomicservice
4379     * @since 18
4380     */
4381    LOADING_ERROR_ACCESS_DENIED = 4,
4382
4383    /**
4384     * If access time out, client should return.
4385     * @syscap SystemCapability.Multimedia.Media.Core
4386     * @atomicservice
4387     * @since 18
4388     */
4389    LOADING_ERROR_ACCESS_TIMEOUT = 5,
4390
4391    /**
4392     * If authorization failed, client should return.
4393     * @syscap SystemCapability.Multimedia.Media.Core
4394     * @atomicservice
4395     * @since 18
4396     */
4397    LOADING_ERROR_AUTHORIZE_FAILED = 6,
4398  }
4399
4400  /**
4401   * Loading Request object. Application obtains the requested resource location through this object
4402   * and send data to AVPlayer.
4403   * @typedef MediaSourceLoadingRequest
4404   * @syscap SystemCapability.Multimedia.Media.Core
4405   * @atomicservice
4406   * @since 18
4407   */
4408  interface MediaSourceLoadingRequest {
4409    /**
4410     * Location for resource to be opened by the application.
4411     * @type { string }
4412     * @syscap SystemCapability.Multimedia.Media.Core
4413     * @atomicservice
4414     * @since 18
4415     */
4416    url: string;
4417
4418    /**
4419     * HTTP request header. If the header exists, the application should set the header information in
4420     * the HTTP request when downloading data.
4421     * @type { ?Record<string, string> }
4422     * @syscap SystemCapability.Multimedia.Media.Core
4423     * @atomicservice
4424     * @since 18
4425     */
4426    header?: Record<string, string>;
4427
4428    /**
4429     * The interface for application used to send requested data to AVPlayer.
4430     * @param { number } uuid - ID for the resource handle.
4431     * @param { number } offset - Offset of the current media data relative to the start of the resource.
4432     * @param { ArrayBuffer } buffer - Media data sent to the player.
4433     * @returns { number } - accept bytes for current read. The value less than zero means failed.
4434     *                    -2, means player need current data any more, the client should stop current read process.
4435     *                    -3, means player buffer is full, the client should wait for next read.
4436     * @syscap  SystemCapability.Multimedia.Media.Core
4437     * @atomicservice
4438     * @since 18
4439     */
4440    respondData(uuid: number, offset: number, buffer: ArrayBuffer): number;
4441
4442    /**
4443     * The interface for application used to send respond header to AVPlayer
4444     * should be called before calling the {@link #respondData()} for the first time.
4445     * @param { number } uuid - ID for the resource handle.
4446     * @param { ?Record<string, string> } [header] - header info in the http response.
4447     * The application can intersect the header fields with the fields supported by the underlying layer for
4448     * parsing or directly pass in all corresponding header information.
4449     * @param { ?string } [redirectUrl] - redirect url from the http response if exist.
4450     * @syscap  SystemCapability.Multimedia.Media.Core
4451     * @atomicservice
4452     * @since 18
4453     */
4454    respondHeader(uuid: number, header?: Record<string, string>, redirectUrl?: string): void;
4455
4456    /**
4457     * Notifies the player of the current request status. After pushing all the data for a single resource, the
4458     * application should send the **LOADING_ERROR_SUCCESS** state to notify the player that the resource push is
4459     * complete.
4460     * @param { number } uuid - ID for the resource handle.
4461     * @param { LoadingRequestError } state - Request status.
4462     * @syscap  SystemCapability.Multimedia.Media.Core
4463     * @atomicservice
4464     * @since 18
4465     */
4466    finishLoading(uuid: number, state: LoadingRequestError): void;
4467  }
4468
4469  /**
4470   * Media Stream. AVPlayer use this for mediaData access, current version only support live stream.
4471   * @typedef MediaStream
4472   * @syscap SystemCapability.Multimedia.Media.Core
4473   * @atomicservice
4474   * @since 19
4475   */
4476  interface MediaStream {
4477    /**
4478     * url for this mediaStream
4479     * @type { string }
4480     * @syscap SystemCapability.Multimedia.Media.Core
4481     * @atomicservice
4482     * @since 19
4483     */
4484    url: string;
4485
4486    /**
4487     * video width.
4488     * @type { number }
4489     * @syscap SystemCapability.Multimedia.Media.Core
4490     * @atomicservice
4491     * @since 19
4492     */
4493    width: number;
4494
4495    /**
4496     * video height.
4497     * @type { number }
4498     * @syscap SystemCapability.Multimedia.Media.Core
4499     * @atomicservice
4500     * @since 19
4501     */
4502    height: number;
4503
4504    /**
4505     * biterate of this mediaStream.
4506     * @type { number }
4507     * @syscap SystemCapability.Multimedia.Media.Core
4508     * @atomicservice
4509     * @since 19
4510     */
4511    bitrate: number;
4512  }
4513
4514  /**
4515   * Media source descriptor. User can set media data information
4516
4517   * @typedef MediaSource
4518   * @syscap SystemCapability.Multimedia.Media.Core
4519   * @atomicservice
4520   * @since 12
4521   */
4522  interface MediaSource {
4523    /**
4524     * Set Media Mime Type to help player handle extended Media source.
4525     * @param { AVMimeTypes } mimeType - for MediaSource define. see @ AVMimeTypes.
4526     * @syscap SystemCapability.Multimedia.Media.Core
4527     * @atomicservice
4528     * @since 12
4529     */
4530    setMimeType(mimeType: AVMimeTypes): void;
4531
4532    /**
4533     * Set Media source loader to help player access MediaData.
4534     * @param { MediaSourceLoader } resourceLoader - callback function interface set for player use.
4535     * @syscap SystemCapability.Multimedia.Media.Core
4536     * @atomicservice
4537     * @since 18
4538     */
4539    setMediaResourceLoaderDelegate(resourceLoader: MediaSourceLoader): void;
4540  }
4541
4542  /**
4543   * Enumerates Media Mime types, used for MediaSource define;
4544   * @enum { string }
4545   * @syscap SystemCapability.Multimedia.Media.Core
4546   * @atomicservice
4547   * @since 12
4548   */
4549  enum AVMimeTypes {
4550    /**
4551     * Indicate current file is index file for hls Media.
4552     * @syscap SystemCapability.Multimedia.Media.Core
4553     * @atomicservice
4554     * @since 12
4555     */
4556    APPLICATION_M3U8 = 'application/m3u8',
4557  }
4558  /**
4559   * Provides preferred playback settings for player.
4560   *
4561   * @typedef PlaybackStrategy
4562   * @syscap SystemCapability.Multimedia.Media.Core
4563   * @atomicservice
4564   * @since 12
4565   */
4566  interface PlaybackStrategy {
4567    /**
4568     * Choose a stream with width close to it.
4569     * @type { ?number }
4570     * @syscap SystemCapability.Multimedia.Media.Core
4571     * @atomicservice
4572     * @since 12
4573     */
4574    preferredWidth?: number;
4575    /**
4576     * Choose a stream with height close to it.
4577     * @type { ?number }
4578     * @syscap SystemCapability.Multimedia.Media.Core
4579     * @atomicservice
4580     * @since 12
4581     */
4582    preferredHeight?: number;
4583    /**
4584     * Chooses a preferred buffer duration.
4585     *
4586     * <p>The preferred buffer duration in the playback policy, is used to set the buffer size. For details,
4587     * see [Online Video Frame Freezing Optimization Practice]{@link
4588     * https://developer.huawei.com/consumer/cn/doc/best-practices/bpta-online-video-playback-lags-practice}.</p>
4589     *
4590     * @type { ?number }
4591     * @syscap SystemCapability.Multimedia.Media.Core
4592     * @atomicservice
4593     * @since 12
4594     */
4595    preferredBufferDuration?: number;
4596
4597    /**
4598     * If true, the player should choose HDR stream if exist.
4599     * @type { ?boolean }
4600     * @syscap SystemCapability.Multimedia.Media.Core
4601     * @atomicservice
4602     * @since 12
4603     */
4604    preferredHdr?: boolean;
4605
4606    /**
4607     * mute the specified media stream when playing.
4608     * @type { ?MediaType }
4609     * @syscap SystemCapability.Multimedia.Media.Core
4610     * @since 12
4611     */
4612    mutedMediaType?: MediaType;
4613
4614    /**
4615     * Audio language.
4616     * @type { ?string }
4617     * @syscap SystemCapability.Multimedia.Media.Core
4618     * @atomicservice
4619     * @since 13
4620     */
4621    preferredAudioLanguage?: string;
4622
4623    /**
4624     * Subtitle language.
4625     * @type { ?string }
4626     * @syscap SystemCapability.Multimedia.Media.Core
4627     * @atomicservice
4628     * @since 13
4629     */
4630    preferredSubtitleLanguage?: string;
4631
4632    /**
4633     * Show first frame on prepare.
4634     * @type { ?boolean }
4635     * @syscap SystemCapability.Multimedia.Media.Core
4636     * @atomicservice
4637     * @since 17
4638     */
4639    showFirstFrameOnPrepare?: boolean;
4640
4641    /**
4642     * Customize the buffering threshold for start or restart playing. The unit is second.
4643     * @type { ?number }
4644     * @syscap SystemCapability.Multimedia.Media.Core
4645     * @atomicservice
4646     * @since 18
4647     */
4648    preferredBufferDurationForPlaying?: number;
4649
4650    /**
4651     * Enable super-resolution feature. default is false.
4652     * Must enable super-resolution feature before calling {@link #setSuperResolution} and {@link #setVideoWindowSize}.
4653     * @type { ?boolean }
4654     * @syscap SystemCapability.Multimedia.Media.Core
4655     * @atomicservice
4656     * @since 18
4657     */
4658    enableSuperResolution?: boolean;
4659
4660    /**
4661     * set max buffering threshold for liveStreaming or avplayer while change the speed.
4662     * It is recommended that the value be 2 seconds greater than the starting waterline.
4663     * @type { ?number }
4664     * @syscap SystemCapability.Multimedia.Media.Core
4665     * @atomicservice
4666     * @since 18
4667     */
4668    thresholdForAutoQuickPlay?: number
4669
4670    /**
4671     * Indicates whether to keep the decoder working when closing the media,
4672     * which is used to facilitate quick opening of the media. Currently only supports video
4673     * @type { ?boolean } The default value is false, which means that the corresponding decoder
4674     *                    will be stopped when the media is closed to reduce power consumption.
4675     * @syscap SystemCapability.Multimedia.Media.Core
4676     * @atomicservice
4677     * @since 20
4678     */
4679    keepDecodingOnMute?: boolean;
4680
4681    /**
4682     * Indicates whether to enable camera post-processing during video playback,
4683     * which is used to apply image enhancements when playing back video content.
4684     * @type { ?boolean } The default value is false, which means that the video
4685     *                    will be played back without any camera post-processing effects.
4686     * @syscap SystemCapability.Multimedia.Media.Core
4687     * @systemapi
4688     * @since 20
4689     * @arkts 1.1&1.2
4690     */
4691    enableCameraPostprocessing?: boolean;
4692  }
4693
4694  /**
4695   * Media file descriptor. The caller needs to ensure that the fd is valid and
4696   * the offset and length are correct.
4697   *
4698   * @typedef AVFileDescriptor
4699   * @syscap SystemCapability.Multimedia.Media.Core
4700   * @since 9
4701   */
4702  /**
4703   * Media file descriptor. The caller needs to ensure that the fd is valid and
4704   * the offset and length are correct.
4705   *
4706   * @typedef AVFileDescriptor
4707   * @syscap SystemCapability.Multimedia.Media.Core
4708   * @atomicservice
4709   * @since 11
4710   */
4711  /**
4712   * Media file descriptor. The caller needs to ensure that the fd is valid and
4713   * the offset and length are correct.
4714   *
4715   * @typedef AVFileDescriptor
4716   * @syscap SystemCapability.Multimedia.Media.Core
4717   * @crossplatform
4718   * @atomicservice
4719   * @since 12
4720   */
4721  interface AVFileDescriptor {
4722    /**
4723     * The file descriptor of audio or video source from file system. The caller
4724     * is responsible to close the file descriptor.
4725     * @syscap SystemCapability.Multimedia.Media.Core
4726     * @since 9
4727     */
4728    /**
4729     * The file descriptor of audio or video source from file system. The caller
4730     * is responsible to close the file descriptor.
4731     * @syscap SystemCapability.Multimedia.Media.Core
4732     * @atomicservice
4733     * @since 11
4734     */
4735    /**
4736     * The file descriptor of audio or video source from file system. The caller
4737     * is responsible to close the file descriptor.
4738     * @type { number }
4739     * @syscap SystemCapability.Multimedia.Media.Core
4740     * @crossplatform
4741     * @atomicservice
4742     * @since 12
4743     */
4744    fd: number
4745
4746    /**
4747     * The offset into the file where the data to be read, in bytes. By default,
4748     * the offset is zero.
4749     * @syscap SystemCapability.Multimedia.Media.Core
4750     * @since 9
4751     */
4752    /**
4753     * The offset into the file where the data to be read, in bytes. By default,
4754     * the offset is zero.
4755     * @syscap SystemCapability.Multimedia.Media.Core
4756     * @atomicservice
4757     * @since 11
4758     */
4759    /**
4760     * The offset into the file where the data to be read, in bytes. By default,
4761     * the offset is zero.
4762     * @type { ?number }
4763     * @syscap SystemCapability.Multimedia.Media.Core
4764     * @crossplatform
4765     * @atomicservice
4766     * @since 12
4767     */
4768    offset?: number
4769
4770    /**
4771     * The length in bytes of the data to be read. By default, the length is the
4772     * rest of bytes in the file from the offset.
4773     * @syscap SystemCapability.Multimedia.Media.Core
4774     * @since 9
4775     */
4776    /**
4777     * The length in bytes of the data to be read. By default, the length is the
4778     * rest of bytes in the file from the offset.
4779     * @syscap SystemCapability.Multimedia.Media.Core
4780     * @atomicservice
4781     * @since 11
4782     */
4783    /**
4784     * The length in bytes of the data to be read. By default, the length is the
4785     * rest of bytes in the file from the offset.
4786     * @type { ?number }
4787     * @syscap SystemCapability.Multimedia.Media.Core
4788     * @crossplatform
4789     * @atomicservice
4790     * @since 12
4791     */
4792    length?: number
4793  }
4794
4795  /**
4796    * DataSource descriptor. The caller needs to ensure that the fileSize and
4797    * callback is valid.
4798    *
4799    * @typedef AVDataSrcDescriptor
4800    * @syscap SystemCapability.Multimedia.Media.AVPlayer
4801    * @since 10
4802    */
4803  /**
4804   * DataSource descriptor. The caller needs to ensure that the fileSize and
4805   * callback is valid.
4806   *
4807   * @typedef AVDataSrcDescriptor
4808   * @syscap SystemCapability.Multimedia.Media.AVPlayer
4809   * @atomicservice
4810   * @since 11
4811   */
4812  /**
4813   * Defines the descriptor of an audio and video file, which is used in DataSource playback mode.
4814   * Use scenario: An application can create a playback instance and start playback before it finishes
4815   * downloading the audio and video resources.
4816   *
4817   * @typedef AVDataSrcDescriptor
4818   * @syscap SystemCapability.Multimedia.Media.AVPlayer
4819   * @crossplatform
4820   * @atomicservice
4821   * @since 12
4822   */
4823  interface AVDataSrcDescriptor {
4824    /**
4825     * Size of the file, -1 means the file size is unknown, in this case,
4826     * seek and setSpeed can't be executed, loop can't be set, and can't replay.
4827     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4828     * @since 10
4829     */
4830    /**
4831     * Size of the file, -1 means the file size is unknown, in this case,
4832     * seek and setSpeed can't be executed, loop can't be set, and can't replay.
4833     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4834     * @atomicservice
4835     * @since 11
4836     */
4837    /**
4838     * Size of the file, -1 means the file size is unknown, in this case,
4839     * seek and setSpeed can't be executed, loop can't be set, and can't replay.
4840     * @type { number }
4841     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4842     * @crossplatform
4843     * @atomicservice
4844     * @since 12
4845     */
4846    fileSize: number;
4847    /**
4848     * Callback function implemented by users, which is used to fill data.
4849     * buffer - The buffer need to fill.
4850     * length - The stream length player want to get.
4851     * pos - The stream position player want get start, and is an optional parameter.
4852     * When fileSize set to -1, this parameter is not used.
4853     * Returns length of the data to be filled.
4854     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4855     * @since 10
4856     */
4857    /**
4858     * Callback function implemented by users, which is used to fill data.
4859     * buffer - The buffer need to fill.
4860     * length - The stream length player want to get.
4861     * pos - The stream position player want get start, and is an optional parameter.
4862     * When fileSize set to -1, this parameter is not used.
4863     * Returns length of the data to be filled.
4864     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4865     * @atomicservice
4866     * @since 11
4867     */
4868    /**
4869     * Callback function implemented by users, which is used to fill data.
4870     * buffer - The buffer need to fill.
4871     * length - The stream length player want to get.
4872     * pos - The stream position player want get start, and is an optional parameter.
4873     * When fileSize set to -1, this parameter is not used.
4874     * Returns length of the data to be filled, Return -1 to indicate that the end of the stream is reached,
4875     * Return -2 to indicate that an unrecoverable error has been encountered.
4876     * @type { function }
4877     * @syscap SystemCapability.Multimedia.Media.AVPlayer
4878     * @crossplatform
4879     * @atomicservice
4880     * @since 12
4881     */
4882    callback: (buffer: ArrayBuffer, length: number, pos?: number) => number;
4883  }
4884
4885  /**
4886   * Provides subtitle information. When a subtitle update event is subscribed to, the information about the
4887   * external subtitle is returned through a callback.
4888   * Can be synchronized to the time reported by AVPlayer#timeUpdate event
4889   *
4890   * @typedef SubtitleInfo
4891   * @syscap SystemCapability.Multimedia.Media.Core
4892   * @atomicservice
4893   * @since 12
4894   */
4895  interface SubtitleInfo {
4896    /**
4897     * Duration of the text to be displayed, as milliseconds.
4898     * @type { ?number }
4899     * @syscap SystemCapability.Multimedia.Media.Core
4900     * @atomicservice
4901     * @since 12
4902     */
4903    duration?: number;
4904    /**
4905     * Display start time of the text, as milliseconds.
4906     * @type { ?number }
4907     * @syscap SystemCapability.Multimedia.Media.Core
4908     * @atomicservice
4909     * @since 12
4910     */
4911    startTime?: number;
4912    /**
4913     * Text information of current update event.
4914     * @type { ?string }
4915     * @syscap SystemCapability.Multimedia.Media.Core
4916     * @atomicservice
4917     * @since 12
4918     */
4919    text?: string;
4920  }
4921
4922  /**
4923   * Describes audio playback states.
4924   * @typedef { 'idle' | 'playing' | 'paused' | 'stopped' | 'error' }
4925   * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4926   * @since 6
4927   * @deprecated since 9
4928   * @useinstead ohos.multimedia.media/media.AVPlayerState
4929   */
4930  type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error';
4931
4932  /**
4933   * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer()
4934   * to create an AudioPlayer instance.
4935   *
4936   * @typedef AudioPlayer
4937   * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4938   * @since 6
4939   * @deprecated since 9
4940   * @useinstead ohos.multimedia.media/media.AVPlayer
4941   */
4942  interface AudioPlayer {
4943    /**
4944     * Starts audio playback.
4945     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4946     * @since 6
4947     * @deprecated since 9
4948     * @useinstead ohos.multimedia.media/media.AVPlayer#play
4949     */
4950    play(): void;
4951
4952    /**
4953     * Pauses audio playback.
4954     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4955     * @since 6
4956     * @deprecated since 9
4957     * @useinstead ohos.multimedia.media/media.AVPlayer#pause
4958     */
4959    pause(): void;
4960
4961    /**
4962     * Stops audio playback.
4963     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4964     * @since 6
4965     * @deprecated since 9
4966     * @useinstead ohos.multimedia.media/media.AVPlayer#stop
4967     */
4968    stop(): void;
4969
4970    /**
4971     * Resets audio playback.
4972     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4973     * @since 7
4974     * @deprecated since 9
4975     * @useinstead ohos.multimedia.media/media.AVPlayer#reset
4976     */
4977    reset(): void;
4978
4979    /**
4980     * Jumps to the specified playback position.
4981     * @param { number } timeMs - Playback position to jump
4982     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4983     * @since 6
4984     * @deprecated since 9
4985     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
4986     */
4987    seek(timeMs: number): void;
4988
4989    /**
4990     * Sets the volume.
4991     * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
4992     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
4993     * @since 6
4994     * @deprecated since 9
4995     * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume
4996     */
4997    setVolume(vol: number): void;
4998
4999    /**
5000     * Releases resources used for audio playback.
5001     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5002     * @since 6
5003     * @deprecated since 9
5004     * @useinstead ohos.multimedia.media/media.AVPlayer#release
5005     */
5006    release(): void;
5007
5008    /**
5009     * Get all track infos in MediaDescription, should be called after data loaded callback.
5010     * @param { AsyncCallback<Array<MediaDescription>> } callback - async callback return track info in MediaDescription.
5011     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5012     * @since 8
5013     * @deprecated since 9
5014     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
5015     */
5016    getTrackDescription(callback: AsyncCallback<Array<MediaDescription>>): void;
5017
5018    /**
5019     * Get all track infos in MediaDescription, should be called after data loaded callback.
5020     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
5021     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5022     * @since 8
5023     * @deprecated since 9
5024     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
5025     */
5026    getTrackDescription(): Promise<Array<MediaDescription>>;
5027
5028    /**
5029     * Listens for audio playback buffering events.
5030     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
5031     * @param { function } callback - Callback used to listen for the buffering update event,
5032	 * return BufferingInfoType and the value.
5033     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5034     * @since 8
5035     * @deprecated since 9
5036     * @useinstead ohos.multimedia.media/media.AVPlayer#event:bufferingUpdate
5037     */
5038    on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
5039
5040    /**
5041     * Audio media URI. Mainstream audio formats are supported.
5042     * local:fd://XXX, file://XXX. network:http://xxx
5043     * @type { string }
5044     * @permission ohos.permission.READ_MEDIA or ohos.permission.INTERNET
5045     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5046     * @since 6
5047     * @deprecated since 9
5048     * @useinstead ohos.multimedia.media/media.AVPlayer#url
5049     */
5050    src: string;
5051
5052    /**
5053     * Audio file descriptor. Mainstream audio formats are supported.
5054     * @type { AVFileDescriptor }
5055     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5056     * @since 9
5057     * @deprecated since 9
5058     * @useinstead ohos.multimedia.media/media.AVPlayer#fdSrc
5059     */
5060    fdSrc: AVFileDescriptor;
5061
5062    /**
5063     * Whether to loop audio playback. The value true means to loop playback.
5064     * @type { boolean }
5065     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5066     * @since 6
5067     * @deprecated since 9
5068     * @useinstead ohos.multimedia.media/media.AVPlayer#loop
5069     */
5070    loop: boolean;
5071
5072    /**
5073     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
5074     * set, the default mode will be used. Set it before calling the {@link #play()} in the
5075     * first time in order for the interrupt mode to become effective thereafter.
5076     * @type { ?audio.InterruptMode }
5077     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5078     * @since 9
5079     * @deprecated since 9
5080     * @useinstead ohos.multimedia.media/media.AVPlayer#audioInterruptMode
5081     */
5082    audioInterruptMode?: audio.InterruptMode;
5083
5084    /**
5085     * Current playback position.
5086     * @type { number }
5087     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5088     * @since 6
5089     * @deprecated since 9
5090     * @useinstead ohos.multimedia.media/media.AVPlayer#currentTime
5091     */
5092    readonly currentTime: number;
5093
5094    /**
5095     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
5096     * @type { number }
5097     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5098     * @since 6
5099     * @deprecated since 9
5100     * @useinstead ohos.multimedia.media/media.AVPlayer#duration
5101     */
5102    readonly duration: number;
5103
5104    /**
5105     * Playback state.
5106     * @type { AudioState }
5107     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5108     * @since 6
5109     * @deprecated since 9
5110     * @useinstead ohos.multimedia.media/media.AVPlayer#state
5111     */
5112    readonly state: AudioState;
5113
5114    /**
5115     * Listens for audio playback events.
5116     * @param { 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange' } type - Type of the playback event to listen for.
5117     * @param { function } callback - Callback used to listen for the playback event.
5118     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5119     * @since 6
5120     * @deprecated since 9
5121     * @useinstead ohos.multimedia.media/media.AVPlayer#event:stateChange
5122     */
5123    on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange', callback: () => void): void;
5124
5125    /**
5126     * Listens for audio playback events.
5127     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
5128     * @param { Callback<number> } callback - Callback used to listen for the playback event.
5129     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5130     * @since 6
5131     * @deprecated since 9
5132     * @useinstead ohos.multimedia.media/media.AVPlayer#event:timeUpdate
5133     */
5134    on(type: 'timeUpdate', callback: Callback<number>): void;
5135
5136    /**
5137     * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
5138     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
5139     * @param { function } callback - Callback used to listen for the playback event return audio interrupt info.
5140     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5141     * @since 9
5142     * @deprecated since 9
5143     * @useinstead ohos.multimedia.media/media.AVPlayer#event:audioInterrupt
5144     */
5145    on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
5146
5147    /**
5148     * Listens for playback error events.
5149     * @param { 'error' } type - Type of the playback error event to listen for.
5150     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
5151     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
5152     * @since 6
5153     * @deprecated since 9
5154     * @useinstead ohos.multimedia.media/media.AVPlayer#event:error
5155     */
5156    on(type: 'error', callback: ErrorCallback): void;
5157  }
5158
5159  /**
5160   * Describes media recorder states.
5161   * @typedef {'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error'}
5162   * @syscap SystemCapability.Multimedia.Media.AVRecorder
5163   * @since 9
5164   */
5165  /**
5166   * Describes media recorder states.
5167   * @typedef {'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error'}
5168   * @syscap SystemCapability.Multimedia.Media.AVRecorder
5169   * @crossplatform
5170   * @atomicservice
5171   * @since 12
5172   */
5173  type AVRecorderState = 'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error';
5174
5175  /**
5176   * Defines the onMove callback.
5177   *
5178   * @typedef { function } OnAVRecorderStateChangeHandler
5179   * @param { AVRecorderState } state - state value for AVRecorder.
5180   * @param { StateChangeReason } reason - reason for state change.
5181   * @syscap SystemCapability.Multimedia.Media.AVRecorder
5182   * @crossplatform
5183   * @atomicservice
5184   * @since 12
5185   */
5186  type OnAVRecorderStateChangeHandler = (state: AVRecorderState, reason: StateChangeReason) => void;
5187
5188  /**
5189   * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder()
5190   * to create an AVRecorder instance.
5191   *
5192   * @typedef AVRecorder
5193   * @syscap SystemCapability.Multimedia.Media.AVRecorder
5194   * @since 9
5195   */
5196  /**
5197   * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder()
5198   * to create an AVRecorder instance.
5199   *
5200   * @typedef AVRecorder
5201   * @syscap SystemCapability.Multimedia.Media.AVRecorder
5202   * @crossplatform
5203   * @atomicservice
5204   * @since 12
5205   */
5206  interface AVRecorder {
5207    /**
5208     * Prepares for recording.
5209     * @permission ohos.permission.MICROPHONE
5210     * @param { AVRecorderConfig } config - Recording parameters.
5211     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
5212     * @throws { BusinessError } 201 - Permission denied. Return by callback.
5213     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5214     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
5215     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5216     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5217     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5218     * @since 9
5219     */
5220    /**
5221     * Sets audio and video recording parameters. This API uses an asynchronous callback to return the result.
5222     * @permission ohos.permission.MICROPHONE
5223     * @param { AVRecorderConfig } config - Audio and video recording parameters to set.
5224     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5225     * **err** is **undefined**; otherwise, **err** is an error object.
5226     * @throws { BusinessError } 201 - Permission denied. Return by callback.
5227     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5228     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
5229     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5230     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5231     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5232     * @crossplatform
5233     * @since 12
5234     * @example
5235     * import { BusinessError } from '@kit.BasicServicesKit';
5236     *
5237     * // Configure the parameters based on those supported by the hardware device.
5238     * let avRecorderProfile: media.AVRecorderProfile = {
5239     *   audioBitrate : 48000,
5240     *   audioChannels : 2,
5241     *   audioCodec : media.CodecMimeType.AUDIO_AAC,
5242     *   audioSampleRate : 48000,
5243     *   fileFormat : media.ContainerFormatType.CFT_MPEG_4,
5244     *   videoBitrate : 2000000,
5245     *   videoCodec : media.CodecMimeType.VIDEO_AVC,
5246     *   videoFrameWidth : 640,
5247     *   videoFrameHeight : 480,
5248     *   videoFrameRate : 30
5249     * }
5250     * let avRecorderConfig: media.AVRecorderConfig = {
5251     *   audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
5252     *   videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV,
5253     *   profile : avRecorderProfile,
5254     *   url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45.
5255     *   rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error.
5256     *   location : { latitude : 30, longitude : 130 }
5257     * }
5258     *
5259     * avRecorder.prepare(avRecorderConfig, (err: BusinessError) => {
5260     *   if (err) {
5261     *     console.error('Failed to prepare and error is ' + err.message);
5262     *   } else {
5263     *     console.info('Succeeded in preparing');
5264     *   }
5265     * })
5266     */
5267    prepare(config: AVRecorderConfig, callback: AsyncCallback<void>): void;
5268
5269    /**
5270     * Prepares for recording.
5271     * @permission ohos.permission.MICROPHONE
5272     * @param { AVRecorderConfig } config - Recording parameters.
5273     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
5274     * @throws { BusinessError } 201 - Permission denied. Return by promise.
5275     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
5276     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5277     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5278     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5279     * @since 9
5280     */
5281    /**
5282     * Sets audio and video recording parameters. This API uses a promise to return the result.
5283     * This permission is required only if audio recording is involved.
5284     * @permission ohos.permission.MICROPHONE
5285     * @param { AVRecorderConfig } config - Recording parameters.
5286     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
5287     * @throws { BusinessError } 201 - Permission denied. Return by promise.
5288     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5289     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
5290     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5291     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5292     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5293     * @crossplatform
5294     * @atomicservice
5295     * @since 12
5296     * @example
5297     * import { BusinessError } from '@kit.BasicServicesKit';
5298     *
5299     * // Configure the parameters based on those supported by the hardware device.
5300     * let avRecorderProfile: media.AVRecorderProfile = {
5301     *   audioBitrate : 48000,
5302     *   audioChannels : 2,
5303     *   audioCodec : media.CodecMimeType.AUDIO_AAC,
5304     *   audioSampleRate : 48000,
5305     *   fileFormat : media.ContainerFormatType.CFT_MPEG_4,
5306     *   videoBitrate : 2000000,
5307     *   videoCodec : media.CodecMimeType.VIDEO_AVC,
5308     *   videoFrameWidth : 640,
5309     *   videoFrameHeight : 480,
5310     *   videoFrameRate : 30
5311     * }
5312     * let avRecorderConfig: media.AVRecorderConfig = {
5313     *   audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC,
5314     *   videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV,
5315     *   profile : avRecorderProfile,
5316     *   url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45.
5317     *   rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error.
5318     *   location : { latitude : 30, longitude : 130 }
5319     * }
5320     *
5321     * avRecorder.prepare(avRecorderConfig).then(() => {
5322     *   console.info('Succeeded in preparing');
5323     * }).catch((err: BusinessError) => {
5324     *   console.error('Failed to prepare and catch error is ' + err.message);
5325     * });
5326     */
5327    prepare(config: AVRecorderConfig): Promise<void>;
5328
5329    /**
5330     * Obtains the real-time configuration of this AVRecorder.
5331     * This API uses an asynchronous callback to return the result.
5332     * This API can be called only after prepare() is called.
5333     * @param { AsyncCallback<AVRecorderConfig> } callback - Callback used to return the result.
5334     * If the operation is successful, **err** is **undefined** and **data** is the real-time configuration obtained;
5335     * otherwise, **err** is an error object.
5336     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5337     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5338     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5339     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5340     * @since 11
5341     * @example
5342     * import { BusinessError } from '@kit.BasicServicesKit';
5343     *
5344     * let avConfig: media.AVRecorderConfig;
5345     *
5346     * avRecorder.getAVRecorderConfig((err: BusinessError, config: media.AVRecorderConfig) => {
5347     *   if (err) {
5348     *     console.error('Failed to get avConfig and error is ' + err.message);
5349     *   } else {
5350     *     console.info('Succeeded in getting AVRecorderConfig');
5351     *     avConfig = config;
5352     *   }
5353     * });
5354     */
5355    getAVRecorderConfig(callback: AsyncCallback<AVRecorderConfig>): void;
5356
5357    /**
5358     * Obtains the real-time configuration of this AVRecorder. This API uses a promise to return the result.
5359     * This API can be called only after prepare() is called.
5360     * @returns { Promise<AVRecorderConfig> } Promise used to return the real-time configuration.
5361     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5362     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5363     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5364     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5365     * @since 11
5366     * @example
5367     * import { BusinessError } from '@kit.BasicServicesKit';
5368     *
5369     * let avConfig: media.AVRecorderConfig;
5370     *
5371     * avRecorder.getAVRecorderConfig().then((config: media.AVRecorderConfig) => {
5372     *   console.info('Succeeded in getting AVRecorderConfig');
5373     *   avConfig = config;
5374     * }).catch((err: BusinessError) => {
5375     *   console.error('Failed to get AVRecorderConfig and catch error is ' + err.message);
5376     * });
5377     */
5378    getAVRecorderConfig(): Promise<AVRecorderConfig>;
5379
5380    /**
5381     * Obtains the surface required for recording. This API uses an asynchronous callback to return the result.
5382     * The caller obtains the **surfaceBuffer** from this surface and fills in the corresponding video data.
5383     *
5384     * Note that the video data must carry the timestamp (in ns) and buffer size, and the start time of the timestamp
5385     * must be based on the system startup time.
5386     *
5387     * This API can be called only after the prepare() API is called.
5388     * @param { AsyncCallback<string> } callback - Callback used to return the result. If the operation is successful,
5389     * **err** is **undefined** and **data** is the surface ID obtained; otherwise, **err** is an error object.
5390     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5391     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5392     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5393     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5394     * @since 9
5395     * @example
5396     * import { BusinessError } from '@kit.BasicServicesKit';
5397     * let surfaceID: string; // The surfaceID is transferred to the camera API to create a videoOutput instance.
5398     *
5399     * avRecorder.getInputSurface((err: BusinessError, surfaceId: string) => {
5400     *   if (err) {
5401     *     console.error('Failed to do getInputSurface and error is ' + err.message);
5402     *   } else {
5403     *     console.info('Succeeded in doing getInputSurface');
5404     *     surfaceID = surfaceId;
5405     *   }
5406     * });
5407     */
5408    getInputSurface(callback: AsyncCallback<string>): void;
5409
5410    /**
5411     * Obtains the surface required for recording. This API uses a promise to return the result.
5412     * The caller obtains the **surfaceBuffer** from this surface and fills in the corresponding video data.
5413     *
5414     * Note that the video data must carry the timestamp (in ns) and buffer size, and the start time of the timestamp must be based on the system startup time.
5415     *
5416     * This API can be called only after the prepare() API is called.
5417     * @returns { Promise<string> } Promise used to return the result.
5418     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5419     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5420     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5421     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5422     * @since 9
5423     * @example
5424     * import { BusinessError } from '@kit.BasicServicesKit';
5425     * let surfaceID: string; // The surfaceID is transferred to the camera API to create a videoOutput instance.
5426     *
5427     * avRecorder.getInputSurface().then((surfaceId: string) => {
5428     *   console.info('Succeeded in getting InputSurface');
5429     *   surfaceID = surfaceId;
5430     * }).catch((err: BusinessError) => {
5431     *   console.error('Failed to get InputSurface and catch error is ' + err.message);
5432     * });
5433     */
5434    getInputSurface(): Promise<string>;
5435
5436    /**
5437     * Get input meta surface for specified meta source type. it must be called between prepare completed and start.
5438     * @param { MetaSourceType } type - Meta source type.
5439     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
5440     * @throws { BusinessError } 202 - Called from Non-System applications. Return by promise.
5441     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5442     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
5443     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5444     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5445     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5446     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5447     * @systemapi
5448     * @since 12
5449     */
5450    getInputMetaSurface(type: MetaSourceType): Promise<string>;
5451
5452    /**
5453     * Checks whether the device supports the hardware digital watermark. This API uses a promise to return the result.
5454     *
5455     * This API can be called after the prepare(), start(), or paused() event is triggered.
5456     * @returns { Promise<boolean> } Promise used to return the check result. The value **true** means that
5457     * the device supports the hardware digital watermark, and **false** means the opposite.
5458     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5459     * @systemapi
5460     * @since 13
5461     * @example
5462     * import { BusinessError } from '@kit.BasicServicesKit';
5463     *
5464     * avRecorder.isWatermarkSupported().then((isWatermarkSupported: boolean) => {
5465     *   console.info(`Succeeded in get, isWatermarkSupported: ${isWatermarkSupported}`);
5466     * }).catch((error: BusinessError) => {
5467     *   console.error(`Failed to get and catch error is ${error.message}`);
5468     * });
5469     */
5470    isWatermarkSupported(): Promise<boolean>;
5471    /**
5472     * Sets a watermark for the AVRecorder. This API uses a promise to return the result.
5473     *
5474     * This API can be called only after the prepare() event is triggered and before
5475     * the start() event is triggered.
5476     * @param { image.PixelMap } watermark : Watermark image.
5477     * @param { WatermarkConfig } config : Configures of the watermark.
5478     * @returns { Promise<void> } Promise that returns no value.
5479     * @throws { BusinessError } 401 - The parameter check failed.
5480     * @throws { BusinessError } 801 - Capability not supported.
5481     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5482     * @systemapi
5483     * @since 13
5484     * @example
5485     * import { BusinessError } from '@kit.BasicServicesKit';
5486     * import { image } from '@kit.ImageKit';
5487     *
5488     * let watermark: image.PixelMap|undefined = undefined; // need data.
5489     * let watermarkConfig: media.WatermarkConfig = { top: 100, left: 100 }
5490     *
5491     * avRecorder.setWatermark(watermark, watermarkConfig).then(() => {
5492     *   console.info('Succeeded in setWatermark');
5493     * }).catch((error: BusinessError) => {
5494     *   console.error(`Failed to setWatermark and catch error is ${error.message}`);
5495     * });
5496     */
5497    setWatermark(watermark: image.PixelMap, config: WatermarkConfig): Promise<void>
5498
5499    /**
5500     * Sets custom metadata for the recording file of AVRecorder.
5501     *
5502     * This API can be called only after the prepare() event is successfully triggered and
5503     * before the stop() API is called.
5504     * Can be called after start, before stop.
5505     * @param { Record<string, string> } metadata - Tag and value of the metadata in key-value pairs.
5506     * <br>- The first string is the tag.<br>- The second string is the value.
5507     * @throws { BusinessError } 202 - Not System App.
5508     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5509     * @systemapi
5510     * @since 19
5511     * @example
5512     * import { BusinessError } from '@kit.BasicServicesKit';
5513     *
5514     * let meta : Record<string, string> = {
5515     *    'com.openharmony.userdefine':'10',
5516     *    'com.openharmony.userdefine2':'20'
5517     * };
5518     *
5519     * avRecorder.setMetadata(meta);
5520     */
5521    setMetadata(metadata: Record<string, string>): void;
5522
5523    /**
5524     * Updates the video rotation angle. This API uses a promise to return the result.
5525     *
5526     * This API can be called only after the prepare() event is triggered and before the start() API is called.
5527     * @param { number } rotation - Rotation angle, which can only be 0, 90, 180, or 270 degrees.
5528     * @returns { Promise<void> } A Promise instance used to return when the function is finished.
5529     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5530     * 2. Incorrect parameter types. 3.Parameter verification failed.
5531     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5532     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5533     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5534     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5535     * @since 12
5536     * @example
5537     * import { BusinessError } from '@kit.BasicServicesKit';
5538     *
5539     * let rotation = 90
5540     *
5541     * avRecorder.updateRotation(rotation).then(() => {
5542     *   console.info('Succeeded in updateRotation');
5543     * }).catch((err: BusinessError) => {
5544     *   console.error('Failed to updateRotation and catch error is ' + err.message);
5545     * });
5546     */
5547    updateRotation(rotation: number): Promise<void>;
5548
5549    /**
5550     * Set if recorder want to be muted instead of interrupted. only available before prepare state
5551     * @param { boolean } muteWhenInterrupted - use {@code true} if application want its stream to be muted
5552     *     instead of interrupted.
5553     * @returns { Promise<void> } A Promise instance used to return when the function is finished.
5554     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5555     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5556     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5557     * @since 20
5558     */
5559    setWillMuteWhenInterrupted(muteWhenInterrupted: boolean): Promise<void>;
5560
5561    /**
5562     * Start AVRecorder, it will to started state.
5563     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
5564     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5565     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5566     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5567     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5568     * @since 9
5569     */
5570    /**
5571     * Starts recording. This API uses an asynchronous callback to return the result.
5572     *
5573     * For audio-only recording, this API can be called only after the prepare() API is called.
5574     * For video-only recording, this API can be called only after the getInputSurface() API is called.
5575     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5576     * **err** is **undefined**; otherwise, **err** is an error object.
5577     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5578     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5579     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5580     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5581     * @crossplatform
5582     * @since 12
5583     * @example
5584     * import { BusinessError } from '@kit.BasicServicesKit';
5585     *
5586     * avRecorder.start((err: BusinessError) => {
5587     *   if (err) {
5588     *     console.error('Failed to start AVRecorder and error is ' + err.message);
5589     *   } else {
5590     *     console.info('Succeeded in starting AVRecorder');
5591     *   }
5592     * });
5593     */
5594    start(callback: AsyncCallback<void>): void;
5595
5596    /**
5597     * Start AVRecorder, it will to started state.
5598     * @returns { Promise<void> } A Promise instance used to return when start completed.
5599     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5600     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5601     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5602     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5603     * @since 9
5604     */
5605    /**
5606     * Starts recording. This API uses a promise to return the result.
5607     *
5608     * For audio-only recording, this API can be called only after the prepare() API is called.
5609     * For video-only recording, this API can be called only after the getInputSurface() API is called.
5610     * @returns { Promise<void> } Promise that returns no value.
5611     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5612     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5613     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5614     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5615     * @crossplatform
5616     * @atomicservice
5617     * @since 12
5618     * @example
5619     * import { BusinessError } from '@kit.BasicServicesKit';
5620     *
5621     * avRecorder.start().then(() => {
5622     *   console.info('Succeeded in starting AVRecorder');
5623     * }).catch((err: BusinessError) => {
5624     *   console.error('Failed to start AVRecorder and catch error is ' + err.message);
5625     * });
5626     */
5627    start(): Promise<void>;
5628
5629    /**
5630     * Start AVRecorder, it will to paused state.
5631     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
5632     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5633     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5634     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5635     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5636     * @since 9
5637     */
5638    /**
5639     * Pauses recording. This API uses an asynchronous callback to return the result.
5640     *
5641     * This API can be called only after the start() API is called. You can call resume() to resume recording.
5642     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5643     * **err** is **undefined**; otherwise, **err** is an error object.
5644     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5645     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5646     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5647     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5648     * @crossplatform
5649     * @since 12
5650     * @example
5651     * import { BusinessError } from '@kit.BasicServicesKit';
5652     *
5653     * avRecorder.pause((err: BusinessError) => {
5654     *   if (err) {
5655     *     console.error('Failed to pause AVRecorder and error is ' + err.message);
5656     *   } else {
5657     *     console.info('Succeeded in pausing');
5658     *   }
5659     * });
5660     */
5661    pause(callback: AsyncCallback<void>): void;
5662
5663    /**
5664     * Start AVRecorder, it will to paused state.
5665     * @returns { Promise<void> } A Promise instance used to return when pause completed.
5666     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5667     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5668     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5669     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5670     * @since 9
5671     */
5672    /**
5673     * Pauses recording. This API uses a promise to return the result.
5674     *
5675     * This API can be called only after the start()API is called. You can call resume() to resume recording.
5676     * @returns { Promise<void> } Promise that returns no value.
5677     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5678     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5679     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5680     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5681     * @crossplatform
5682     * @atomicservice
5683     * @since 12
5684     * @example
5685     * import { BusinessError } from '@kit.BasicServicesKit';
5686     *
5687     * avRecorder.pause().then(() => {
5688     *   console.info('Succeeded in pausing');
5689     * }).catch((err: BusinessError) => {
5690     *   console.error('Failed to pause AVRecorder and catch error is ' + err.message);
5691     * });
5692     */
5693    pause(): Promise<void>;
5694
5695    /**
5696     * Resume AVRecorder, it will to started state.
5697     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
5698     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5699     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5700     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5701     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5702     * @since 9
5703     */
5704    /**
5705     * Resumes recording. This API uses an asynchronous callback to return the result.
5706     *
5707     * This API can be called only after the pause() API is called.
5708     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5709     * **err** is **undefined**; otherwise, **err** is an error object.
5710     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5711     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5712     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5713     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5714     * @crossplatform
5715     * @since 12
5716     * @example
5717     * import { BusinessError } from '@kit.BasicServicesKit';
5718     *
5719     * avRecorder.resume((err: BusinessError) => {
5720     *   if (err) {
5721     *     console.error('Failed to resume AVRecorder and error is ' + err.message);
5722     *   } else {
5723     *     console.info('Succeeded in resuming AVRecorder');
5724     *   }
5725     * });
5726     */
5727    resume(callback: AsyncCallback<void>): void;
5728
5729    /**
5730     * Resume AVRecorder, it will to started state.
5731     * @returns { Promise<void> } A Promise instance used to return when resume completed.
5732     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5733     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5734     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5735     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5736     * @since 9
5737     */
5738    /**
5739     * Resumes recording. This API uses a promise to return the result.
5740     *
5741     * This API can be called only after the pause() API is called.
5742     * @returns { Promise<void> } Promise that returns no value.
5743     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5744     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5745     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5746     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5747     * @crossplatform
5748     * @atomicservice
5749     * @since 12
5750     * @example
5751     * import { BusinessError } from '@kit.BasicServicesKit';
5752     *
5753     * avRecorder.resume().then(() => {
5754     *   console.info('Succeeded in resuming AVRecorder');
5755     * }).catch((err: BusinessError) => {
5756     *   console.error('Failed to resume  AVRecorder failed and catch error is ' + err.message);
5757     * });
5758     */
5759    resume(): Promise<void>;
5760
5761    /**
5762     * Stop AVRecorder, it will to stopped state.
5763     * @param { AsyncCallback<void> } callback - A callback instance used to return when stop completed.
5764     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5765     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5766     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5767     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5768     * @since 9
5769     */
5770    /**
5771     * Stops recording. This API uses an asynchronous callback to return the result.
5772     *
5773     * This API can be called only after the start() or pause() API is called.
5774     *
5775     * For audio-only recording, you can call prepare() again for re-recording.
5776     * For video-only recording or audio and video recording, you can call prepare() and getInputSurface() again for re-recording.
5777     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5778     * **err** is **undefined**; otherwise, **err** is an error object.
5779     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
5780     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5781     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5782     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5783     * @crossplatform
5784     * @since 12
5785     * @example
5786     * import { BusinessError } from '@kit.BasicServicesKit';
5787     *
5788     * avRecorder.stop((err: BusinessError) => {
5789     *   if (err) {
5790     *     console.error('Failed to stop AVRecorder and error is ' + err.message);
5791     *   } else {
5792     *     console.info('Succeeded in stopping AVRecorder');
5793     *   }
5794     * });
5795     */
5796    stop(callback: AsyncCallback<void>): void;
5797
5798    /**
5799     * Stop AVRecorder, it will to stopped state.
5800     * @returns { Promise<void> } A Promise instance used to return when stop completed.
5801     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5802     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5803     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5804     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5805     * @since 9
5806     */
5807    /**
5808     * Stops recording. This API uses a promise to return the result.
5809     *
5810     * This API can be called only after the start() or pause() API is called.
5811     *
5812     * For audio-only recording, you can call prepare() again for re-recording.
5813     * For video-only recording or audio and video recording,
5814     * you can call prepare() getInputSurface() again for re-recording.
5815     * @returns { Promise<void> } Promise that returns no value.
5816     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
5817     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5818     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5819     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5820     * @crossplatform
5821     * @atomicservice
5822     * @since 12
5823     * @example
5824     * import { BusinessError } from '@kit.BasicServicesKit';
5825     *
5826     * avRecorder.stop().then(() => {
5827     *   console.info('Succeeded in stopping AVRecorder');
5828     * }).catch((err: BusinessError) => {
5829     *   console.error('Failed to stop AVRecorder and catch error is ' + err.message);
5830     * });
5831     */
5832    stop(): Promise<void>;
5833
5834    /**
5835     * Reset AVRecorder, it will to idle state.
5836     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
5837     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5838     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5839     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5840     * @since 9
5841     */
5842    /**
5843     * Resets audio and video recording. This API uses an asynchronous callback to return the result.
5844     *
5845     * For audio-only recording, you can call prepare() again for re-recording.
5846     * For video-only recording or audio and video recording,
5847     * you can call prepare() and getInputSurface() again for re-recording.
5848     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5849     * **err** is **undefined**; otherwise, **err** is an error object.
5850     * @throws { BusinessError } 5400103 - IO error. Return by callback.
5851     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5852     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5853     * @crossplatform
5854     * @since 12
5855     * @example
5856     * import { BusinessError } from '@kit.BasicServicesKit';
5857     *
5858     * avRecorder.reset((err: BusinessError) => {
5859     *   if (err) {
5860     *     console.error('Failed to reset AVRecorder and error is ' + err.message);
5861     *   } else {
5862     *     console.info('Succeeded in resetting AVRecorder');
5863     *   }
5864     * });
5865     */
5866    reset(callback: AsyncCallback<void>): void;
5867
5868    /**
5869     * Reset AVRecorder, it will to idle state.
5870     * @returns { Promise<void> } A Promise instance used to return when reset completed.
5871     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5872     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5873     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5874     * @since 9
5875     */
5876    /**
5877     * Resets audio and video recording. This API uses a promise to return the result.
5878     *
5879     * For audio-only recording, you can call prepare() again for re-recording.
5880     * For video-only recording or audio and video recording,
5881     * you can call prepare() and getInputSurface() again for re-recording.
5882     * @returns { Promise<void> } Promise that returns no value.
5883     * @throws { BusinessError } 5400103 - IO error. Return by promise.
5884     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5885     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5886     * @crossplatform
5887     * @since 12
5888     * @example
5889     * import { BusinessError } from '@kit.BasicServicesKit';
5890     *
5891     * avRecorder.reset().then(() => {
5892     *   console.info('Succeeded in resetting AVRecorder');
5893     * }).catch((err: BusinessError) => {
5894     *   console.error('Failed to reset and catch error is ' + err.message);
5895     * });
5896     */
5897    reset(): Promise<void>;
5898
5899    /**
5900     * Releases resources used for AVRecorder, it will to released state.
5901     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
5902     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5903     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5904     * @since 9
5905     */
5906    /**
5907     * Releases the audio and video recording resources. This API uses an asynchronous callback to return the result.
5908     *
5909     * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance.
5910     * @param { AsyncCallback<void> } callback - Callback used to return the result. If the operation is successful,
5911     * **err** is **undefined**; otherwise, **err** is an error object.
5912     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5913     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5914     * @crossplatform
5915     * @since 12
5916     * @example
5917     * import { BusinessError } from '@kit.BasicServicesKit';
5918     *
5919     * avRecorder.release((err: BusinessError) => {
5920     *   if (err) {
5921     *     console.error('Failed to release AVRecorder and error is ' + err.message);
5922     *   } else {
5923     *     console.info('Succeeded in releasing AVRecorder');
5924     *   }
5925     * });
5926     */
5927    release(callback: AsyncCallback<void>): void;
5928
5929    /**
5930     * Releases resources used for AVRecorder, it will to released state.
5931     * @returns { Promise<void> } A Promise instance used to return when release completed.
5932     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5933     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5934     * @since 9
5935     */
5936    /**
5937     * Releases the audio and video recording resources. This API uses a promise to return the result.
5938     *
5939     * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance.
5940     * @returns { Promise<void> } Promise that returns no value.
5941     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5942     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5943     * @crossplatform
5944     * @atomicservice
5945     * @since 12
5946     * @example
5947     * import { BusinessError } from '@kit.BasicServicesKit';
5948     *
5949     * avRecorder.release().then(() => {
5950     *   console.info('Succeeded in releasing AVRecorder');
5951     * }).catch((err: BusinessError) => {
5952     *   console.error('Failed to release AVRecorder and catch error is ' + err.message);
5953     * });
5954     */
5955    release(): Promise<void>;
5956
5957    /**
5958     * Obtains the information about the current audio capturer.
5959     * This API uses an asynchronous callback to return the result.
5960     *
5961     * This API can be called only after the **prepare()** API is called.
5962     * If this API is called after **stop()** is successfully called, an error is reported.
5963     * @param { AsyncCallback<audio.AudioCapturerChangeInfo> } callback - Callback used to return the result.
5964     * If the operation is successful, **err** is **undefined** and **data** is the
5965     * **audio.AudioCapturerChangeInfo** object obtained; otherwise, **err** is an error object.
5966     * @throws { BusinessError } 5400102 - Operation not allowed.
5967     * @throws { BusinessError } 5400103 - I/O error.
5968     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5969     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5970     * @since 11
5971     * @example
5972     * import { audio } from '@kit.AudioKit';
5973     *
5974     * let currentCapturerInfo: audio.AudioCapturerChangeInfo;
5975     *
5976     * avRecorder.getCurrentAudioCapturerInfo((err: BusinessError, capturerInfo: audio.AudioCapturerChangeInfo) => {
5977     *   if (err) {
5978     *     console.error('Failed to get CurrentAudioCapturerInfo and error is ' + err.message);
5979     *   } else {
5980     *     console.info('Succeeded in getting CurrentAudioCapturerInfo');
5981     *     currentCapturerInfo = capturerInfo;
5982     *   }
5983     * });
5984     */
5985    getCurrentAudioCapturerInfo(callback: AsyncCallback<audio.AudioCapturerChangeInfo>): void;
5986
5987    /**
5988     * Obtains the information about the current audio capturer. This API uses a promise to return the result.
5989     *
5990     * This API can be called only after the **prepare()** API is called.
5991     * If this API is called after **stop()** is successfully called, an error is reported.
5992     * @returns { Promise<audio.AudioCapturerChangeInfo> } Promise used to return the audio capturer information.
5993     * @throws { BusinessError } 5400102 - Operation not allowed.
5994     * @throws { BusinessError } 5400103 - I/O error.
5995     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5996     * @syscap SystemCapability.Multimedia.Media.AVRecorder
5997     * @since 11
5998     * @example
5999     * import { audio } from '@kit.AudioKit';
6000     *
6001     * let currentCapturerInfo: audio.AudioCapturerChangeInfo;
6002     *
6003     * avRecorder.getCurrentAudioCapturerInfo().then((capturerInfo: audio.AudioCapturerChangeInfo) => {
6004     *   console.info('Succeeded in getting CurrentAudioCapturerInfo');
6005     *   currentCapturerInfo = capturerInfo;
6006     * }).catch((err: BusinessError) => {
6007     *   console.error('Failed to get CurrentAudioCapturerInfo and catch error is ' + err.message);
6008     * });
6009     */
6010    getCurrentAudioCapturerInfo(): Promise<audio.AudioCapturerChangeInfo>;
6011
6012    /**
6013     * Obtains the maximum amplitude of the current audio capturer.
6014     * This API uses an asynchronous callback to return the result.
6015     *
6016     * This API can be called only after the **prepare()** API is called.
6017     * If this API is called after **stop()** is successfully called, an error is reported.
6018     *
6019     * The return value is the maximum amplitude within the duration from the time the maximum amplitude
6020     * is obtained last time to the current time. For example, if you have obtained the maximum amplitude at 1s
6021     * and you call this API again at 2s, then the return value is the maximum amplitude
6022     * within the duration from 1s to 2s.
6023     * @param { AsyncCallback<number> } callback - Callback used to return the result. If the operation is successful,
6024     * **err** is **undefined** and **data** is the maximum amplitude obtained; otherwise, **err** is an error object.
6025     * @throws { BusinessError } 5400102 - Operation not allowed.
6026     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6027     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6028     * @since 11
6029     * @example
6030     * let maxAmplitude: number;
6031     *
6032     * avRecorder.getAudioCapturerMaxAmplitude((err: BusinessError, amplitude: number) => {
6033     *   if (err) {
6034     *     console.error('Failed to get AudioCapturerMaxAmplitude and error is ' + err.message);
6035     *   } else {
6036     *     console.info('Succeeded in getting AudioCapturerMaxAmplitude');
6037     *     maxAmplitude = amplitude;
6038     *   }
6039     * });
6040     */
6041    getAudioCapturerMaxAmplitude(callback: AsyncCallback<number>): void;
6042
6043    /**
6044     * Obtains the maximum amplitude of the current audio capturer. This API uses a promise to return the result.
6045     *
6046     * This API can be called only after the **prepare()** API is called.
6047     * If this API is called after **stop()** is successfully called, an error is reported.
6048     *
6049     * The return value is the maximum amplitude within the duration from the time the maximum amplitude
6050     * is obtained last time to the current time. For example, if you have obtained the maximum amplitude
6051     * at 1s and you call this API again at 2s, then the return value is the maximum amplitude
6052     * within the duration from 1s to 2s.
6053     * @returns { Promise<number> } Promise used to return the maximum amplitude obtained.
6054     * @throws { BusinessError } 5400102 - Operation not allowed.
6055     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6056     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6057     * @since 11
6058     * @example
6059     * let maxAmplitude: number;
6060     *
6061     * avRecorder.getAudioCapturerMaxAmplitude().then((amplitude: number) => {
6062     *   console.info('Succeeded in getting AudioCapturerMaxAmplitude');
6063     *   maxAmplitude = amplitude;
6064     * }).catch((err: BusinessError) => {
6065     *   console.error('Failed to get AudioCapturerMaxAmplitude and catch error is ' + err.message);
6066     * });
6067     */
6068    getAudioCapturerMaxAmplitude(): Promise<number>;
6069
6070    /**
6071     * Obtains available encoders. This API uses an asynchronous callback to return the result.
6072     * @param { AsyncCallback<Array<EncoderInfo>> } callback - Callback used to return the result.
6073     * If the operation is successful, **err** is **undefined** and **data** is the available encoders obtained; otherwise, **err** is an error object.
6074     * @throws { BusinessError } 5400102 - Operation not allowed.
6075     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6076     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6077     * @since 11
6078     * @example
6079     * let encoderInfo: media.EncoderInfo;
6080     *
6081     * avRecorder.getAvailableEncoder((err: BusinessError, info: media.EncoderInfo[]) => {
6082     *   if (err) {
6083     *     console.error('Failed to get AvailableEncoder and error is ' + err.message);
6084     *   } else {
6085     *     console.info('Succeeded in getting AvailableEncoder');
6086     *     encoderInfo = info[0];
6087     *   }
6088     * });
6089     */
6090    getAvailableEncoder(callback: AsyncCallback<Array<EncoderInfo>>): void;
6091
6092    /**
6093     * Obtains available encoders. This API uses an asynchronous callback to return the result.
6094     * @returns { Promise<Array<EncoderInfo>> } Promise used to return the information about the available encoders.
6095     * @throws { BusinessError } 5400102 - Operation not allowed.
6096     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6097     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6098     * @since 11
6099     * @example
6100     * let encoderInfo: media.EncoderInfo;
6101     *
6102     * avRecorder.getAvailableEncoder().then((info: media.EncoderInfo[]) => {
6103     *   console.info('Succeeded in getting AvailableEncoder');
6104     *   encoderInfo = info[0];
6105     * }).catch((err: BusinessError) => {
6106     *   console.error('Failed to get AvailableEncoder and catch error is ' + err.message);
6107     * });
6108     */
6109    getAvailableEncoder(): Promise<Array<EncoderInfo>>;
6110
6111    /**
6112     * Recorder state.
6113     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6114     * @since 9
6115     */
6116    /**
6117     * Enumerates the AVRecorder states. You can obtain the state through the **state** attribute.
6118     * @type { AVRecorderState }
6119     * @readonly
6120     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6121     * @crossplatform
6122     * @atomicservice
6123     * @since 12
6124     */
6125    readonly state: AVRecorderState;
6126
6127    /**
6128     * Subscribes to audio capturer configuration changes. Any configuration change triggers the callback that
6129     * returns the entire configuration information.
6130     *
6131     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
6132     * @param { 'audioCapturerChange' } type - Event type, which is **'audioCapturerChange'** in this case.
6133     * @param { Callback<audio.AudioCapturerChangeInfo> } callback - Callback used to return the entire configuration
6134     * information about the audio capturer.
6135     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6136     * 2. Incorrect parameter types. 3.Parameter verification failed.
6137     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6138     * @since 11
6139     */
6140    on(type: 'audioCapturerChange', callback: Callback<audio.AudioCapturerChangeInfo>): void;
6141
6142    /**
6143     * Subscribes to media asset callback events. When FileGenerationMode is used during media file creation,
6144     * the PhotoAsset object is called back to the application after the stop operation is complete.
6145     *
6146     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
6147     * @param { 'photoAssetAvailable' } type - Event type, which is **'photoAssetAvailable'** in this case.
6148     * The event is triggered when a photo asset is available.
6149     * @param { Callback<photoAccessHelper.PhotoAsset> } callback - Callback used to return the
6150     * **PhotoAsset** object corresponding to the resource file created by the system.
6151     * @throws { BusinessError } 5400103 - IO error. Return by callback.
6152     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6153     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6154     * @since 12
6155     */
6156    on(type: 'photoAssetAvailable', callback: Callback<photoAccessHelper.PhotoAsset>): void;
6157    /**
6158     * Listens for recording stateChange events.
6159     * @param { 'stateChange' } type - Type of the recording event to listen for.
6160     * @param { function } callback - Callback used to listen for the recorder stateChange event.
6161     * @throws { BusinessError } 5400103 - IO error. Return by callback.
6162     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6163     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6164     * @since 9
6165     */
6166    /**
6167     * Subscribes to AVRecorder state changes. An application can subscribe to only one AVRecorder state change event.
6168     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
6169     * @param { 'stateChange' } type - Event type, which is **'stateChange'** in this case.
6170     * This event can be triggered by both user operations and the system.
6171     * @param { OnAVRecorderStateChangeHandler } callback - Callback invoked when the event is triggered.
6172     * @throws { BusinessError } 5400103 - IO error. Return by callback.
6173     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6174     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6175     * @crossplatform
6176     * @atomicservice
6177     * @since 12
6178     */
6179    on(type: 'stateChange', callback: OnAVRecorderStateChangeHandler): void;
6180
6181    /**
6182     * Listens for recording error events.
6183     * @param { 'error' } type - Type of the recording error event to listen for.
6184     * @param { ErrorCallback } callback - Callback used to listen for the recorder error event.
6185     * @throws { BusinessError } 201 - Permission denied.
6186     * @throws { BusinessError } 401 - The parameter check failed.
6187     * @throws { BusinessError } 801 - Capability not supported.
6188     * @throws { BusinessError } 5400101 - No memory.
6189     * @throws { BusinessError } 5400102 - Operation not allowed.
6190     * @throws { BusinessError } 5400103 - I/O error.
6191     * @throws { BusinessError } 5400104 - Time out.
6192     * @throws { BusinessError } 5400105 - Service died.
6193     * @throws { BusinessError } 5400106 - Unsupported format.
6194     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6195     * @since 9
6196     */
6197    /**
6198     * Listens for recording error events.
6199     * @param { 'error' } type - Type of the recording error event to listen for.
6200     * @param { ErrorCallback } callback - Callback used to listen for the recorder error event.
6201     * @throws { BusinessError } 201 - Permission denied.
6202     * @throws { BusinessError } 401 - The parameter check failed.
6203     * @throws { BusinessError } 801 - Capability not supported.
6204     * @throws { BusinessError } 5400101 - No memory.
6205     * @throws { BusinessError } 5400102 - Operation not allowed.
6206     * @throws { BusinessError } 5400103 - I/O error.
6207     * @throws { BusinessError } 5400104 - Time out.
6208     * @throws { BusinessError } 5400105 - Service died.
6209     * @throws { BusinessError } 5400106 - Unsupported format.
6210     * @throws { BusinessError } 5400107 - Audio interrupted.
6211     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6212     * @since 11
6213     */
6214    /**
6215     * Subscribes to AVRecorder errors. This event is used only for error prompt and does not require the user to
6216     * stop recording control. If the AVRecorderState is also switched to error, call reset() or release()
6217     * to exit the recording.
6218     *
6219     * An application can subscribe to only one AVRecorder error event.
6220     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
6221     * @param { 'error' } type - Event type, which is **'error'** in this case.
6222     * This event is triggered when an error occurs during recording.
6223     * @param { ErrorCallback } callback - Callback invoked when the event is triggered.
6224     * @throws { BusinessError } 201 - Permission denied.
6225     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6226     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
6227     * @throws { BusinessError } 801 - Capability not supported.
6228     * @throws { BusinessError } 5400101 - No memory.
6229     * @throws { BusinessError } 5400102 - Operation not allowed.
6230     * @throws { BusinessError } 5400103 - I/O error.
6231     * @throws { BusinessError } 5400104 - Time out.
6232     * @throws { BusinessError } 5400105 - Service died.
6233     * @throws { BusinessError } 5400106 - Unsupported format.
6234     * @throws { BusinessError } 5400107 - Audio interrupted.
6235     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6236     * @crossplatform
6237     * @atomicservice
6238     * @since 12
6239     */
6240    on(type: 'error', callback: ErrorCallback): void;
6241
6242    /**
6243     * Cancel Listens for recording stateChange events.
6244     * @param { 'stateChange' } type - Type of the recording stateChange event to listen for.
6245     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6246     * @since 9
6247     */
6248    /**
6249     * Unsubscribes from AVRecorder state changes.
6250     * @param { 'stateChange' } type - Event type, which is **'stateChange'** in this case.
6251     * This event can be triggered by both user operations and the system.
6252     * @param { OnAVRecorderStateChangeHandler } callback - Callback invoked when the event is triggered.
6253     * This parameter is supported since API version 12.
6254     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6255     * @crossplatform
6256     * @atomicservice
6257     * @since 12
6258     */
6259    off(type: 'stateChange', callback?: OnAVRecorderStateChangeHandler): void;
6260
6261    /**
6262     * Cancel Listens for recording error events.
6263     * @param { 'error' } type - Type of the recording error event to listen for.
6264     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6265     * @since 9
6266     */
6267    /**
6268     * Unsubscribes from AVRecorder errors. After the unsubscription,
6269     * your application can no longer receive AVRecorder errors.
6270     * @param { 'error' } type - Event type, which is **'error'** in this case.<br>This event is triggered when
6271     * an error occurs during recording.
6272     * @param { ErrorCallback } callback - Callback invoked when the event is triggered.
6273     * This parameter is supported since API version 12.
6274     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6275     * @crossplatform
6276     * @atomicservice
6277     * @since 12
6278     */
6279    off(type: 'error', callback?: ErrorCallback): void;
6280
6281    /**
6282     * Cancel Listens for recording audioCapturerChange events.
6283     * @param { 'audioCapturerChange' } type - Type of the audioCapturerChange event to listen for.
6284     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6285     * @since 11
6286     */
6287    /**
6288     * Subscribes to audio capturer configuration changes.
6289     * @param { 'audioCapturerChange' } type - Event type, which is **'audioCapturerChange'** in this case.
6290     * @param { Callback<audio.AudioCapturerChangeInfo> } callback - Callback used to return the entire configuration
6291     * information about the audio capturer.
6292     * This parameter is supported since API version 12.
6293     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6294     * @since 12
6295     */
6296    off(type: 'audioCapturerChange', callback?: Callback<audio.AudioCapturerChangeInfo>): void;
6297
6298    /**
6299     * Unsubscribes from media asset callback events.
6300     * @param { 'photoAssetAvailable' } type - Event type, which is **'photoAssetAvailable'** in this case.
6301     * @param { Callback<photoAccessHelper.PhotoAsset> } callback - Callback used to return the **PhotoAsset** object
6302     * corresponding to the resource file created by the system.
6303     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6304     * @since 12
6305     */
6306    off(type: 'photoAssetAvailable', callback?: Callback<photoAccessHelper.PhotoAsset>): void;
6307  }
6308
6309  /**
6310   * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace.
6311   *
6312   * @enum { number }
6313   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6314   * @since 6
6315   * @deprecated since 8
6316   * @useinstead ohos.multimedia.media/media.CodecMimeType
6317   */
6318  enum AudioEncoder {
6319    /**
6320     * Default audio encoding format, which is AMR-NB.
6321     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6322     * @since 6
6323     * @deprecated since 8
6324     */
6325    DEFAULT = 0,
6326
6327    /**
6328     * Indicates the AMR-NB audio encoding format.
6329     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6330     * @since 6
6331     * @deprecated since 8
6332     * @useinstead ohos.multimedia.media/media.CodecMimeType#AUDIO_AMR_NB
6333     */
6334    AMR_NB = 1,
6335
6336    /**
6337     * Indicates the AMR-WB audio encoding format.
6338     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6339     * @since 6
6340     * @deprecated since 8
6341     * @useinstead ohos.multimedia.media/media.CodecMimeType#AUDIO_AMR_WB
6342     */
6343    AMR_WB = 2,
6344
6345    /**
6346     * Advanced Audio Coding Low Complexity (AAC-LC).
6347     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6348     * @since 6
6349     * @deprecated since 8
6350     * @useinstead ohos.multimedia.media/media.CodecMimeType#AUDIO_AAC
6351     */
6352    AAC_LC = 3,
6353
6354    /**
6355     * High-Efficiency Advanced Audio Coding (HE-AAC).
6356     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6357     * @since 6
6358     * @deprecated since 8
6359     * @useinstead ohos.multimedia.media/media.CodecMimeType#AUDIO_AAC
6360     */
6361    HE_AAC = 4
6362  }
6363
6364  /**
6365   * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to replace.
6366   *
6367   * @enum { number }
6368   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6369   * @since 6
6370   * @deprecated since 8
6371   * @useinstead ohos.multimedia.media/media.ContainerFormatType
6372   */
6373  enum AudioOutputFormat {
6374    /**
6375     * Default audio output format, which is Moving Pictures Expert Group 4 (MPEG-4).
6376     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6377     * @since 6
6378     * @deprecated since 8
6379     */
6380    DEFAULT = 0,
6381
6382    /**
6383     * Indicates the Moving Picture Experts Group-4 (MPEG4) media format.
6384     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6385     * @since 6
6386     * @deprecated since 8
6387     * @useinstead ohos.multimedia.media/media.ContainerFormatType#CFT_MPEG_4
6388     */
6389    MPEG_4 = 2,
6390
6391    /**
6392     * Indicates the Adaptive Multi-Rate Narrowband (AMR-NB) media format.
6393     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6394     * @since 6
6395     * @deprecated since 8
6396     * @useinstead ohos.multimedia.media/media.ContainerFormatType#CFT_AMR
6397     */
6398    AMR_NB = 3,
6399
6400    /**
6401     * Indicates the Adaptive Multi-Rate Wideband (AMR-WB) media format.
6402     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6403     * @since 6
6404     * @deprecated since 8
6405     * @useinstead ohos.multimedia.media/media.ContainerFormatType#CFT_AMR
6406     */
6407    AMR_WB = 4,
6408
6409    /**
6410     * Audio Data Transport Stream (ADTS), a transmission stream format of Advanced Audio Coding (AAC) audio.
6411     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6412     * @since 6
6413     * @deprecated since 8
6414     * @useinstead ohos.multimedia.media/media.ContainerFormatType#CFT_AAC
6415     */
6416    AAC_ADTS = 6
6417  }
6418
6419  /**
6420   * Provides the geographical location definitions for media resources.
6421   *
6422   * @typedef Location
6423   * @syscap SystemCapability.Multimedia.Media.Core
6424   * @since 6
6425   */
6426  /**
6427   * Provides the geographical location definitions for media resources.
6428   *
6429   * @typedef Location
6430   * @syscap SystemCapability.Multimedia.Media.Core
6431   * @crossplatform
6432   * @since 12
6433   */
6434  interface Location {
6435    /**
6436     * Latitude.
6437     * @syscap SystemCapability.Multimedia.Media.Core
6438     * @since 6
6439     */
6440    /**
6441     * Latitude.
6442     * @type { number }
6443     * @syscap SystemCapability.Multimedia.Media.Core
6444     * @crossplatform
6445     * @since 12
6446     */
6447    latitude: number;
6448
6449    /**
6450     * Longitude.
6451     * @syscap SystemCapability.Multimedia.Media.Core
6452     * @since 6
6453     */
6454    /**
6455     * Longitude.
6456     * @type { number }
6457     * @syscap SystemCapability.Multimedia.Media.Core
6458     * @crossplatform
6459     * @since 12
6460     */
6461    longitude: number;
6462  }
6463  /**
6464   * Set configures of a watermark to AVRecorder. The position starts at top left corner.
6465   *
6466   * @typedef WatermarkConfig
6467   * @syscap SystemCapability.Multimedia.Media.Core
6468   * @systemapi
6469   * @since 13
6470   */
6471  interface WatermarkConfig {
6472    /**
6473     * Offset of the watermark to the top line of pixel.
6474     * @type { number }
6475     * @syscap SystemCapability.Multimedia.Media.Core
6476     * @systemapi
6477     * @since 13
6478     */
6479    top: number;
6480    /**
6481     * Offset of the watermark to the left line of pixel.
6482     * @type { number }
6483     * @syscap SystemCapability.Multimedia.Media.Core
6484     * @systemapi
6485     * @since 13
6486     */
6487    left: number;
6488  }
6489
6490  /**
6491   * Provides the audio recorder configuration definitions.
6492   *
6493   * @typedef AudioRecorderConfig
6494   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6495   * @since 6
6496   * @deprecated since 9
6497   * @useinstead ohos.multimedia.media/media.AVRecorderConfig
6498   */
6499  interface AudioRecorderConfig {
6500    /**
6501     * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8.
6502     * use "audioEncoderMime" instead.
6503     * @type { ?AudioEncoder }
6504     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6505     * @since 6
6506     * @deprecated since 8
6507     * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.audioEncoderMime
6508     */
6509    audioEncoder?: AudioEncoder;
6510
6511    /**
6512     * Audio encoding bit rate.
6513     * @type { ?number }
6514     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6515     * @since 6
6516     * @deprecated since 9
6517     * @useinstead ohos.multimedia.media/media.AVRecorderProfile#audioBitrate
6518     */
6519    audioEncodeBitRate?: number;
6520
6521    /**
6522     * Audio sampling rate.
6523     * @type { ?number }
6524     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6525     * @since 6
6526     * @deprecated since 9
6527     * @useinstead ohos.multimedia.media/media.AVRecorderProfile#audioSampleRate
6528     */
6529    audioSampleRate?: number;
6530
6531    /**
6532     * Number of audio channels.
6533     * @type { ?number }
6534     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6535     * @since 6
6536     * @deprecated since 9
6537     * @useinstead ohos.multimedia.media/media.AVRecorderProfile#audioChannels
6538     */
6539    numberOfChannels?: number;
6540
6541    /**
6542     * Audio output format. The default value is DEFAULT, it will be deprecated after API8.
6543     * it will be replaced with "fileFormat".
6544     * @type { ?AudioOutputFormat }
6545     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6546     * @since 6
6547     * @deprecated since 8
6548     * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.fileFormat
6549     */
6550    format?: AudioOutputFormat;
6551
6552    /**
6553     * Audio output uri.support two kind of uri now.
6554     * format like: scheme + "://" + "context".
6555     * file:  file://path
6556     * fd:    fd://fd
6557     * @type { string }
6558     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6559     * @since 6
6560     * @deprecated since 9
6561     * @useinstead ohos.multimedia.media/media.AVRecorderConfig#url
6562     */
6563    uri: string;
6564
6565    /**
6566     * Geographical location information.
6567     * @type { ?Location }
6568     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6569     * @since 6
6570     * @deprecated since 9
6571     * @useinstead ohos.multimedia.media/media.AVMetadata#location
6572     */
6573    location?: Location;
6574
6575    /**
6576     * audio encoding format MIME. it used to replace audioEncoder.
6577     * @type { ?CodecMimeType }
6578     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6579     * @since 8
6580     * @deprecated since 9
6581     * @useinstead ohos.multimedia.media/media.AVRecorderProfile#audioCodec
6582     */
6583    audioEncoderMime?: CodecMimeType;
6584    /**
6585     * output file format. see @ContainerFormatType , it used to replace "format".
6586     * @type { ?ContainerFormatType }
6587     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6588     * @since 8
6589     * @deprecated since 9
6590     * @useinstead ohos.multimedia.media/media.AVRecorderProfile#fileFormat
6591     */
6592    fileFormat?: ContainerFormatType;
6593  }
6594
6595  /**
6596   * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder()
6597   * to create an AudioRecorder instance.
6598   *
6599   * @typedef AudioRecorder
6600   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6601   * @since 6
6602   * @deprecated since 9
6603   * @useinstead ohos.multimedia.media/media.AVRecorder
6604   */
6605  interface AudioRecorder {
6606    /**
6607     * Prepares for recording.
6608     * @permission ohos.permission.MICROPHONE
6609     * @param { AudioRecorderConfig } config - Recording parameters.
6610     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6611     * @since 6
6612     * @deprecated since 9
6613     * @useinstead ohos.multimedia.media/media.AVRecorder#prepare
6614     */
6615    /**
6616     * Prepares for recording.
6617     * @permission ohos.permission.MICROPHONE
6618     * @param { AudioRecorderConfig } config - Recording parameters.
6619     * @throws { BusinessError } 201 - permission denied.
6620     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6621     * @since 12
6622     * @deprecated since 9
6623     * @useinstead ohos.multimedia.media/media.AVRecorder#prepare
6624     */
6625    prepare(config: AudioRecorderConfig): void;
6626
6627    /**
6628     * Starts audio recording.
6629     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6630     * @since 6
6631     * @deprecated since 9
6632     * @useinstead ohos.multimedia.media/media.AVRecorder#start
6633     */
6634    start(): void;
6635
6636    /**
6637     * Pauses audio recording.
6638     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6639     * @since 6
6640     * @deprecated since 9
6641     * @useinstead ohos.multimedia.media/media.AVRecorder#pause
6642     */
6643    pause(): void;
6644
6645    /**
6646     * Resumes audio recording.
6647     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6648     * @since 6
6649     * @deprecated since 9
6650     * @useinstead ohos.multimedia.media/media.AVRecorder#resume
6651     */
6652    resume(): void;
6653
6654    /**
6655     * Stops audio recording.
6656     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6657     * @since 6
6658     * @deprecated since 9
6659     * @useinstead ohos.multimedia.media/media.AVRecorder#stop
6660     */
6661    stop(): void;
6662
6663    /**
6664     * Releases resources used for audio recording.
6665     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6666     * @since 6
6667     * @deprecated since 9
6668     * @useinstead ohos.multimedia.media/media.AVRecorder#release
6669     */
6670    release(): void;
6671
6672    /**
6673     * Resets audio recording.
6674     * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset,
6675     * you must call prepare() to set the recording configurations for another recording.
6676     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6677     * @since 6
6678     * @deprecated since 9
6679     * @useinstead ohos.multimedia.media/media.AVRecorder#reset
6680     */
6681    reset(): void;
6682
6683    /**
6684     * Listens for audio recording events.
6685     * @param { 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset' } type - Type of the audio recording event to listen for.
6686     * @param { function } callback - Callback used to listen for the audio recording event.
6687     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6688     * @since 6
6689     * @deprecated since 9
6690     * @useinstead ohos.multimedia.media/media.AVRecorder#on
6691     */
6692    on(type: 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset', callback: () => void): void;
6693
6694    /**
6695     * Listens for audio recording error events.
6696     * @param { 'error' } type - Type of the audio recording error event to listen for.
6697     * @param { ErrorCallback } callback - Callback used to listen for the audio recording error event.
6698     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
6699     * @since 6
6700     * @deprecated since 9
6701     * @useinstead ohos.multimedia.media/media.AVRecorder#on
6702     */
6703    on(type: 'error', callback: ErrorCallback): void;
6704  }
6705
6706  /**
6707  * The maintenance of this interface has been stopped since version api 9. Please use AVRecorderState.
6708  * Describes video recorder states.
6709  *
6710  * @typedef { 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error' }
6711  * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6712  * @systemapi
6713  * @since 9
6714  */
6715  type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error';
6716
6717  /**
6718   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder.
6719   * Manages and record video. Before calling an VideoRecorder method, you must use createVideoRecorder()
6720   * to create an VideoRecorder instance.
6721   *
6722   * @typedef VideoRecorder
6723   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6724   * @systemapi
6725   * @since 9
6726   */
6727  interface VideoRecorder {
6728    /**
6729     * Prepares for recording.
6730     * @permission ohos.permission.MICROPHONE
6731     * @param { VideoRecorderConfig } config - Recording parameters.
6732     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
6733     * @throws { BusinessError } 201 - Permission denied. Return by callback.
6734     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6735     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
6736     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6737     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6738     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6739     * @systemapi
6740     * @since 9
6741     */
6742    /**
6743     * Prepares for recording.
6744     * @permission ohos.permission.MICROPHONE
6745     * @param { VideoRecorderConfig } config - Recording parameters.
6746     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
6747     * @throws { BusinessError } 201 - Permission denied. Return by callback.
6748     * @throws { BusinessError } 202 - Not System App.
6749     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6750     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
6751     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6752     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6753     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6754     * @systemapi
6755     * @since 12
6756     */
6757    prepare(config: VideoRecorderConfig, callback: AsyncCallback<void>): void;
6758    /**
6759     * Prepares for recording.
6760     * @permission ohos.permission.MICROPHONE
6761     * @param { VideoRecorderConfig } config - Recording parameters.
6762     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
6763     * @throws { BusinessError } 201 - Permission denied. Return by promise.
6764     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6765     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
6766     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6767     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6768     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6769     * @systemapi
6770     * @since 9
6771     */
6772    /**
6773     * Prepares for recording.
6774     * @permission ohos.permission.MICROPHONE
6775     * @param { VideoRecorderConfig } config - Recording parameters.
6776     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
6777     * @throws { BusinessError } 201 - Permission denied. Return by promise.
6778     * @throws { BusinessError } 202 - Not System App.
6779     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
6780     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
6781     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6782     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6783     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6784     * @systemapi
6785     * @since 12
6786     */
6787    prepare(config: VideoRecorderConfig): Promise<void>;
6788    /**
6789     * get input surface.it must be called between prepare completed and start.
6790     * @param { AsyncCallback<string> } callback - Callback used to return the input surface id in string.
6791     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6792     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6793     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6794     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6795     * @systemapi
6796     * @since 9
6797     */
6798    /**
6799     * get input surface.it must be called between prepare completed and start.
6800     * @param { AsyncCallback<string> } callback - Callback used to return the input surface id in string.
6801     * @throws { BusinessError } 202 - Not System App.
6802     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6803     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6804     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6805     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6806     * @systemapi
6807     * @since 12
6808     */
6809    getInputSurface(callback: AsyncCallback<string>): void;
6810    /**
6811     * get input surface. it must be called between prepare completed and start.
6812     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
6813     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6814     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6815     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6816     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6817     * @systemapi
6818     * @since 9
6819     */
6820    /**
6821     * get input surface. it must be called between prepare completed and start.
6822     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
6823     * @throws { BusinessError } 202 - Not System App.
6824     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6825     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6826     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6827     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6828     * @systemapi
6829     * @since 12
6830     */
6831    getInputSurface(): Promise<string>;
6832    /**
6833     * Starts video recording.
6834     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
6835     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6836     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6837     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6838     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6839     * @systemapi
6840     * @since 9
6841     */
6842    /**
6843     * Starts video recording.
6844     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
6845     * @throws { BusinessError } 202 - Not System App.
6846     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6847     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6848     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6849     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6850     * @systemapi
6851     * @since 12
6852     */
6853    start(callback: AsyncCallback<void>): void;
6854    /**
6855     * Starts video recording.
6856     * @returns { Promise<void> } A Promise instance used to return when start completed.
6857     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6858     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6859     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6860     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6861     * @systemapi
6862     * @since 9
6863     */
6864    /**
6865     * Starts video recording.
6866     * @returns { Promise<void> } A Promise instance used to return when start completed.
6867     * @throws { BusinessError } 202 - Not System App.
6868     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6869     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6870     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6871     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6872     * @systemapi
6873     * @since 12
6874     */
6875    start(): Promise<void>;
6876    /**
6877     * Pauses video recording.
6878     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
6879     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6880     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6881     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6882     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6883     * @systemapi
6884     * @since 9
6885     */
6886    /**
6887     * Pauses video recording.
6888     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
6889     * @throws { BusinessError } 202 - Not System App.
6890     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6891     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6892     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6893     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6894     * @systemapi
6895     * @since 12
6896     */
6897    pause(callback: AsyncCallback<void>): void;
6898    /**
6899     * Pauses video recording.
6900     * @returns { Promise<void> } A Promise instance used to return when pause completed.
6901     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6902     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6903     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6904     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6905     * @systemapi
6906     * @since 9
6907     */
6908    /**
6909     * Pauses video recording.
6910     * @returns { Promise<void> } A Promise instance used to return when pause completed.
6911     * @throws { BusinessError } 202 - Not System App.
6912     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6913     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6914     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6915     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6916     * @systemapi
6917     * @since 12
6918     */
6919    pause(): Promise<void>;
6920    /**
6921     * Resumes video recording.
6922     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
6923     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6924     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6925     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6926     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6927     * @systemapi
6928     * @since 9
6929     */
6930    /**
6931     * Resumes video recording.
6932     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
6933     * @throws { BusinessError } 202 - Not System App.
6934     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6935     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6936     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6937     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6938     * @systemapi
6939     * @since 12
6940     */
6941    resume(callback: AsyncCallback<void>): void;
6942    /**
6943     * Resumes video recording.
6944     * @returns { Promise<void> } A Promise instance used to return when resume completed.
6945     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6946     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6947     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6948     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6949     * @systemapi
6950     * @since 9
6951     */
6952    /**
6953     * Resumes video recording.
6954     * @returns { Promise<void> } A Promise instance used to return when resume completed.
6955     * @throws { BusinessError } 202 - Not System App.
6956     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6957     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6958     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6959     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6960     * @systemapi
6961     * @since 12
6962     */
6963    resume(): Promise<void>;
6964    /**
6965     * Stops video recording.
6966     * @param { AsyncCallback<void>  } callback A callback instance used to return when stop completed.
6967     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6968     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6969     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6970     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6971     * @systemapi
6972     * @since 9
6973     */
6974    /**
6975     * Stops video recording.
6976     * @param { AsyncCallback<void>  } callback A callback instance used to return when stop completed.
6977     * @throws { BusinessError } 202 - Not System App.
6978     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
6979     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
6980     * @throws { BusinessError } 5400105 - Service died. Return by callback.
6981     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6982     * @systemapi
6983     * @since 12
6984     */
6985    stop(callback: AsyncCallback<void>): void;
6986    /**
6987     * Stops video recording.
6988     * @returns { Promise<void> } A Promise instance used to return when stop completed.
6989     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
6990     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
6991     * @throws { BusinessError } 5400105 - Service died. Return by promise.
6992     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6993     * @systemapi
6994     * @since 9
6995     */
6996    /**
6997     * Stops video recording.
6998     * @returns { Promise<void> } A Promise instance used to return when stop completed.
6999     * @throws { BusinessError } 202 - Not System App.
7000     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7001     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
7002     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7003     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7004     * @systemapi
7005     * @since 12
7006     */
7007    stop(): Promise<void>;
7008    /**
7009     * Releases resources used for video recording.
7010     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
7011     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7012     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7013     * @systemapi
7014     * @since 9
7015     */
7016    /**
7017     * Releases resources used for video recording.
7018     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
7019     * @throws { BusinessError } 202 - Not System App.
7020     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7021     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7022     * @systemapi
7023     * @since 12
7024     */
7025    release(callback: AsyncCallback<void>): void;
7026    /**
7027     * Releases resources used for video recording.
7028     * @returns { Promise<void> } A Promise instance used to return when release completed.
7029     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7030     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7031     * @systemapi
7032     * @since 9
7033     */
7034    /**
7035     * Releases resources used for video recording.
7036     * @returns { Promise<void> } A Promise instance used to return when release completed.
7037     * @throws { BusinessError } 202 - Not System App.
7038     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7039     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7040     * @systemapi
7041     * @since 12
7042     */
7043    release(): Promise<void>;
7044    /**
7045     * Resets video recording.
7046     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
7047     * you must call prepare() to set the recording configurations for another recording.
7048     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
7049     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
7050     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7051     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7052     * @systemapi
7053     * @since 9
7054     */
7055    /**
7056     * Resets video recording.
7057     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
7058     * you must call prepare() to set the recording configurations for another recording.
7059     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
7060     * @throws { BusinessError } 202 - Not System App.
7061     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
7062     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7063     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7064     * @systemapi
7065     * @since 12
7066     */
7067    reset(callback: AsyncCallback<void>): void;
7068    /**
7069     * Resets video recording.
7070     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
7071     * you must call prepare() to set the recording configurations for another recording.
7072     * @returns { Promise<void> } A Promise instance used to return when reset completed.
7073     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
7074     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7075     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7076     * @systemapi
7077     * @since 9
7078     */
7079    /**
7080     * Resets video recording.
7081     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
7082     * you must call prepare() to set the recording configurations for another recording.
7083     * @returns { Promise<void> } A Promise instance used to return when reset completed.
7084     * @throws { BusinessError } 202 - Not System App.
7085     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
7086     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7087     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7088     * @systemapi
7089     * @since 12
7090     */
7091    reset(): Promise<void>;
7092    /**
7093     * Listens for video recording error events.
7094     * @param { 'error' } type - Type of the video recording error event to listen for.
7095     * @param { ErrorCallback } callback - Callback used to listen for the video recording error event.
7096     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
7097     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7098     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7099     * @systemapi
7100     * @since 9
7101     */
7102    /**
7103     * Listens for video recording error events.
7104     * @param { 'error' } type - Type of the video recording error event to listen for.
7105     * @param { ErrorCallback } callback - Callback used to listen for the video recording error event.
7106     * @throws { BusinessError } 201 - permission denied.
7107     * @throws { BusinessError } 202 - Not System App.
7108     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
7109     * @throws { BusinessError } 5400105 - Service died. Return by callback.
7110     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7111     * @systemapi
7112     * @since 12
7113     */
7114    on(type: 'error', callback: ErrorCallback): void;
7115
7116    /**
7117     * video recorder state.
7118     * @type { VideoRecordState }
7119     * @readonly
7120     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
7121     * @systemapi
7122     * @since 9
7123     */
7124    readonly state: VideoRecordState;
7125  }
7126
7127  /**
7128   * Describes video playback states.
7129   * @typedef { 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error' }
7130   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7131   * @since 8
7132   * @deprecated since 9
7133   * @useinstead ohos.multimedia.media/media.AVPlayerState
7134   */
7135  type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error';
7136
7137  /**
7138   * Enumerates playback speed.
7139   *
7140   * @enum { number }
7141   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7142   * @since 8
7143   */
7144  /**
7145   * Enumerates playback speed.
7146   *
7147   * @enum { number }
7148   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7149   * @crossplatform
7150   * @atomicservice
7151   * @since 12
7152   */
7153  enum PlaybackSpeed {
7154    /**
7155     * playback at 0.75x normal speed
7156     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7157     * @since 8
7158     */
7159    /**
7160     * playback at 0.75x normal speed
7161     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7162     * @crossplatform
7163     * @atomicservice
7164     * @since 12
7165     */
7166    SPEED_FORWARD_0_75_X = 0,
7167    /**
7168     * playback at normal speed
7169     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7170     * @since 8
7171     */
7172    /**
7173     * playback at normal speed
7174     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7175     * @crossplatform
7176     * @atomicservice
7177     * @since 12
7178     */
7179    SPEED_FORWARD_1_00_X = 1,
7180    /**
7181     * playback at 1.25x normal speed
7182     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7183     * @since 8
7184     */
7185    /**
7186     * playback at 1.25x normal speed
7187     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7188     * @crossplatform
7189     * @atomicservice
7190     * @since 12
7191     */
7192    SPEED_FORWARD_1_25_X = 2,
7193    /**
7194     * playback at 1.75x normal speed
7195     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7196     * @since 8
7197     */
7198    /**
7199     * playback at 1.75x normal speed
7200     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7201     * @crossplatform
7202     * @atomicservice
7203     * @since 12
7204     */
7205    SPEED_FORWARD_1_75_X = 3,
7206    /**
7207     * playback at 2.0x normal speed
7208     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7209     * @since 8
7210     */
7211    /**
7212     * playback at 2.0x normal speed
7213     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7214     * @crossplatform
7215     * @atomicservice
7216     * @since 12
7217     */
7218    SPEED_FORWARD_2_00_X = 4,
7219    /**
7220     * playback at 0.5x normal speed
7221     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7222     * @atomicservice
7223     * @since 12
7224     */
7225    SPEED_FORWARD_0_50_X = 5,
7226    /**
7227     * playback at 1.5x normal speed
7228     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7229     * @atomicservice
7230     * @since 12
7231     */
7232    SPEED_FORWARD_1_50_X = 6,
7233    /**
7234     * playback at 3.0x normal speed
7235     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7236     * @atomicservice
7237     * @since 13
7238     */
7239    SPEED_FORWARD_3_00_X = 7,
7240    /**
7241     * playback at 0.25x normal speed
7242     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7243     * @atomicservice
7244     * @since 12
7245     */
7246    SPEED_FORWARD_0_25_X = 8,
7247    /**
7248     * playback at 0.125x normal speed
7249     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7250     * @atomicservice
7251     * @since 12
7252     */
7253    SPEED_FORWARD_0_125_X = 9,
7254  }
7255
7256  /**
7257   * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer
7258   * instance.
7259   *
7260   * @typedef VideoPlayer
7261   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7262   * @since 8
7263   * @deprecated since 9
7264   * @useinstead ohos.multimedia.media/media.AVPlayer
7265   */
7266  interface VideoPlayer {
7267    /**
7268     * Set display surface.
7269     * @param {string} surfaceId - surface id, video player will use this id get a surface instance.
7270     * @param { AsyncCallback<void> } callback - A callback instance used to return when release output buffer completed.
7271     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7272     * @since 8
7273     * @deprecated since 9
7274     * @useinstead ohos.multimedia.media/media.AVPlayer#surfaceId
7275     */
7276    setDisplaySurface(surfaceId: string, callback: AsyncCallback<void>): void;
7277    /**
7278     * Set display surface.
7279     * @param {string} surfaceId - surface id, video player will use this id get a surface instance.
7280     * @returns { Promise<void> } A Promise instance used to return when release output buffer completed.
7281     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7282     * @since 8
7283     * @deprecated since 9
7284     * @useinstead ohos.multimedia.media/media.AVPlayer#surfaceId
7285     */
7286    setDisplaySurface(surfaceId: string): Promise<void>;
7287    /**
7288     * Prepare video playback, it will request resource for playing.
7289     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
7290     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7291     * @since 8
7292     * @deprecated since 9
7293     * @useinstead ohos.multimedia.media/media.AVPlayer#prepare
7294     */
7295    prepare(callback: AsyncCallback<void>): void;
7296    /**
7297     * Prepare video playback, it will request resource for playing.
7298     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
7299     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7300     * @since 8
7301     * @deprecated since 9
7302     * @useinstead ohos.multimedia.media/media.AVPlayer#prepare
7303     */
7304    prepare(): Promise<void>;
7305    /**
7306     * Starts video playback.
7307     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
7308     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7309     * @since 8
7310     * @deprecated since 9
7311     * @useinstead ohos.multimedia.media/media.AVPlayer#play
7312     */
7313    play(callback: AsyncCallback<void>): void;
7314    /**
7315     * Starts video playback.
7316     * @returns { Promise<void> } A Promise instance used to return when start completed.
7317     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7318     * @since 8
7319     * @deprecated since 9
7320     * @useinstead ohos.multimedia.media/media.AVPlayer#play
7321     */
7322    play(): Promise<void>;
7323    /**
7324     * Pauses video playback.
7325     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
7326     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7327     * @since 8
7328     * @deprecated since 9
7329     * @useinstead ohos.multimedia.media/media.AVPlayer#pause
7330     */
7331    pause(callback: AsyncCallback<void>): void;
7332    /**
7333     * Pauses video playback.
7334     * @returns { Promise<void> } A Promise instance used to return when pause completed.
7335     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7336     * @since 8
7337     * @deprecated since 9
7338     * @useinstead ohos.multimedia.media/media.AVPlayer#pause
7339     */
7340    pause(): Promise<void>;
7341    /**
7342     * Stops video playback.
7343     * @param { AsyncCallback<void> } callback - A callback instance used to return when stop completed.
7344     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7345     * @since 8
7346     * @deprecated since 9
7347     * @useinstead ohos.multimedia.media/media.AVPlayer#stop
7348     */
7349    stop(callback: AsyncCallback<void>): void;
7350    /**
7351     * Stops video playback.
7352     * @returns { Promise<void> } A Promise instance used to return when stop completed.
7353     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7354     * @since 8
7355     * @deprecated since 9
7356     * @useinstead ohos.multimedia.media/media.AVPlayer#stop
7357     */
7358    stop(): Promise<void>;
7359    /**
7360     * Resets video playback, it will release the resource.
7361     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
7362     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7363     * @since 8
7364     * @deprecated since 9
7365     * @useinstead ohos.multimedia.media/media.AVPlayer#reset
7366     */
7367    reset(callback: AsyncCallback<void>): void;
7368    /**
7369     * Resets video playback, it will release the resource.
7370     * @returns { Promise<void> } A Promise instance used to return when reset completed.
7371     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7372     * @since 8
7373     * @deprecated since 9
7374     * @useinstead ohos.multimedia.media/media.AVPlayer#reset
7375     */
7376    reset(): Promise<void>;
7377    /**
7378     * Jumps to the specified playback position by default SeekMode(SEEK_PREV_SYNC),
7379     * the performance may be not the best.
7380     * @param { number } timeMs - Playback position to jump
7381     * @param { AsyncCallback<number> } callback - A callback instance used to return when seek completed
7382     * and return the seeking position result.
7383     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7384     * @since 8
7385     * @deprecated since 9
7386     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
7387     */
7388    seek(timeMs: number, callback: AsyncCallback<number>): void;
7389    /**
7390     * Jumps to the specified playback position.
7391     * @param { number } timeMs - Playback position to jump
7392     * @param { SeekMode } mode - seek mode, see @SeekMode .
7393     * @param { AsyncCallback<number> } callback - A callback instance used to return when seek completed
7394     * and return the seeking position result.
7395     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7396     * @since 8
7397     * @deprecated since 9
7398     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
7399     */
7400    seek(timeMs: number, mode: SeekMode, callback: AsyncCallback<number>): void;
7401    /**
7402     * Jumps to the specified playback position.
7403     * @param { number } timeMs - Playback position to jump
7404     * @param { SeekMode } mode - seek mode, see @SeekMode .
7405     * @returns { Promise<number> } A Promise instance used to return when seek completed
7406     * and return the seeking position result.
7407     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7408     * @since 8
7409     * @deprecated since 9
7410     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
7411     */
7412    seek(timeMs: number, mode?: SeekMode): Promise<number>;
7413    /**
7414     * Sets the volume.
7415     * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
7416     * @param { AsyncCallback<void> } callback - A callback instance used to return when set volume completed.
7417     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7418     * @since 8
7419     * @deprecated since 9
7420     * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume
7421     */
7422    setVolume(vol: number, callback: AsyncCallback<void>): void;
7423    /**
7424     * Sets the volume.
7425     * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
7426     * @returns { Promise<void> } A Promise instance used to return when set volume completed.
7427     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7428     * @since 8
7429     * @deprecated since 9
7430     * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume
7431     */
7432    setVolume(vol: number): Promise<void>;
7433    /**
7434     * Releases resources used for video playback.
7435     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
7436     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7437     * @since 8
7438     * @deprecated since 9
7439     * @useinstead ohos.multimedia.media/media.AVPlayer#release
7440     */
7441    release(callback: AsyncCallback<void>): void;
7442    /**
7443     * Releases resources used for video playback.
7444     * @returns { Promise<void> } A Promise instance used to return when release completed.
7445     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7446     * @since 8
7447     * @deprecated since 9
7448     * @useinstead ohos.multimedia.media/media.AVPlayer#release
7449     */
7450    release(): Promise<void>;
7451    /**
7452     * Get all track infos in MediaDescription, should be called after data loaded callback.
7453     * @param { AsyncCallback<Array<MediaDescription>> } callback - async callback return track info in MediaDescription.
7454     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7455     * @since 8
7456     * @deprecated since 9
7457     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
7458     */
7459    getTrackDescription(callback: AsyncCallback<Array<MediaDescription>>): void;
7460
7461    /**
7462     * Get all track infos in MediaDescription, should be called after data loaded callback.
7463     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
7464     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7465     * @since 8
7466     * @deprecated since 9
7467     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
7468     */
7469    getTrackDescription(): Promise<Array<MediaDescription>>;
7470
7471    /**
7472     * media url. Mainstream video formats are supported.
7473     * local:fd://XXX, file://XXX. network:http://xxx
7474     * @type { string }
7475     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7476     * @since 8
7477     * @deprecated since 9
7478     * @useinstead ohos.multimedia.media/media.AVPlayer#url
7479     */
7480    url: string;
7481
7482    /**
7483     * Video file descriptor. Mainstream video formats are supported.
7484     * @type { AVFileDescriptor }
7485     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7486     * @since 9
7487     * @deprecated since 9
7488     * @useinstead ohos.multimedia.media/media.AVPlayer#fdSrc
7489     */
7490    fdSrc: AVFileDescriptor;
7491
7492    /**
7493     * Whether to loop video playback. The value true means to loop playback.
7494     * @type { boolean }
7495     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7496     * @since 8
7497     * @deprecated since 9
7498     * @useinstead ohos.multimedia.media/media.AVPlayer#loop
7499     */
7500    loop: boolean;
7501
7502    /**
7503     * Current playback position.
7504     * @type { number }
7505     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7506     * @since 8
7507     * @deprecated since 9
7508     * @useinstead ohos.multimedia.media/media.AVPlayer#currentTime
7509     */
7510    readonly currentTime: number;
7511
7512    /**
7513     * Playback duration, if -1 means cannot seek.
7514     * @type { number }
7515     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7516     * @since 8
7517     * @deprecated since 9
7518     * @useinstead ohos.multimedia.media/media.AVPlayer#duration
7519     */
7520    readonly duration: number;
7521
7522    /**
7523     * Playback state.
7524     * @type { VideoPlayState }
7525     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7526     * @since 8
7527     * @deprecated since 9
7528     * @useinstead ohos.multimedia.media/media.AVPlayer#state
7529     */
7530    readonly state: VideoPlayState;
7531
7532    /**
7533     * video width, valid after prepared.
7534     * @type { number }
7535     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7536     * @since 8
7537     * @deprecated since 9
7538     * @useinstead ohos.multimedia.media/media.AVPlayer#width
7539     */
7540    readonly width: number;
7541
7542    /**
7543     * video height, valid after prepared.
7544     * @type { number }
7545     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7546     * @since 8
7547     * @deprecated since 9
7548     * @useinstead ohos.multimedia.media/media.AVPlayer#height
7549     */
7550    readonly height: number;
7551
7552    /**
7553     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
7554     * set, the default mode will be used. Set it before calling the {@link #play()} in the
7555     * first time in order for the interrupt mode to become effective thereafter.
7556     * @type { ?audio.InterruptMode }
7557     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7558     * @since 9
7559     * @deprecated since 9
7560     * @useinstead ohos.multimedia.media/media.AVPlayer#audioInterruptMode
7561     */
7562    audioInterruptMode?: audio.InterruptMode;
7563
7564    /**
7565     * video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more
7566     * information, refer to {@link #VideoScaleType}
7567     * @type { ?VideoScaleType }
7568     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7569     * @since 9
7570     * @deprecated since 9
7571     * @useinstead ohos.multimedia.media/media.AVPlayer#videoScaleType
7572     */
7573    videoScaleType?: VideoScaleType;
7574
7575    /**
7576     * set payback speed.
7577     * @param { number } speed - playback speed, see @PlaybackSpeed .
7578     * @param { AsyncCallback<number> } callback Callback used to return actually speed.
7579     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7580     * @since 8
7581     * @deprecated since 9
7582     * @useinstead ohos.multimedia.media/media.AVPlayer#setSpeed
7583     */
7584    setSpeed(speed: number, callback: AsyncCallback<number>): void;
7585    /**
7586     * set output surface.
7587     * @param { number } speed - playback speed, see @PlaybackSpeed .
7588     * @returns { Promise<number> } A Promise instance used to return actually speed.
7589     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7590     * @since 8
7591     * @deprecated since 9
7592     * @useinstead ohos.multimedia.media/media.AVPlayer#setSpeed
7593     */
7594    setSpeed(speed: number): Promise<number>;
7595
7596    /**
7597     * Listens for video playback completed events.
7598     * @param { 'playbackCompleted' } type - Type of the playback event to listen for.
7599     * @param { Callback<void> } callback - Callback used to listen for the playback event return.
7600     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7601     * @since 8
7602     * @deprecated since 9
7603     * @useinstead ohos.multimedia.media/media.AVPlayer#event:stateChange
7604     */
7605    on(type: 'playbackCompleted', callback: Callback<void>): void;
7606
7607    /**
7608     * Listens for video playback buffering events.
7609     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
7610     * @param { function } callback - Callback used to listen for the buffering update event,
7611	 * return BufferingInfoType and the value.
7612     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7613     * @since 8
7614     * @deprecated since 9
7615     * @useinstead ohos.multimedia.media/media.AVPlayer#event:bufferingUpdate
7616     */
7617    on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
7618
7619    /**
7620     * Listens for start render video frame events.
7621     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
7622     * @param { Callback<void> } callback - Callback used to listen for the playback event return.
7623     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7624     * @since 8
7625     * @deprecated since 9
7626     * @useinstead ohos.multimedia.media/media.AVPlayer#event:startRenderFrame
7627     */
7628    on(type: 'startRenderFrame', callback: Callback<void>): void;
7629
7630    /**
7631     * Listens for video size changed event.
7632     * @param { 'videoSizeChanged' } type - Type of the playback event to listen for.
7633     * @param { function } callback - Callback used to listen for the playback event return video size.
7634     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7635     * @since 8
7636     * @deprecated since 9
7637     * @useinstead ohos.multimedia.media/media.AVPlayer#event:videoSizeChange
7638     */
7639    on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void;
7640
7641    /**
7642     * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
7643     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
7644     * @param { function } callback - Callback used to listen for the playback event return audio interrupt info.
7645     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7646     * @since 9
7647     * @deprecated since 9
7648     * @useinstead ohos.multimedia.media/media.AVPlayer#event:audioInterrupt
7649     */
7650    on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
7651
7652    /**
7653     * Listens for playback error events.
7654     * @param { 'error' } type - Type of the playback error event to listen for.
7655     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
7656     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7657     * @since 8
7658     * @deprecated since 9
7659     * @useinstead ohos.multimedia.media/media.AVPlayer#event:error
7660     */
7661    on(type: 'error', callback: ErrorCallback): void;
7662  }
7663
7664  /**
7665   * Enumerates video scale type.
7666   *
7667   * @enum { number }
7668   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7669   * @since 9
7670   */
7671  /**
7672   * Enumerates video scale type.
7673   *
7674   * @enum { number }
7675   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7676   * @crossplatform
7677   * @atomicservice
7678   * @since 12
7679   */
7680  enum VideoScaleType {
7681    /**
7682     * The content is stretched to the fit the display surface rendering area. When
7683     * the aspect ratio of the content is not same as the display surface, the aspect
7684     * of the content is not maintained. This is the default scale type.
7685     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7686     * @since 9
7687     */
7688    /**
7689     * The content is stretched to the fit the display surface rendering area. When
7690     * the aspect ratio of the content is not same as the display surface, the aspect
7691     * of the content is not maintained. This is the default scale type.
7692     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7693     * @crossplatform
7694     * @atomicservice
7695     * @since 12
7696     */
7697    VIDEO_SCALE_TYPE_FIT = 0,
7698
7699    /**
7700     * The content is stretched to the fit the display surface rendering area. When
7701     * the aspect ratio of the content is not the same as the display surface, content's
7702     * aspect ratio is maintained and the content is cropped to fit the display surface.
7703     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7704     * @since 9
7705     */
7706    /**
7707     * The content is stretched to the fit the display surface rendering area. When
7708     * the aspect ratio of the content is not the same as the display surface, content's
7709     * aspect ratio is maintained and the content is cropped to fit the display surface.
7710     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7711     * @crossplatform
7712     * @atomicservice
7713     * @since 12
7714     */
7715    VIDEO_SCALE_TYPE_FIT_CROP = 1,
7716
7717    /**
7718     * The content is scaled proportionally to fit the display area.
7719     * If the aspect ratios of the two are inconsistent, the short side will be centered.
7720     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
7721     * @crossplatform
7722     * @atomicservice
7723     * @since 20
7724     */
7725    VIDEO_SCALE_TYPE_SCALED_ASPECT = 2
7726
7727  }
7728
7729  /**
7730   * Enumerates container format type(The abbreviation for 'container format type' is CFT).
7731   *
7732   * @enum { number }
7733   * @syscap SystemCapability.Multimedia.Media.Core
7734   * @since 8
7735   */
7736  /**
7737   * Enumerates container format type(The abbreviation for 'container format type' is CFT).
7738   *
7739   * @enum { number }
7740   * @syscap SystemCapability.Multimedia.Media.Core
7741   * @crossplatform
7742   * @atomicservice
7743   * @since 12
7744   */
7745  enum ContainerFormatType {
7746    /**
7747     * A video container format type mp4.
7748     * @syscap SystemCapability.Multimedia.Media.Core
7749     * @since 8
7750     */
7751    /**
7752     * A video container format type mp4.
7753     * @syscap SystemCapability.Multimedia.Media.Core
7754     * @crossplatform
7755     * @since 12
7756     */
7757    CFT_MPEG_4 = 'mp4',
7758
7759    /**
7760     * A audio container format type m4a.
7761     * @syscap SystemCapability.Multimedia.Media.Core
7762     * @since 8
7763     */
7764    /**
7765     * A audio container format type m4a.
7766     * @syscap SystemCapability.Multimedia.Media.Core
7767     * @crossplatform
7768     * @atomicservice
7769     * @since 12
7770     */
7771    CFT_MPEG_4A = 'm4a',
7772
7773    /**
7774     * A audio container format type mp3.
7775     * @syscap SystemCapability.Multimedia.Media.Core
7776     * @since 12
7777     */
7778    CFT_MP3 = 'mp3',
7779    /**
7780     * A audio container format type wav.
7781     * @syscap SystemCapability.Multimedia.Media.Core
7782     * @since 12
7783     */
7784    CFT_WAV = 'wav',
7785    /**
7786     * A audio container format type amr.
7787     * @syscap SystemCapability.Multimedia.Media.Core
7788     * @since 18
7789     */
7790    CFT_AMR = 'amr',
7791    /**
7792     * A audio container format type aac with ADTS.
7793     * @syscap SystemCapability.Multimedia.Media.Core
7794     * @since 20
7795     */
7796    CFT_AAC = 'aac',
7797  }
7798
7799  /**
7800   * Enumerates media data type.
7801   *
7802   * @enum { number }
7803   * @syscap SystemCapability.Multimedia.Media.Core
7804   * @since 8
7805   */
7806  /**
7807   * Enumerates media data type.
7808   *
7809   * @enum { number }
7810   * @syscap SystemCapability.Multimedia.Media.Core
7811   * @atomicservice
7812   * @since 11
7813   */
7814  /**
7815   * Enumerates media data type.
7816   *
7817   * @enum { number }
7818   * @syscap SystemCapability.Multimedia.Media.Core
7819   * @crossplatform
7820   * @atomicservice
7821   * @since 12
7822   */
7823  enum MediaType {
7824    /**
7825     * Track is unsupported.
7826     * @syscap SystemCapability.Multimedia.Media.Core
7827     * @atomicservice
7828     * @since 20
7829     * @arkts 1.1&1.2
7830     */
7831    MEDIA_TYPE_UNSUPPORTED = -1,
7832    /**
7833     * track is audio.
7834     * @syscap SystemCapability.Multimedia.Media.Core
7835     * @since 8
7836     */
7837    /**
7838     * track is audio.
7839     * @syscap SystemCapability.Multimedia.Media.Core
7840     * @atomicservice
7841     * @since 11
7842     */
7843    /**
7844     * track is audio.
7845     * @syscap SystemCapability.Multimedia.Media.Core
7846     * @crossplatform
7847     * @atomicservice
7848     * @since 12
7849     */
7850    MEDIA_TYPE_AUD = 0,
7851    /**
7852     * track is video.
7853     * @syscap SystemCapability.Multimedia.Media.Core
7854     * @since 8
7855     */
7856    /**
7857     * track is video.
7858     * @syscap SystemCapability.Multimedia.Media.Core
7859     * @atomicservice
7860     * @since 11
7861     */
7862    /**
7863     * track is video.
7864     * @syscap SystemCapability.Multimedia.Media.Core
7865     * @crossplatform
7866     * @atomicservice
7867     * @since 12
7868     */
7869    MEDIA_TYPE_VID = 1,
7870    /**
7871     * Track is subtitle.
7872     * @syscap SystemCapability.Multimedia.Media.Core
7873     * @atomicservice
7874     * @since 12
7875     */
7876    MEDIA_TYPE_SUBTITLE = 2,
7877    /**
7878     * Track is attachmemt.
7879     * @syscap SystemCapability.Multimedia.Media.Core
7880     * @atomicservice
7881     * @since 20
7882     * @arkts 1.1&1.2
7883     */
7884    MEDIA_TYPE_ATTACHMENT = 3,
7885    /**
7886     * Track is data.
7887     * @syscap SystemCapability.Multimedia.Media.Core
7888     * @atomicservice
7889     * @since 20
7890     * @arkts 1.1&1.2
7891     */
7892    MEDIA_TYPE_DATA = 4,
7893    /**
7894     * Track is timed metadata.
7895     * @syscap SystemCapability.Multimedia.Media.Core
7896     * @atomicservice
7897     * @since 20
7898     * @arkts 1.1&1.2
7899     */
7900    MEDIA_TYPE_TIMED_METADATA = 5,
7901    /**
7902     * Track is auxiliary.
7903     * @syscap SystemCapability.Multimedia.Media.Core
7904     * @atomicservice
7905     * @since 20
7906     * @arkts 1.1&1.2
7907     */
7908    MEDIA_TYPE_AUXILIARY = 6,
7909  }
7910
7911  /**
7912   * Enumerates media description key.
7913   *
7914   * @enum { number }
7915   * @syscap SystemCapability.Multimedia.Media.Core
7916   * @since 8
7917   */
7918  /**
7919   * Enumerates media description key.
7920   *
7921   * @enum { number }
7922   * @syscap SystemCapability.Multimedia.Media.Core
7923   * @atomicservice
7924   * @since 11
7925   */
7926  /**
7927   * Enumerates media description key.
7928   *
7929   * @enum { number }
7930   * @syscap SystemCapability.Multimedia.Media.Core
7931   * @crossplatform
7932   * @atomicservice
7933   * @since 12
7934   */
7935  enum MediaDescriptionKey {
7936    /**
7937     * key for track index, value type is number.
7938     * @syscap SystemCapability.Multimedia.Media.Core
7939     * @since 8
7940     */
7941    /**
7942     * key for track index, value type is number.
7943     * @syscap SystemCapability.Multimedia.Media.Core
7944     * @atomicservice
7945     * @since 11
7946     */
7947    /**
7948     * key for track index, value type is number.
7949     * @syscap SystemCapability.Multimedia.Media.Core
7950     * @crossplatform
7951     * @atomicservice
7952     * @since 12
7953     */
7954    MD_KEY_TRACK_INDEX = 'track_index',
7955
7956    /**
7957     * key for track type, value type is number, see @MediaType.
7958     * @syscap SystemCapability.Multimedia.Media.Core
7959     * @since 8
7960     */
7961    /**
7962     * key for track type, value type is number, see @MediaType.
7963     * @syscap SystemCapability.Multimedia.Media.Core
7964     * @atomicservice
7965     * @since 11
7966     */
7967    /**
7968     * key for track type, value type is number, see @MediaType.
7969     * @syscap SystemCapability.Multimedia.Media.Core
7970     * @crossplatform
7971     * @atomicservice
7972     * @since 12
7973     */
7974    MD_KEY_TRACK_TYPE = 'track_type',
7975
7976    /**
7977     * key for codec mime type, value type is string.
7978     * @syscap SystemCapability.Multimedia.Media.Core
7979     * @since 8
7980     */
7981    /**
7982     * key for codec mime type, value type is string.
7983     * @syscap SystemCapability.Multimedia.Media.Core
7984     * @atomicservice
7985     * @since 11
7986     */
7987    /**
7988     * key for codec mime type, value type is string.
7989     * @syscap SystemCapability.Multimedia.Media.Core
7990     * @crossplatform
7991     * @atomicservice
7992     * @since 12
7993     */
7994    MD_KEY_CODEC_MIME = 'codec_mime',
7995
7996    /**
7997     * key for duration, value type is number.
7998     * @syscap SystemCapability.Multimedia.Media.Core
7999     * @since 8
8000     */
8001    /**
8002     * key for duration, value type is number.
8003     * @syscap SystemCapability.Multimedia.Media.Core
8004     * @atomicservice
8005     * @since 11
8006     */
8007    /**
8008     * key for duration, value type is number.
8009     * @syscap SystemCapability.Multimedia.Media.Core
8010     * @crossplatform
8011     * @atomicservice
8012     * @since 12
8013     */
8014    MD_KEY_DURATION = 'duration',
8015
8016    /**
8017     * key for bitrate, value type is number.
8018     * @syscap SystemCapability.Multimedia.Media.Core
8019     * @since 8
8020     */
8021    /**
8022     * key for bitrate, value type is number.
8023     * @syscap SystemCapability.Multimedia.Media.Core
8024     * @atomicservice
8025     * @since 11
8026     */
8027    /**
8028     * key for bitrate, value type is number.
8029     * @syscap SystemCapability.Multimedia.Media.Core
8030     * @crossplatform
8031     * @atomicservice
8032     * @since 12
8033     */
8034    MD_KEY_BITRATE = 'bitrate',
8035
8036    /**
8037     * key for video width, value type is number.
8038     * @syscap SystemCapability.Multimedia.Media.Core
8039     * @since 8
8040     */
8041    /**
8042     * key for video width, value type is number.
8043     * @syscap SystemCapability.Multimedia.Media.Core
8044     * @atomicservice
8045     * @since 11
8046     */
8047    /**
8048     * key for video width, value type is number.
8049     * @syscap SystemCapability.Multimedia.Media.Core
8050     * @crossplatform
8051     * @atomicservice
8052     * @since 12
8053     */
8054    MD_KEY_WIDTH = 'width',
8055
8056    /**
8057     * key for video height, value type is number.
8058     * @syscap SystemCapability.Multimedia.Media.Core
8059     * @since 8
8060     */
8061    /**
8062     * key for video height, value type is number.
8063     * @syscap SystemCapability.Multimedia.Media.Core
8064     * @atomicservice
8065     * @since 11
8066     */
8067    /**
8068     * key for video height, value type is number.
8069     * @syscap SystemCapability.Multimedia.Media.Core
8070     * @crossplatform
8071     * @atomicservice
8072     * @since 12
8073     */
8074    MD_KEY_HEIGHT = 'height',
8075
8076    /**
8077     * key for video frame rate, value type is number.
8078     * @syscap SystemCapability.Multimedia.Media.Core
8079     * @since 8
8080     */
8081    /**
8082     * key for video frame rate, value type is number.
8083     * @syscap SystemCapability.Multimedia.Media.Core
8084     * @atomicservice
8085     * @since 11
8086     */
8087    /**
8088     * key for video frame rate, value type is number.
8089     * @syscap SystemCapability.Multimedia.Media.Core
8090     * @crossplatform
8091     * @atomicservice
8092     * @since 12
8093     */
8094    MD_KEY_FRAME_RATE = 'frame_rate',
8095
8096    /**
8097     * key for audio channel count, value type is number
8098     * @syscap SystemCapability.Multimedia.Media.Core
8099     * @since 8
8100     */
8101    /**
8102     * key for audio channel count, value type is number
8103     * @syscap SystemCapability.Multimedia.Media.Core
8104     * @atomicservice
8105     * @since 11
8106     */
8107    /**
8108     * key for audio channel count, value type is number
8109     * @syscap SystemCapability.Multimedia.Media.Core
8110     * @crossplatform
8111     * @atomicservice
8112     * @since 12
8113     */
8114    MD_KEY_AUD_CHANNEL_COUNT = 'channel_count',
8115
8116    /**
8117     * key for audio sample rate, value type is number
8118     * @syscap SystemCapability.Multimedia.Media.Core
8119     * @since 8
8120     */
8121    /**
8122     * key for audio sample rate, value type is number
8123     * @syscap SystemCapability.Multimedia.Media.Core
8124     * @atomicservice
8125     * @since 11
8126     */
8127    /**
8128     * key for audio sample rate, value type is number
8129     * @syscap SystemCapability.Multimedia.Media.Core
8130     * @crossplatform
8131     * @atomicservice
8132     * @since 12
8133     */
8134    MD_KEY_AUD_SAMPLE_RATE = 'sample_rate',
8135
8136    /**
8137     * key for audio bit depth, value type is number
8138     * @syscap SystemCapability.Multimedia.Media.Core
8139     * @atomicservice
8140     * @since 12
8141     */
8142    MD_KEY_AUD_SAMPLE_DEPTH = 'sample_depth',
8143
8144    /**
8145     * Key for language.
8146     * @syscap SystemCapability.Multimedia.Media.Core
8147     * @atomicservice
8148     * @since 12
8149     */
8150    MD_KEY_LANGUAGE = 'language',
8151
8152    /**
8153     * Key for track name, value is string.
8154     * @syscap SystemCapability.Multimedia.Media.Core
8155     * @atomicservice
8156     * @since 12
8157     */
8158    MD_KEY_TRACK_NAME = 'track_name',
8159
8160    /**
8161     * Key for video hdr type, value type is number.
8162     * @syscap SystemCapability.Multimedia.Media.Core
8163     * @atomicservice
8164     * @since 12
8165     */
8166    MD_KEY_HDR_TYPE = 'hdr_type',
8167  }
8168
8169  /**
8170   * Provides the video recorder profile definitions.
8171   *
8172   * @typedef VideoRecorderProfile
8173   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8174   * @systemapi
8175   * @since 9
8176   */
8177  interface VideoRecorderProfile {
8178    /**
8179     * Indicates the audio bit rate.
8180     * @type { number }
8181     * @readonly
8182     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8183     * @systemapi
8184     * @since 9
8185     */
8186    readonly audioBitrate: number;
8187
8188    /**
8189     * Indicates the number of audio channels.
8190     * @type { number }
8191     * @readonly
8192     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8193     * @systemapi
8194     * @since 9
8195     */
8196    readonly audioChannels: number;
8197
8198    /**
8199     * Indicates the audio encoding format.
8200     * @type { CodecMimeType }
8201     * @readonly
8202     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8203     * @systemapi
8204     * @since 9
8205     */
8206    readonly audioCodec: CodecMimeType;
8207
8208    /**
8209     * Indicates the audio sampling rate.
8210     * @type { number }
8211     * @readonly
8212     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8213     * @systemapi
8214     * @since 9
8215     */
8216    readonly audioSampleRate: number;
8217
8218    /**
8219     * Indicates the output file format.
8220     * @type { ContainerFormatType }
8221     * @readonly
8222     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8223     * @systemapi
8224     * @since 9
8225     */
8226    readonly fileFormat: ContainerFormatType;
8227
8228    /**
8229     * Indicates the video bit rate.
8230     * @type { number }
8231     * @readonly
8232     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8233     * @systemapi
8234     * @since 9
8235     */
8236    readonly videoBitrate: number;
8237
8238    /**
8239     * Indicates the video encoding format.
8240     * @type { CodecMimeType }
8241     * @readonly
8242     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8243     * @systemapi
8244     * @since 9
8245     */
8246    readonly videoCodec: CodecMimeType;
8247
8248    /**
8249     * Indicates the video width.
8250     * @type { number }
8251     * @readonly
8252     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8253     * @systemapi
8254     * @since 9
8255     */
8256    readonly videoFrameWidth: number;
8257
8258    /**
8259     * Indicates the video height.
8260     * @type { number }
8261     * @readonly
8262     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8263     * @systemapi
8264     * @since 9
8265     */
8266    readonly videoFrameHeight: number;
8267
8268    /**
8269     * Indicates the video frame rate.
8270     * @type { number }
8271     * @readonly
8272     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8273     * @systemapi
8274     * @since 9
8275     */
8276    readonly videoFrameRate: number;
8277  }
8278
8279  /**
8280   * Enumerates audio source type for recorder.
8281   *
8282   * @enum { number }
8283   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8284   * @since 9
8285   */
8286  /**
8287   * Enumerates the audio source types for video recording.
8288   *
8289   * @enum { number }
8290   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8291   * @crossplatform
8292   * @atomicservice
8293   * @since 12
8294   */
8295  enum AudioSourceType {
8296    /**
8297     * Default audio source type.
8298     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8299     * @since 9
8300     */
8301    /**
8302     * Default audio input source.
8303     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8304     * @crossplatform
8305     * @since 12
8306     */
8307    AUDIO_SOURCE_TYPE_DEFAULT = 0,
8308    /**
8309     * Source type mic.
8310     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8311     * @since 9
8312     */
8313    /**
8314     *  Microphone audio input source.
8315     *  <br>**Atomic service API**: This API can be used in atomic services since API version 12.
8316     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8317     * @crossplatform
8318     * @atomicservice
8319     * @since 12
8320     */
8321    AUDIO_SOURCE_TYPE_MIC = 1,
8322    /**
8323     * Audio source in speech recognition scenarios.
8324     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8325     * @since 12
8326     */
8327    AUDIO_SOURCE_TYPE_VOICE_RECOGNITION = 2,
8328
8329    /**
8330     * Voice communication source.
8331     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8332     * @since 12
8333     */
8334    AUDIO_SOURCE_TYPE_VOICE_COMMUNICATION = 7,
8335    /**
8336     * Voice message source.
8337     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8338     * @since 12
8339     */
8340    AUDIO_SOURCE_TYPE_VOICE_MESSAGE = 10,
8341    /**
8342     * Audio source in camera recording scenarios.
8343     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8344     * @since 12
8345     */
8346    AUDIO_SOURCE_TYPE_CAMCORDER = 13,
8347  }
8348
8349  /**
8350   * Enumerates video source type for recorder.
8351   *
8352   * @enum { number }
8353   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8354   * @since 9
8355   */
8356  /**
8357   * Enumerates the video source types for video recording.
8358   *
8359   * @enum { number }
8360   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8361   * @crossplatform
8362   * @since 12
8363   */
8364  enum VideoSourceType {
8365    /**
8366     * Surface raw data.
8367     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8368     * @since 9
8369     */
8370    /**
8371     * The input surface carries raw data.
8372     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8373     * @crossplatform
8374     * @since 12
8375     */
8376    VIDEO_SOURCE_TYPE_SURFACE_YUV = 0,
8377    /**
8378     * Surface ES data.
8379     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8380     * @since 9
8381     */
8382    /**
8383     * The input surface carries ES data.
8384     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8385     * @crossplatform
8386     * @since 12
8387     */
8388    VIDEO_SOURCE_TYPE_SURFACE_ES = 1,
8389  }
8390
8391  /**
8392   * Enumerates meta source type for recorder.
8393   *
8394   * @enum { number }
8395   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8396   * @systemapi
8397   * @since 12
8398   */
8399  enum MetaSourceType {
8400    /**
8401     * Maker info for video.
8402     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8403     * @systemapi
8404     * @since 12
8405     */
8406    VIDEO_MAKER_INFO = 0,
8407  }
8408
8409  /**
8410   * Enumerates the modes for creating media files.
8411   *
8412   * @enum { number }
8413   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8414   * @since 12
8415   */
8416  enum FileGenerationMode {
8417    /**
8418     * The application creates a media file in the sandbox.
8419     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8420     * @since 12
8421     */
8422    APP_CREATE = 0,
8423    /**
8424     * The system creates a media file. Currently, this mode takes effect only in camera recording scenarios.
8425     * The URL set by the application is ignored.
8426     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8427     * @since 12
8428     */
8429    AUTO_CREATE_CAMERA_SCENE = 1,
8430  }
8431
8432  /**
8433   * Provides the video recorder configuration definitions.
8434   *
8435   * @typedef VideoRecorderConfig
8436   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8437   * @systemapi
8438   * @since 9
8439   */
8440  interface VideoRecorderConfig {
8441    /**
8442     * audio source type, details see @AudioSourceType .
8443     * @type { ?AudioSourceType }
8444     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8445     * @systemapi
8446     * @since 9
8447     */
8448    audioSourceType?: AudioSourceType;
8449    /**
8450     * video source type, details see @VideoSourceType .
8451     * @type { VideoSourceType }
8452     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8453     * @systemapi
8454     * @since 9
8455     */
8456    videoSourceType: VideoSourceType;
8457    /**
8458     * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile .=
8459     * @type { VideoRecorderProfile }
8460     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8461     * @systemapi
8462     * @since 9
8463     */
8464    profile: VideoRecorderProfile;
8465    /**
8466     * video output uri.support two kind of uri now.
8467     * format like: scheme + "://" + "context".
8468     * fd:    fd://fd
8469     * @type { string }
8470     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8471     * @systemapi
8472     * @since 9
8473     */
8474    url: string;
8475    /**
8476     * Sets the video rotation angle in output file, and for the file to playback. mp4 support.
8477     * the range of rotation angle should be {0, 90, 180, 270}, default is 0.
8478     * @type { ?number }
8479     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8480     * @systemapi
8481     * @since 9
8482     */
8483    rotation?: number;
8484    /**
8485     * geographical location information.
8486     * @type { ?Location }
8487     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
8488     * @systemapi
8489     * @since 9
8490     */
8491    location?: Location;
8492  }
8493
8494  /**
8495   * Describes the information about an encoder.
8496   *
8497   * @typedef EncoderInfo
8498   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8499   * @since 11
8500   */
8501  interface EncoderInfo {
8502    /**
8503     * MIME type of the encoder.
8504     * @type { CodecMimeType }
8505     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8506     * @since 11
8507     */
8508    mimeType: CodecMimeType;
8509
8510    /**
8511     * Encoder type. The value **audio** means an audio encoder, and **video** means a video encoder.
8512     * @type { string }
8513     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8514     * @since 11
8515     */
8516    type: string;
8517
8518    /**
8519     * Bit rate range of the encoder, with the minimum and maximum bit rates specified.
8520     * @type { ?Range }
8521     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8522     * @since 11
8523     */
8524    bitRate?: Range;
8525
8526    /**
8527     * Video frame rate range, with the minimum and maximum frame rates specified.
8528     * This parameter is available only for video encoders.
8529     * @type { ?Range }
8530     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8531     * @since 11
8532     */
8533    frameRate?: Range;
8534
8535    /**
8536     * Video frame width range, with the minimum and maximum widths specified.
8537     * This parameter is available only for video encoders.
8538     * @type { ?Range }
8539     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8540     * @since 11
8541     */
8542    width?: Range;
8543
8544    /**
8545     * Video frame height range, with the minimum and maximum heights specified.
8546     * This parameter is available only for video encoders.
8547     * @type { ?Range }
8548     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8549     * @since 11
8550     */
8551    height?: Range;
8552
8553    /**
8554     * Number of audio channels for the audio capturer, with the minimum and maximum numbers of audio channels specified.
8555     * This parameter is available only for audio encoders.
8556     * @type { ?Range }
8557     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8558     * @since 11
8559     */
8560    channels?: Range;
8561
8562    /**
8563     * Audio sampling rate, including all available audio sampling rates. The value depends on the encoder type,
8564     * and this parameter is available only for audio encoders.
8565     * @type { ?Array<number> }
8566     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8567     * @since 11
8568     */
8569    sampleRate?: Array<number>;
8570  }
8571
8572  /**
8573   * Provides Range with lower and upper limit.
8574   *
8575   * @typedef Range
8576   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8577   * @since 11
8578   */
8579  interface Range {
8580    /**
8581     * Minimum value.
8582     * @type { number }
8583     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8584     * @since 11
8585     */
8586    min: number;
8587
8588    /**
8589     * Maximum value.
8590     * @type { number }
8591     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8592     * @since 11
8593     */
8594    max: number;
8595  }
8596
8597  /**
8598   * Provides the media recorder profile definitions.
8599   *
8600   * @typedef AVRecorderProfile
8601   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8602   * @since 9
8603   */
8604  /**
8605   * Describes the audio and video recording profile.
8606   *
8607   * @typedef AVRecorderProfile
8608   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8609   * @crossplatform
8610   * @atomicservice
8611   * @since 12
8612   */
8613  interface AVRecorderProfile {
8614    /**
8615     * Indicates the audio bitrate.
8616     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8617     * @since 9
8618     */
8619    /**
8620     * Audio encoding bit rate. This parameter is mandatory for audio recording.<br>Supported bit rate ranges:
8621     * <br>- Range [32000 - 500000] for the AAC encoding format.<br>- Range [64000] for the G.711 μ-law encoding format.
8622     * <br>- Range [8000, 16000, 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, 192000,
8623     * 224000, 256000, 320000] for the MP3 encoding format.<br>When the MP3 encoding format is used,
8624     * the mapping between the sampling rate and bit rate is as follows:<br>- When the sampling rate is lower than
8625     * 16 kHZ, the bit rate range is [8000 - 64000].<br>- When the sampling rate ranges from 16 kHz to 32 kHz,
8626     * the bit rate range is [8000 - 160000].<br>- When the sampling rate is greater than 32 kHz, the bit rate range
8627     * is [32000 - 320000].<br>- Range [4750, 5150, 5900, 6700, 7400, 7950, 10200, 12200] for
8628     * the AMR-NB encoding format.<br>- Range [6600, 8850, 12650, 14250, 15850, 18250, 19850, 23050, 23850] for the
8629     * AMR-WB encoding format.<br>**Atomic service API**: This API can be used in atomic services since API version 12.
8630     * @type { ?number }
8631     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8632     * @crossplatform
8633     * @atomicservice
8634     * @since 12
8635     */
8636    audioBitrate?: number;
8637
8638    /**
8639     * Indicates the number of audio channels.
8640     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8641     * @since 9
8642     */
8643    /**
8644     * Number of audio channels. This parameter is mandatory for audio recording.<br>- Range [1 - 8] for the
8645     * AAC encoding format.<br>- Range [1] for the G.711 μ-law encoding format.<br>- Range [1 - 2] for the MP3 encoding
8646     * format.<br>- Range [1] for the AMR-NB and AMR-WB encoding formats.<br>**Atomic service API**: This API can be
8647     * used in atomic services since API version 12.
8648     * @type { ?number }
8649     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8650     * @crossplatform
8651     * @atomicservice
8652     * @since 12
8653     */
8654    audioChannels?: number;
8655
8656    /**
8657     * Indicates the audio encoding format.
8658     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8659     * @since 9
8660     */
8661    /**
8662     * Audio encoding format. This parameter is mandatory for audio recording. Currently, AUDIO_AAC, AUDIO_MP3,
8663     * AUDIO_G711MU, AUDIO_AMR_NB, and AUDIO_AMR_WB are supported.<br>**Atomic service API**: This API can be used in
8664     * atomic services since API version 12.
8665     * @type { ?CodecMimeType }
8666     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8667     * @crossplatform
8668     * @atomicservice
8669     * @since 12
8670     */
8671    audioCodec?: CodecMimeType;
8672
8673    /**
8674     * Indicates the audio sampling rate.
8675     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8676     * @since 9
8677     */
8678    /**
8679     * Audio sampling rate. This parameter is mandatory for audio recording.<br>Supported sampling rate ranges:
8680     * <br>- Range [8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000] for the AAC
8681     * encoding format.<br>- Range [8000] for the G.711 μ-law encoding format.<br>- Range [8000, 11025, 12000, 16000,
8682     * 22050, 24000, 32000, 44100, 48000] for the MP3 encoding format.<br>- Range [8000] for the AMR-NB encoding format.
8683     * <br>- Range [16000] for the AMR-WB encoding format.<br>Variable bit rate. The bit rate is for reference only.
8684     * <br>**Atomic service API**: This API can be used in atomic services since API version 12.
8685     * @type { ?number }
8686     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8687     * @crossplatform
8688     * @atomicservice
8689     * @since 12
8690     */
8691    audioSampleRate?: number;
8692
8693    /**
8694     * Indicates the output file format.
8695     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8696     * @since 9
8697     */
8698    /**
8699     * Container format of a file. This parameter is mandatory. Currently, the MP4, M4A, MP3, WAV, and AMR container
8700     * formats are supported. The AUDIO_MP3 encoding format cannot be used in the MP4 container format.<br>**Atomic
8701     * service API**: This API can be used in atomic services since API version 12.
8702     * @type { ContainerFormatType }
8703     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8704     * @crossplatform
8705     * @atomicservice
8706     * @since 12
8707     */
8708    fileFormat: ContainerFormatType;
8709
8710    /**
8711     * Indicates the video bitrate.
8712     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8713     * @since 9
8714     */
8715    /**
8716     * Video encoding bit rate. This parameter is mandatory for video recording. The value range is [10000 - 100000000].
8717     * @type { ?number }
8718     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8719     * @crossplatform
8720     * @since 12
8721     */
8722    videoBitrate?: number;
8723
8724    /**
8725     * Indicates the video encoding format.
8726     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8727     * @since 9
8728     */
8729    /**
8730     * Video encoding format. This parameter is mandatory for video recording. Currently, VIDEO_AVC is supported.
8731     * @type { ?CodecMimeType }
8732     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8733     * @crossplatform
8734     * @since 12
8735     */
8736    videoCodec?: CodecMimeType;
8737
8738    /**
8739     * Indicates the video width.
8740     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8741     * @since 9
8742     */
8743    /**
8744     * Width of a video frame. This parameter is mandatory for video recording. The value range is [176 - 4096].
8745     * @type { ?number }
8746     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8747     * @crossplatform
8748     * @since 12
8749     */
8750    videoFrameWidth?: number;
8751
8752    /**
8753     * Indicates the video height.
8754     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8755     * @since 9
8756     */
8757    /**
8758     * Height of a video frame. This parameter is mandatory for video recording. The value range is [144 - 4096].
8759     * @type { ?number }
8760     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8761     * @crossplatform
8762     * @since 12
8763     */
8764    videoFrameHeight?: number;
8765
8766    /**
8767     * Indicates the video frame rate.
8768     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8769     * @since 9
8770     */
8771    /**
8772     * Video frame rate. This parameter is mandatory for video recording. The value range is [1 - 60].
8773     * @type { ?number }
8774     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8775     * @crossplatform
8776     * @since 12
8777     */
8778    videoFrameRate?: number;
8779
8780    /**
8781     * Whether to record HDR video.
8782     * @type { ?boolean }
8783     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8784     * @since 11
8785     */
8786    /**
8787     * HDR encoding. This parameter is optional for video recording. The default value is **false**, and there is no
8788     * requirement on the encoding format. When **isHdr** is set to **true**, the encoding format must be **video/hevc**.
8789     * @type { ?boolean }
8790     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8791     * @crossplatform
8792     * @since 12
8793     */
8794    isHdr?: boolean;
8795
8796    /**
8797     * Whether temporal layered encoding is supported. This parameter is optional for video recording. The default value
8798     * is **false**. If this parameter is set to **true**, some frames in the video output streams can be skipped
8799     * without being encoded.
8800     * @type { ?boolean }
8801     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8802     * @crossplatform
8803     * @since 12
8804     */
8805    enableTemporalScale?: boolean;
8806
8807    /**
8808     * Whether to enable video encoding policy to quality stable encoding.
8809     * @type { ?boolean }
8810     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8811     * @systemapi
8812     * @since 18
8813     */
8814    enableStableQualityMode?: boolean
8815
8816    /**
8817     * Indicates whether enable B Frame. Default is disabled.
8818     * @type { ?boolean }
8819     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8820     * @since 20
8821     */
8822    enableBFrame?: boolean
8823  }
8824
8825  /**
8826   * Provides the media recorder configuration definitions.
8827   *
8828   * @typedef AVRecorderConfig
8829   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8830   * @since 9
8831   */
8832  /**
8833   * Describes the audio and video recording parameters.
8834   *
8835   * The **audioSourceType** and **videoSourceType** parameters are used to distinguish audio-only recording,
8836   * video-only recording, and audio and video recording. For audio-only recording, set only **audioSourceType**.
8837   * For video-only recording, set only **videoSourceType**. For audio and video recording, set both **audioSourceType**
8838   * and **videoSourceType**.
8839   *
8840   * @typedef AVRecorderConfig
8841   * @syscap SystemCapability.Multimedia.Media.AVRecorder
8842   * @crossplatform
8843   * @atomicservice
8844   * @since 12
8845   */
8846  interface AVRecorderConfig {
8847    /**
8848     * Audio source type, details see @AudioSourceType .
8849     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8850     * @since 9
8851     */
8852    /**
8853     * Type of the audio source to record. This parameter is mandatory for audio recording.<br>**Atomic service API**:
8854     * This API can be used in atomic services since API version 12.
8855     * @type { ?AudioSourceType }
8856     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8857     * @crossplatform
8858     * @atomicservice
8859     * @since 12
8860     */
8861    audioSourceType?: AudioSourceType;
8862    /**
8863     * Video source type, details see @VideoSourceType .
8864     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8865     * @since 9
8866     */
8867    /**
8868     * Type of the video source to record. This parameter is mandatory for video recording.
8869     * @type { ?VideoSourceType }
8870     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8871     * @crossplatform
8872     * @since 12
8873     */
8874    videoSourceType?: VideoSourceType;
8875    /**
8876     * Meta source types, details see @MetaSourceType .
8877     * @type { ?Array<MetaSourceType> }
8878     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8879     * @systemapi
8880     * @since 12
8881     */
8882    metaSourceTypes?: Array<MetaSourceType>;
8883    /**
8884     * Video recorder profile, details see @AVRecorderProfile .
8885     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8886     * @since 9
8887     */
8888    /**
8889     * Recording profile. This parameter is mandatory.<br>**Atomic service API**: This API can be used in atomic
8890     * services since API version 12.
8891     * @type { AVRecorderProfile }
8892     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8893     * @crossplatform
8894     * @atomicservice
8895     * @since 12
8896     */
8897    profile: AVRecorderProfile;
8898    /**
8899     * File output uri, support a kind of uri now.
8900     * format like: "fd://" + "context".
8901     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8902     * @since 9
8903     */
8904    /**
8905     * Recording output URL: fd://xx (fd number).<br>This parameter is mandatory.<br>**Atomic service API**:
8906     * This API can be used in atomic services since API version 12.
8907     * @type { string }
8908     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8909     * @crossplatform
8910     * @atomicservice
8911     * @since 12
8912     */
8913    url: string;
8914
8915    /**
8916     * Mode for creating the file, which is used together with on('photoAssetAvailable').
8917     * @type { ?FileGenerationMode }
8918     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8919     * @since 12
8920     */
8921    fileGenerationMode?: FileGenerationMode;
8922    /**
8923     * Rotation angle of the recorded video. The value can be 0 (default), 90, 180, or 270 for MP4 videos.<br>This API
8924     * is supported since API version 6 and deprecated since API version 12. You are advised to use
8925     * **AVMetadata.videoOrientation** instead. If both parameters are set, **AVMetadata.videoOrientation** is used.
8926     * @type { ?number }
8927     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8928     * @since 9
8929     * @deprecated since 12
8930     * @useinstead ohos.multimedia.media/media.AVMetadata#videoOrientation
8931     */
8932    rotation?: number;
8933    /**
8934     * Geographical location of the recorded video. By default, the geographical location information is not recorded.
8935     * <br>This API is supported since API version 6 and deprecated since API version 12. You are advised to use
8936     * **AVMetadata.location** instead. If both parameters are set, **AVMetadata.location** is used.
8937     * @type { ?Location }
8938     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8939     * @since 9
8940     * @deprecated since 12
8941     * @useinstead ohos.multimedia.media/media.AVMetadata#location
8942     */
8943    location?: Location;
8944    /**
8945     * Metadata. For details, see @AVMetadata.
8946     * @type { ?AVMetadata }
8947     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8948     * @since 12
8949     */
8950    metadata?: AVMetadata;
8951    /**
8952     * Maximum recording duration, in seconds. The value range is [1, 2^31-1]. If an invalid value is provided,
8953     * it is reset to the maximum allowed duration. Once the recording reaches the specified duration,
8954     * it stops automatically and notifies via the **stateChange** callback that the recording has stopped:
8955     * AVRecorderState = 'stopped', StateChangeReason = BACKGROUND.
8956     * @type { ?number }
8957     * @syscap SystemCapability.Multimedia.Media.AVRecorder
8958     * @since 18
8959     */
8960    maxDuration?: number;
8961  }
8962
8963  /**
8964   * Provides the container definition for media description key-value pairs.
8965   *
8966   * @typedef MediaDescription
8967   * @syscap SystemCapability.Multimedia.Media.Core
8968   * @since 8
8969   */
8970  /**
8971   * Provides the container definition for media description key-value pairs.
8972   *
8973   * @typedef MediaDescription
8974   * @syscap SystemCapability.Multimedia.Media.Core
8975   * @atomicservice
8976   * @since 11
8977   */
8978  /**
8979   * Provides the container definition for media description key-value pairs.
8980   *
8981   * @typedef MediaDescription
8982   * @syscap SystemCapability.Multimedia.Media.Core
8983   * @crossplatform
8984   * @atomicservice
8985   * @since 12
8986   */
8987  interface MediaDescription {
8988    /**
8989     * key:value pair, key see @MediaDescriptionKey .
8990     * @syscap SystemCapability.Multimedia.Media.Core
8991     * @since 8
8992     */
8993    /**
8994     * key:value pair, key see @MediaDescriptionKey .
8995     * @syscap SystemCapability.Multimedia.Media.Core
8996     * @atomicservice
8997     * @since 11
8998     */
8999    /**
9000     * key:value pair, key see @MediaDescriptionKey .
9001     * @syscap SystemCapability.Multimedia.Media.Core
9002     * @crossplatform
9003     * @atomicservice
9004     * @since 12
9005     */
9006    [key: string]: Object;
9007  }
9008
9009  /**
9010   * Enumerates seek mode.
9011   *
9012   * @enum { number }
9013   * @syscap SystemCapability.Multimedia.Media.Core
9014   * @since 8
9015   */
9016  /**
9017   * Enumerates seek mode.
9018   *
9019   * @enum { number }
9020   * @syscap SystemCapability.Multimedia.Media.Core
9021   * @atomicservice
9022   * @since 11
9023   */
9024  /**
9025   * Enumerates seek mode.
9026   *
9027   * @enum { number }
9028   * @syscap SystemCapability.Multimedia.Media.Core
9029   * @crossplatform
9030   * @atomicservice
9031   * @since 12
9032   */
9033  enum SeekMode {
9034    /**
9035     * seek to the next sync frame of the given timestamp
9036     * @syscap SystemCapability.Multimedia.Media.Core
9037     * @since 8
9038     */
9039    /**
9040     * seek to the next sync frame of the given timestamp
9041     * @syscap SystemCapability.Multimedia.Media.Core
9042     * @atomicservice
9043     * @since 11
9044     */
9045    /**
9046     * seek to the next sync frame of the given timestamp
9047     * @syscap SystemCapability.Multimedia.Media.Core
9048     * @crossplatform
9049     * @atomicservice
9050     * @since 12
9051     */
9052    SEEK_NEXT_SYNC = 0,
9053    /**
9054     * seek to the previous sync frame of the given timestamp
9055     * @syscap SystemCapability.Multimedia.Media.Core
9056     * @since 8
9057     */
9058    /**
9059     * seek to the previous sync frame of the given timestamp
9060     * @syscap SystemCapability.Multimedia.Media.Core
9061     * @atomicservice
9062     * @since 11
9063     */
9064    /**
9065     * seek to the previous sync frame of the given timestamp
9066     * @syscap SystemCapability.Multimedia.Media.Core
9067     * @crossplatform
9068     * @atomicservice
9069     * @since 12
9070     */
9071    SEEK_PREV_SYNC = 1,
9072    /**
9073     * Seek to the closest frame of the given timestamp.
9074     * @syscap SystemCapability.Multimedia.Media.Core
9075     * @atomicservice
9076     * @since 12
9077     */
9078    SEEK_CLOSEST = 2,
9079    /**
9080     * Seek in continuous mode.
9081     * Seek continuous can provide a smoother dragging experience, but the device needs to support
9082     * the current stream to execute seek continuous. Before calling seek continuous,
9083     * check whether it is supported, see {@link #isSeekContinuousSupported}.
9084     * If an unsupported scenario occurs, seek continuous will report an error({@link #AVERR_SEEK_CONTINUOUS_UNSUPPORTED})
9085     * through the on error callback.
9086     * @syscap SystemCapability.Multimedia.Media.Core
9087     * @atomicservice
9088     * @since 18
9089     */
9090    SEEK_CONTINUOUS = 3,
9091  }
9092
9093  /**
9094   * Enumerates switch mode.
9095   *
9096   * @enum { number }
9097   * @syscap SystemCapability.Multimedia.Media.Core
9098   * @crossplatform
9099   * @atomicservice
9100   * @since 12
9101   */
9102  enum SwitchMode {
9103    /**
9104     * switch to the next sync frame of the given timestamp
9105     * @syscap SystemCapability.Multimedia.Media.Core
9106     * @crossplatform
9107     * @atomicservice
9108     * @since 12
9109     */
9110    SMOOTH = 0,
9111    /**
9112     * switch to the previous sync frame of the given timestamp
9113     * @syscap SystemCapability.Multimedia.Media.Core
9114     * @crossplatform
9115     * @atomicservice
9116     * @since 12
9117     */
9118    SEGMENT = 1,
9119    /**
9120     * switch to the closest frame of the given timestamp.
9121     * @syscap SystemCapability.Multimedia.Media.Core
9122     * @atomicservice
9123     * @since 12
9124     */
9125    CLOSEST = 2,
9126  }
9127
9128  /**
9129   * Enumerates Codec MIME types.
9130   *
9131   * @enum { string }
9132   * @syscap SystemCapability.Multimedia.Media.Core
9133   * @since 8
9134   */
9135  /**
9136   * Enumerates Codec MIME types.
9137   *
9138   * @enum { string }
9139   * @syscap SystemCapability.Multimedia.Media.Core
9140   * @crossplatform
9141   * @atomicservice
9142   * @since 12
9143   */
9144  enum CodecMimeType {
9145    /**
9146     * H.263 codec MIME type.
9147     * @syscap SystemCapability.Multimedia.Media.Core
9148     * @since 8
9149     */
9150    /**
9151     * H.263 codec MIME type.
9152     * @syscap SystemCapability.Multimedia.Media.Core
9153     * @crossplatform
9154     * @since 12
9155     */
9156    VIDEO_H263 = 'video/h263',
9157    /**
9158     * H.264 codec MIME type.
9159     * @syscap SystemCapability.Multimedia.Media.Core
9160     * @since 8
9161     */
9162    /**
9163     * H.264 codec MIME type.
9164     * @syscap SystemCapability.Multimedia.Media.Core
9165     * @crossplatform
9166     * @since 12
9167     */
9168    VIDEO_AVC = 'video/avc',
9169    /**
9170     * MPEG2 codec MIME type.
9171     * @syscap SystemCapability.Multimedia.Media.Core
9172     * @since 8
9173     */
9174    /**
9175     * MPEG2 codec MIME type.
9176     * @syscap SystemCapability.Multimedia.Media.Core
9177     * @crossplatform
9178     * @since 12
9179     */
9180    VIDEO_MPEG2 = 'video/mpeg2',
9181    /**
9182     * MPEG4 codec MIME type
9183     * @syscap SystemCapability.Multimedia.Media.Core
9184     * @since 8
9185     */
9186    /**
9187     * MPEG4 codec MIME type
9188     * @syscap SystemCapability.Multimedia.Media.Core
9189     * @crossplatform
9190     * @since 12
9191     */
9192    VIDEO_MPEG4 = 'video/mp4v-es',
9193
9194    /**
9195     * VP8 codec MIME type
9196     * @syscap SystemCapability.Multimedia.Media.Core
9197     * @since 8
9198     */
9199    /**
9200     * VP8 codec MIME type
9201     * @syscap SystemCapability.Multimedia.Media.Core
9202     * @crossplatform
9203     * @since 12
9204     */
9205    VIDEO_VP8 = 'video/x-vnd.on2.vp8',
9206
9207    /**
9208     * AAC codec MIME type.
9209     * @syscap SystemCapability.Multimedia.Media.Core
9210     * @since 8
9211     */
9212    /**
9213     * AAC codec MIME type.
9214     * @syscap SystemCapability.Multimedia.Media.Core
9215     * @crossplatform
9216     * @atomicservice
9217     * @since 12
9218     */
9219    AUDIO_AAC = 'audio/mp4a-latm',
9220
9221    /**
9222     * vorbis codec MIME type.
9223     * @syscap SystemCapability.Multimedia.Media.Core
9224     * @since 8
9225     */
9226    /**
9227     * vorbis codec MIME type.
9228     * @syscap SystemCapability.Multimedia.Media.Core
9229     * @crossplatform
9230     * @since 12
9231     */
9232    AUDIO_VORBIS = 'audio/vorbis',
9233
9234    /**
9235     * flac codec MIME type.
9236     * @syscap SystemCapability.Multimedia.Media.Core
9237     * @since 8
9238     */
9239    /**
9240     * flac codec MIME type.
9241     * @syscap SystemCapability.Multimedia.Media.Core
9242     * @crossplatform
9243     * @since 12
9244     */
9245    AUDIO_FLAC = 'audio/flac',
9246
9247    /**
9248     * H.265 codec MIME type.
9249     * @syscap SystemCapability.Multimedia.Media.Core
9250     * @since 11
9251     */
9252    /**
9253     * H.265 codec MIME type.
9254     * @syscap SystemCapability.Multimedia.Media.Core
9255     * @crossplatform
9256     * @since 12
9257     */
9258    VIDEO_HEVC = 'video/hevc',
9259    /**
9260     * mp3 codec MIME type.
9261     * @syscap SystemCapability.Multimedia.Media.Core
9262     * @since 12
9263     */
9264    AUDIO_MP3 = 'audio/mpeg',
9265    /**
9266     * G711-mulaw codec MIME type.
9267     * @syscap SystemCapability.Multimedia.Media.Core
9268     * @since 12
9269     */
9270    AUDIO_G711MU = 'audio/g711mu',
9271    /**
9272     * AMR_NB codec MIME type.
9273     * @syscap SystemCapability.Multimedia.Media.Core
9274     * @since 18
9275     */
9276    AUDIO_AMR_NB = 'audio/3gpp',
9277    /**
9278     * AMR_WB codec MIME type.
9279     * @syscap SystemCapability.Multimedia.Media.Core
9280     * @since 18
9281     */
9282    AUDIO_AMR_WB = 'audio/amr-wb',
9283  }
9284
9285  /**
9286   *  Enumerates the encoding and container formats used during screen capture.
9287   *
9288   * @enum { number }
9289   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9290   * @since 12
9291   */
9292  enum AVScreenCaptureRecordPreset {
9293    /**
9294     * The H.264 video encoding format, AAC audio encoding format, and MP4 container format are used.
9295     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9296     * @since 12
9297     */
9298    SCREEN_RECORD_PRESET_H264_AAC_MP4 = 0,
9299    /**
9300     * The H.265 video encoding format, AAC audio encoding format, and MP4 container format are used.
9301     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9302     * @since 12
9303     */
9304    SCREEN_RECORD_PRESET_H265_AAC_MP4 = 1,
9305  }
9306
9307  /**
9308   *  Enumerates the video fill modes during screen capture.
9309   *
9310   * @enum { number }
9311   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9312   * @since 18
9313   */
9314  enum AVScreenCaptureFillMode {
9315    /**
9316     * Keeps the original aspect ratio, matching the aspect ratio of the physical screen.
9317     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9318     * @since 18
9319     */
9320    PRESERVE_ASPECT_RATIO = 0,
9321    /**
9322     * Stretches the image to fit the specified dimensions.
9323     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9324     * @since 18
9325     */
9326    SCALE_TO_FILL = 1,
9327  }
9328
9329  /**
9330   *  Enumerates the screen capture states used in callbacks.
9331   *
9332   * @enum { number }
9333   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9334   * @since 12
9335   */
9336  enum AVScreenCaptureStateCode {
9337    /**
9338     * Screen capture is started.
9339     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9340     * @since 12
9341     */
9342    SCREENCAPTURE_STATE_STARTED = 0,
9343    /**
9344     * Screen capture is canceled.
9345     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9346     * @since 12
9347     */
9348    SCREENCAPTURE_STATE_CANCELED = 1,
9349    /**
9350     * Screen capture is manually stopped by the user.
9351     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9352     * @since 12
9353     */
9354    SCREENCAPTURE_STATE_STOPPED_BY_USER = 2,
9355    /**
9356     * Screen capture is interrupted by another screen capture.
9357     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9358     * @since 12
9359     */
9360    SCREENCAPTURE_STATE_INTERRUPTED_BY_OTHER = 3,
9361    /**
9362     * Screen capture is interrupted by an incoming call.
9363     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9364     * @since 12
9365     */
9366    SCREENCAPTURE_STATE_STOPPED_BY_CALL = 4,
9367    /**
9368     * The microphone is unavailable during screen capture.
9369     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9370     * @since 12
9371     */
9372    SCREENCAPTURE_STATE_MIC_UNAVAILABLE = 5,
9373    /**
9374     * The microphone is muted by the user.
9375     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9376     * @since 12
9377     */
9378    SCREENCAPTURE_STATE_MIC_MUTED_BY_USER = 6,
9379    /**
9380     * The microphone is unmuted by the user.
9381     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9382     * @since 12
9383     */
9384    SCREENCAPTURE_STATE_MIC_UNMUTED_BY_USER = 7,
9385    /**
9386     * The system enters a privacy page during screen capture.
9387     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9388     * @since 12
9389     */
9390    SCREENCAPTURE_STATE_ENTER_PRIVATE_SCENE = 8,
9391    /**
9392     * The system exits a privacy page during screen capture.
9393     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9394     * @since 12
9395     */
9396    SCREENCAPTURE_STATE_EXIT_PRIVATE_SCENE = 9,
9397    /**
9398     * Screen capture is interrupted by system user switchover.
9399     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9400     * @since 12
9401     */
9402    SCREENCAPTURE_STATE_STOPPED_BY_USER_SWITCHES = 10,
9403  }
9404
9405  /**
9406   * Provides the media AVScreenCaptureStrategy definition.
9407   *
9408   * @typedef AVScreenCaptureStrategy
9409   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9410   * @since 20
9411   */
9412  interface AVScreenCaptureStrategy {
9413    /**
9414     * Defines whether to enable device-level content recording
9415     * @type { ?boolean } Record according to the display device where the logical screen is located if set True
9416     * @default false
9417     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9418     * @systemapi
9419     * @since 20
9420     */
9421    enableDeviceLevelCapture?: boolean;
9422
9423    /**
9424     * Allows starting or maintaining screen capture during a call
9425     * @type { ?boolean } The default value is false,
9426     * which means that the recording is ended during the call or the recording cannot be initiated.
9427     * @default {false} [Required if provided]
9428     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9429     * @since 20
9430     */
9431    keepCaptureDuringCall?: boolean;
9432
9433    /**
9434     * Indicates whether to enable B-frame encoding, whitch is used to reduce the size of the recorded file.
9435     * @type { ?boolean } The default value is false, which means B frames encoding are disabled.
9436     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9437     * @since 20
9438     */
9439    enableBFrame?: boolean;
9440  }
9441
9442  /**
9443   * Defines the screen capture parameters.
9444   *
9445   * @typedef AVScreenCaptureRecordConfig
9446   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9447   * @since 12
9448   */
9449  interface AVScreenCaptureRecordConfig {
9450    /**
9451     * FD of the file output.
9452     * @type { number }
9453     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9454     * @since 12
9455     */
9456    fd: number;
9457    /**
9458     * Video width, in px. The default value varies according to the display in use.
9459     * @type { ?number }
9460     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9461     * @since 12
9462     */
9463    frameWidth?: number;
9464    /**
9465     * Video height, in px. The default value varies according to the display in use.
9466     * @type { ?number }
9467     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9468     * @since 12
9469     */
9470    frameHeight?: number;
9471    /**
9472     * Video bit rate. The default value is **10000000**.
9473     * @type { ?number }
9474     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9475     * @since 12
9476     */
9477    videoBitrate?: number;
9478    /**
9479     * Audio sampling rate. This value is used for both internal capture and external capture (using microphones).
9480     * Only **48000** (default value) and **16000** are supported.
9481     * @type { ?number }
9482     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9483     * @since 12
9484     */
9485    audioSampleRate?: number;
9486    /**
9487     * Number of audio channels. This value is used for both internal capture and external capture (using microphones).
9488     * Only **1** and **2** (default) are supported.
9489     * @type { ?number }
9490     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9491     * @since 12
9492     */
9493    audioChannelCount?: number;
9494    /**
9495     * Audio bit rate. This value is used for both internal capture and external capture (using microphones).
9496     * The default value is **96000**.
9497     * @type { ?number }
9498     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9499     * @since 12
9500     */
9501    audioBitrate?: number;
9502    /**
9503     * Encoding and container format used. The default value is **SCREEN_RECORD_PRESET_H264_AAC_MP4**.
9504     * @type { ?AVScreenCaptureRecordPreset }
9505     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9506     * @since 12
9507     */
9508    preset?: AVScreenCaptureRecordPreset;
9509    /**
9510     * ID of the display used for screen capture. By default, the main screen is captured.
9511     * @type { ?number }
9512     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9513     * @since 15
9514     */
9515    displayId?: number;
9516    /**
9517     * Video fill mode during screen capture.
9518     * @type { ?AVScreenCaptureFillMode }
9519     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9520     * @since 18
9521     */
9522    fillMode?: AVScreenCaptureFillMode;
9523    /**
9524     * Screen Capture Policy Configuration Fields
9525     * @type { ?AVScreenCaptureStrategy } Screen capture policy configuration values
9526     * @default {default value of the property} [Required if provided]
9527     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9528     * @since 20
9529     */
9530    strategy?: AVScreenCaptureStrategy;
9531  }
9532
9533  /**
9534   * Provides APIs to manage screen capture. Before calling any API in **AVScreenCaptureRecorder**,
9535   * you must use createAVScreenCaptureRecorder() to create an **AVScreenCaptureRecorder** instance.
9536   *
9537   * @typedef AVScreenCaptureRecorder
9538   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9539   * @since 12
9540   */
9541  interface AVScreenCaptureRecorder {
9542    /**
9543     * Initializes screen capture and sets screen capture parameters. This API uses a promise to return the result.
9544     * @param { AVScreenCaptureRecordConfig } config - Screen capture parameters to set.
9545     * @returns { Promise<void> } Promise that returns no value.
9546     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
9547     * <br>2. Incorrect parameter types. 3. Parameter verification failed. Return by promise.
9548     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9549     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9550     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9551     * @since 12
9552     * @example
9553     * import { BusinessError } from '@kit.BasicServicesKit';
9554     *
9555     * let avCaptureConfig: media.AVScreenCaptureRecordConfig = {
9556     *     fd: 0, // Before passing in an FD to this parameter, the file must be created by the caller and granted with the write permissions.
9557     *     frameWidth: 640,
9558     *     frameHeight: 480
9559     *     // Add other parameters.
9560     * }
9561     *
9562     * avScreenCaptureRecorder.init(avCaptureConfig).then(() => {
9563     *     console.info('Succeeded in initing avScreenCaptureRecorder');
9564     * }).catch((err: BusinessError) => {
9565     *     console.info('Failed to init avScreenCaptureRecorder, error: ' + err.message);
9566     * })
9567     */
9568    init(config: AVScreenCaptureRecordConfig): Promise<void>;
9569
9570    /**
9571     * Starts screen capture. This API uses a promise to return the result.
9572     * @returns { Promise<void> } Promise that returns no value.
9573     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9574     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9575     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9576     * @since 12
9577     * @example
9578     * import { BusinessError } from '@kit.BasicServicesKit';
9579     *
9580     * avScreenCaptureRecorder.startRecording().then(() => {
9581     *     console.info('Succeeded in starting avScreenCaptureRecorder');
9582     * }).catch((err: BusinessError) => {
9583     *     console.info('Failed to start avScreenCaptureRecorder, error: ' + err.message);
9584     * })
9585     */
9586    startRecording(): Promise<void>;
9587
9588    /**
9589     * Stops screen capture. This API uses a promise to return the result.
9590     * @returns { Promise<void> } Promise that returns no value.
9591     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9592     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9593     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9594     * @since 12
9595     * @example
9596     * import { BusinessError } from '@kit.BasicServicesKit';
9597     *
9598     * avScreenCaptureRecorder.stopRecording().then(() => {
9599     *     console.info('Succeeded in stopping avScreenCaptureRecorder');
9600     * }).catch((err: BusinessError) => {
9601     *     console.info('Failed to stop avScreenCaptureRecorder, error: ' + err.message);
9602     * })
9603     */
9604    stopRecording(): Promise<void>;
9605
9606    /**
9607     * During screen capture, the application can exempt its privacy windows from security purposes.
9608     * This API uses a promise to return the result.
9609     * For example, if a user enters a password in this application during screen capture,
9610     * the application will not display a black screen.
9611     * @param { Array<number> } windowIDs - IDs of windows that require privacy exemption, including the main window
9612     * IDs and subwindow IDs. For details about how to obtain window properties.
9613     * @returns { Promise<void> } Promise used to return the window IDs.
9614     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9615     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9616     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9617     * @since 12
9618     * @example
9619     * import { BusinessError } from '@kit.BasicServicesKit';
9620     *
9621     * let windowIDs = [];
9622     * avScreenCaptureRecorder.skipPrivacyMode(windowIDs).then(() => {
9623     *     console.info('Succeeded in skipping privacy mode');
9624     * }).catch((err: BusinessError) => {
9625     *     console.info('Failed to skip privacy mode, error: ' + err.message);
9626     * })
9627     */
9628    skipPrivacyMode(windowIDs: Array<number>): Promise<void>;
9629
9630    /**
9631     * Enables or disables the microphone. This API uses a promise to return the result.
9632     * @param { boolean } enable - Whether to enable or disable the microphone. The value **true** means to enable
9633     * the microphone, and **false** means the opposite.
9634     * @returns { Promise<void> } Promise that returns no value.
9635     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9636     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9637     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9638     * @since 12
9639     * @example
9640     * import { BusinessError } from '@kit.BasicServicesKit';
9641     *
9642     * avScreenCaptureRecorder.setMicEnabled(true).then(() => {
9643     *     console.info('Succeeded in setMicEnabled avScreenCaptureRecorder');
9644     * }).catch((err: BusinessError) => {
9645     *     console.info('Failed to setMicEnabled avScreenCaptureRecorder, error: ' + err.message);
9646     * })
9647     */
9648    setMicEnabled(enable: boolean): Promise<void>;
9649
9650    /**
9651     * Releases this **AVScreenCaptureRecorder** instance. This API uses a promise to return the result.
9652     * @returns { Promise<void> } Promise that returns no value.
9653     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9654     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9655     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9656     * @since 12
9657     * @example
9658     * import { BusinessError } from '@kit.BasicServicesKit';
9659     *
9660     * avScreenCaptureRecorder.release().then(() => {
9661     *     console.info('Succeeded in releasing avScreenCaptureRecorder');
9662     * }).catch((err: BusinessError) => {
9663     *     console.info('Faile to release avScreenCaptureRecorder, error: ' + err.message);
9664     * })
9665     */
9666    release(): Promise<void>;
9667
9668    /**
9669     * Subscribes to screen capture state changes. An application can subscribe to only one screen capture
9670     * state change event. When the application initiates multiple subscriptions to this event,
9671     * the last subscription is applied.
9672     * @param { 'stateChange' } type - Event type, which is **'stateChange'** in this case.
9673     * @param { Callback<AVScreenCaptureStateCode> } callback - Callback invoked when the event is triggered.
9674     * AVScreenCaptureStateCode indicates the new state.
9675     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9676     * @since 12
9677     * @example
9678     * avScreenCaptureRecorder.on('stateChange', (state: media.AVScreenCaptureStateCode) => {
9679     *     console.info('avScreenCaptureRecorder stateChange to ' + state);
9680     * })
9681     */
9682    on(type: 'stateChange', callback: Callback<AVScreenCaptureStateCode>): void;
9683
9684    /**
9685     * Subscribes to AVScreenCaptureRecorder errors. You can handle the errors based on the application logic.
9686     * An application can subscribe to only one AVScreenCaptureRecorder error event.
9687     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
9688     * @param { 'error' } type - Event type, which is **'error'** in this case.
9689     * @param { ErrorCallback } callback - Callback invoked when the event is triggered.
9690     * @throws { BusinessError } 201 - permission denied.
9691     * @throws { BusinessError } 5400103 - IO error. Return by ErrorCallback.
9692     * @throws { BusinessError } 5400105 - Service died. Return by ErrorCallback.
9693     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9694     * @since 12
9695     * @example
9696     * avScreenCaptureRecorder.on('error', (err: BusinessError) => {
9697     *     console.error('avScreenCaptureRecorder error:' + err.message);
9698     * })
9699     */
9700    on(type: 'error', callback: ErrorCallback): void;
9701
9702    /**
9703     * Unsubscribes from screen capture state changes. You can specify a callback to cancel the specified subscription.
9704     * @param { 'stateChange' } type - Event type, which is **'stateChange'** in this case.
9705     * @param { Callback<AVScreenCaptureStateCode> } callback - Callback used for unsubscription.
9706     * AVScreenCaptureStateCode indicates the new state. If this parameter is not specified,
9707     * the last subscription is canceled.
9708     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9709     * @since 12
9710     * @example
9711     * avScreenCaptureRecorder.off('stateChange');
9712     */
9713    off(type: 'stateChange', callback?: Callback<AVScreenCaptureStateCode>): void;
9714
9715    /**
9716     * Unsubscribes from AVScreenCaptureRecorder errors. You can specify a callback to cancel
9717     * the specified subscription.
9718     * @param { 'error' } type - Event type, which is **'error'** in this case.
9719     * @param { ErrorCallback } callback - Callback used for unsubscription. If this parameter is not specified,
9720     * the last subscription is canceled.
9721     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
9722     * @since 12
9723     * @example
9724     * avScreenCaptureRecorder.off('error');
9725     */
9726    off(type: 'error', callback?: ErrorCallback): void;
9727  }
9728
9729  /**
9730   * Describes the video transcoding parameters.
9731   *
9732   * @typedef AVTranscoderConfig
9733   * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9734   * @since 12
9735   */
9736  interface AVTranscoderConfig {
9737    /**
9738     * Bitrate of the output audio, in bit/s. The value range is [1-500000]. The default value is 48 kbit/s.
9739     * @type { ?number }
9740     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9741     * @since 12
9742     */
9743    audioBitrate?: number;
9744
9745    /**
9746     * Encoding format of the output audio. Currently, only AAC is supported. The default value is **AAC**.
9747     * @type { ?CodecMimeType }
9748     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9749     * @since 12
9750     */
9751    audioCodec?: CodecMimeType;
9752
9753    /**
9754     * Container format of the output video file. Currently, only MP4 is supported.
9755     * @type { ContainerFormatType }
9756     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9757     * @since 12
9758     */
9759    fileFormat: ContainerFormatType;
9760
9761    /**
9762     * Bitrate of the output video, in bit/s. The default bitrate depends on the resolution of the output video.
9763     * The default bitrate is 1 Mbit/s for the resolution in the range [240p, 480P],
9764     * 2 Mbit/s for the range (480P,720P], 4 Mbit/s for the range (720P,1080P], and 8 Mbit/s for 1080p or higher.
9765     * @type { ?number }
9766     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9767     * @since 12
9768     */
9769    videoBitrate?: number;
9770
9771    /**
9772     * Encoding format of the output video. Currently, only AVC and HEVC are supported.
9773     * If the source video is in HEVC format, the default value is **HEVC**. Otherwise, the default value is **AVC**.
9774     * @type { ?CodecMimeType }
9775     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9776     * @since 12
9777     */
9778    videoCodec?: CodecMimeType;
9779
9780    /**
9781     * Width of the output video frame, in px. The value range is [240 - 3840].
9782     * The default value is the width of the source video frame.
9783     * @type { ?number }
9784     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9785     * @since 12
9786     */
9787    videoFrameWidth?: number;
9788
9789    /**
9790     * Height of the output video frame, in px. The value range is [240 - 2160].
9791     * The default value is the height of the source video frame.
9792     * @type { ?number }
9793     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9794     * @since 12
9795     */
9796    videoFrameHeight?: number;
9797
9798    /**
9799     * Indicates whether to enable B Frame Encoding for reduce file size.
9800     * @type { ?boolean } The default value is false, which means B frame encoding cannot be enabled.
9801     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9802     * @since 20
9803     */
9804    enableBFrame?: boolean;
9805  }
9806
9807  /**
9808   * A transcoding management class that provides APIs to transcode videos. Before calling any API in **AVTranscoder**,
9809   * you must use [createAVTranscoder()]{@link #createAVTranscoder} to create an **AVTranscoder** instance.
9810   *
9811   * @typedef AVTranscoder
9812   * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9813   * @since 12
9814   */
9815  interface AVTranscoder {
9816    /**
9817     * Source media file descriptor, which specifies the data source.
9818     *
9819     * **Example:**
9820     *
9821     * There is a media file that stores continuous assets, the address offset is 0, and the byte length is 100.
9822     * Its file descriptor is **AVFileDescriptor { fd = resourceHandle; offset = 0; length = 100; }**.
9823     *
9824     * **NOTE**
9825     * - After the resource handle (FD) is transferred to an **AVTranscoder** instance, do not use the resource handle
9826     * to perform other read and write operations, including but not limited to transferring this handle to other
9827     * **AVPlayer**, **AVMetadataExtractor**, **AVImageGenerator**, or **AVTranscoder** instance.
9828     * Competition occurs when multiple **AVTranscoders** use the same resource handle to read and write files
9829     * at the same time, resulting in errors in obtaining data.
9830     * @type { AVFileDescriptor }
9831     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9832     * @since 12
9833     */
9834    fdSrc: AVFileDescriptor;
9835
9836    /**
9837     * Destination media file descriptor, which specifies the data source. After creating an **AVTranscoder** instance,
9838     * you must set both **fdSrc** and **fdDst**.
9839     *
9840     * **NOTE**
9841     * - After the resource handle (FD) is transferred to an **AVTranscoder** instance, do not use the resource handle
9842     * to perform other read and write operations, including but not limited to transferring this handle to other
9843     * **AVPlayer**, **AVMetadataExtractor**, **AVImageGenerator**, or **AVTranscoder** instance.
9844     * Competition occurs when multiple AVTranscoders use the same resource handle to read and write files
9845     * at the same time, resulting in errors in obtaining data.
9846     * @type { number }
9847     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9848     * @since 12
9849     */
9850    fdDst: number;
9851
9852    /**
9853     * Sets video transcoding parameters. This API uses a promise to return the result.
9854     * @param { AVTranscoderConfig } config - Video transcoding parameters to set.
9855     * @returns { Promise<void> } Promise that returns no value.
9856     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
9857     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
9858     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9859     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9860     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
9861     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9862     * @since 12
9863     */
9864    prepare(config: AVTranscoderConfig): Promise<void>;
9865
9866    /**
9867     * Starts transcoding. This API uses a promise to return the result.
9868     *
9869     * This API can be called only after the [prepare()]{@link AVTranscoder.prepare} API is called.
9870     * @returns { Promise<void> } Promise that returns no value.
9871     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
9872     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9873     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9874     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9875     * @since 12
9876     */
9877    start(): Promise<void>;
9878
9879    /**
9880     * Pauses transcoding. This API uses a promise to return the result.
9881     *
9882     * This API can be called only after the [start()]{@link AVTranscoder.start} API is called.
9883     * You can call [resume()]{@link AVTranscoder.resume} to resume transcoding.
9884     * @returns { Promise<void> } Promise that returns no value.
9885     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
9886     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9887     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9888     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9889     * @since 12
9890     */
9891    pause(): Promise<void>;
9892
9893    /**
9894     * Resumes transcoding. This API uses a promise to return the result.
9895     *
9896     * This API can be called only after the [pause()]{@link AVTranscoder.pause} API is called.
9897     * @returns { Promise<void> } Promise that returns no value.
9898     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
9899     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9900     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9901     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9902     * @since 12
9903     */
9904    resume(): Promise<void>;
9905
9906    /**
9907     * Cancels transcoding. This API uses a promise to return the result.
9908     * This API can be called only after the [prepare()]{@link AVTranscoder.prepare}, [start()]{@link AVTranscoder.start},
9909     * [pause()]{@link AVTranscoder.pause}, or [resume()]{@link AVTranscoder.resume} API is called.
9910     * @returns { Promise<void> } Promise that returns no value.
9911     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
9912     * @throws { BusinessError } 5400103 - IO error. Return by promise.
9913     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9914     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9915     * @since 12
9916     */
9917    cancel(): Promise<void>;
9918
9919    /**
9920     * Releases the video transcoding resources. This API uses a promise to return the result.
9921     *
9922     * After the resources are released, you can no longer perform any operation on the **AVTranscoder** instance.
9923     * @returns { Promise<void> } Promise that returns no value.
9924     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
9925     * @throws { BusinessError } 5400105 - Service died. Return by promise.
9926     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9927     * @since 12
9928     */
9929    release(): Promise<void>;
9930
9931    /**
9932     * Subscribes to the event indicating that transcoding is complete.
9933     * An application can subscribe to only one transcoding completion event.
9934     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
9935     *
9936     * When this event is reported, the current transcoding operation is complete.
9937     * You need to call [release()]{@link AVTranscoder.release} to exit the transcoding.
9938     * @param { 'complete' } type - Event type, which is **'complete'** in this case.
9939     * This event is triggered by the system during transcoding.
9940     * @param { Callback<void> } callback - Callback that has been registered to listen for
9941     * transcoding completion events.
9942     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9943     * @since 12
9944     */
9945    on(type:'complete', callback: Callback<void>):void;
9946
9947    /**
9948     * Subscribes to AVTranscoder errors. If this event is reported, call [release()]{@link AVTranscoder.release}
9949     * to exit the transcoding.
9950     *
9951     * An application can subscribe to only one AVTranscoder error event.
9952     * When the application initiates multiple subscriptions to this event, the last subscription is applied.
9953     * @param { 'error' } type - Event type, which is **'error'** in this case.
9954     *
9955     * This event is triggered when an error occurs during transcoding.
9956     * @param { ErrorCallback } callback - Callback invoked when the event is triggered.
9957     * @throws { BusinessError } 401 - The parameter check failed.
9958     * @throws { BusinessError } 801 - Capability not supported.
9959     * @throws { BusinessError } 5400101 - No memory.
9960     * @throws { BusinessError } 5400102 - Operation not allowed.
9961     * @throws { BusinessError } 5400103 - I/O error.
9962     * @throws { BusinessError } 5400104 - Time out.
9963     * @throws { BusinessError } 5400105 - Service died.
9964     * @throws { BusinessError } 5400106 - Unsupported format.
9965     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9966     * @since 12
9967     */
9968    on(type:'error', callback: ErrorCallback):void;
9969
9970    /**
9971     * Subscribes to transcoding progress updates. An application can subscribe to only one transcoding progress update
9972     * event. When the application initiates multiple subscriptions to this event, the last subscription is applied.
9973     * @param { 'progressUpdate' } type - Event type, which is **'progressUpdate'** in this case.
9974     * This event is triggered by the system during transcoding.
9975     * @param { Callback<number> } callback - Callback invoked when the event is triggered.
9976     * **progress** is a number that indicates the current transcoding progress.
9977     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9978     * @since 12
9979     */
9980    on(type:'progressUpdate', callback: Callback<number>):void;
9981
9982    /**
9983     * Unsubscribes from the event indicating that transcoding is complete.
9984     * @param { 'complete' } type - Event type, which is **'complete'** in this case.
9985     * This event can be triggered by both user operations and the system.
9986     * @param { Callback<void> } callback - Callback that has been registered to listen for
9987     * transcoding completion events.
9988     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
9989     * @since 12
9990     */
9991    off(type:'complete', callback?: Callback<void>):void;
9992
9993    /**
9994     * Unsubscribes from AVTranscoder errors. After the unsubscription, your application can no longer
9995     * receive AVTranscoder errors.
9996     * @param { 'error' } type - 	Event type, which is **'error'** in this case.
9997     *
9998     * This event is triggered when an error occurs during transcoding.
9999     * @param { ErrorCallback } callback - Callback that has been registered to listen for AVTranscoder errors.
10000     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
10001     * @since 12
10002     */
10003    off(type:'error', callback?: ErrorCallback):void;
10004
10005    /**
10006     * Unsubscribes from transcoding progress updates.
10007     * @param { 'progressUpdate' } type - Event type, which is **'progressUpdate'** in this case.
10008     * This event can be triggered by both user operations and the system.
10009     * @param { Callback<number> } callback - Called that has been registered to listen for progress updates.
10010     * You are advised to use the default value because only the last registered callback is retained in the current
10011     * callback mechanism.
10012     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
10013     * @since 12
10014     */
10015    off(type:'progressUpdate', callback?: Callback<number>):void;
10016  }
10017
10018  /**
10019   * Enumerates the states available for the system screen recorder.
10020   *
10021   * @enum { number }
10022   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10023   * @systemapi
10024   * @since 18
10025   */
10026  enum ScreenCaptureEvent {
10027    /**
10028     * The system screen recorder starts screen capture.
10029     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10030     * @systemapi
10031     * @since 18
10032     */
10033    SCREENCAPTURE_STARTED = 0,
10034    /**
10035     * The system screen recorder stops screen capture.
10036     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10037     * @systemapi
10038     * @since 18
10039     */
10040    SCREENCAPTURE_STOPPED = 1
10041  }
10042
10043  /**
10044   * A class that provides APIs to query and monitor the system screen recorder status. Before calling any API,
10045   * you must use getScreenCaptureMonitor() to obtain a ScreenCaptureMonitor instance.
10046   *
10047   * @typedef ScreenCaptureMonitor
10048   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10049   * @systemapi
10050   * @since 18
10051   */
10052  interface ScreenCaptureMonitor {
10053    /**
10054     * Subscribes to state change events of the system screen recorder. From the ScreenCaptureEvent event reported,
10055     * you can determine whether the system screen recorder is working.
10056     * @param { 'systemScreenRecorder' } type - Event type, which is **'systemScreenRecorder'** in this case.
10057     * This event is triggered when the state of the system screen recorder changes.
10058     * @param { Callback<ScreenCaptureEvent> } callback - Callback invoked when the event is triggered,
10059     * where ScreenCaptureEvent indicates the new state.
10060     * @throws { BusinessError } 202 - Not System App.
10061     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10062	 * @systemapi
10063     * @since 18
10064     * @example
10065     * // This event is reported when the state of the system screen recorder changes.
10066     * screenCaptureMonitor.on('systemScreenRecorder', (event: media.ScreenCaptureEvent) => {
10067     *   // Set the 'systemScreenRecorder' event callback.
10068     *   console.info(`system ScreenRecorder event: ${event}`);
10069     * })
10070     */
10071    on(type: 'systemScreenRecorder', callback: Callback<ScreenCaptureEvent>): void;
10072
10073    /**
10074     * Unsubscribes from state change events of the system screen recorder.
10075     * @param { 'systemScreenRecorder' } type - Event type, which is **'systemScreenRecorder'** in this case.
10076     * This event is triggered when the state of the system screen recorder changes.
10077     * @param { Callback<ScreenCaptureEvent> } callback - Callback invoked when the event is triggered,
10078     * where ScreenCaptureEvent indicates the new state. If this parameter is not specified, the last subscription event is canceled.
10079     * @throws { BusinessError } 202 - Not System App.
10080     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10081     * @systemapi
10082     * @since 18
10083     * @example
10084     * screenCaptureMonitor.off('systemScreenRecorder');
10085     */
10086    off(type: 'systemScreenRecorder', callback?: Callback<ScreenCaptureEvent>): void;
10087
10088    /**
10089     * Whether the system screen recorder is working.
10090     * @type { boolean }
10091     * @readonly
10092     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
10093     * @systemapi
10094     * @since 18
10095     */
10096    readonly isSystemScreenRecorderWorking: boolean;
10097  }
10098}
10099export default media;
10100