• 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 * @namespace media
40 * @syscap SystemCapability.Multimedia.Media.Core
41 * @crossplatform
42 * @atomicservice
43 * @since 12
44 */
45declare namespace media {
46  /**
47   * Creates an AVPlayer instance.
48   * @param { AsyncCallback<AVPlayer> } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise.
49   * @throws { BusinessError } 5400101 - No memory. Return by callback.
50   * @syscap SystemCapability.Multimedia.Media.AVPlayer
51   * @since 9
52   */
53  /**
54   * Creates an AVPlayer instance.
55   * @param { AsyncCallback<AVPlayer> } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise.
56   * @throws { BusinessError } 5400101 - No memory. Return by callback.
57   * @syscap SystemCapability.Multimedia.Media.AVPlayer
58   * @atomicservice
59   * @since 11
60   */
61  /**
62   * Creates an AVPlayer instance.
63   * @param { AsyncCallback<AVPlayer> } callback - used to return AVPlayer instance if the operation is successful; returns null otherwise.
64   * @throws { BusinessError } 5400101 - No memory. Return by callback.
65   * @syscap SystemCapability.Multimedia.Media.AVPlayer
66   * @crossplatform
67   * @atomicservice
68   * @since 12
69   */
70  function createAVPlayer(callback: AsyncCallback<AVPlayer>): void;
71
72  /**
73   * Creates an AVPlayer instance.
74   * @returns { Promise<AVPlayer> } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise.
75   * @throws { BusinessError } 5400101 - No memory. Return by promise.
76   * @syscap SystemCapability.Multimedia.Media.AVPlayer
77   * @since 9
78   */
79  /**
80   * Creates an AVPlayer instance.
81   * @returns { Promise<AVPlayer> } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise.
82   * @throws { BusinessError } 5400101 - No memory. Return by promise.
83   * @syscap SystemCapability.Multimedia.Media.AVPlayer
84   * @atomicservice
85   * @since 11
86   */
87  /**
88   * Creates an AVPlayer instance.
89   * @returns { Promise<AVPlayer> } A Promise instance used to return AVPlayer instance if the operation is successful; returns null otherwise.
90   * @throws { BusinessError } 5400101 - No memory. Return by promise.
91   * @syscap SystemCapability.Multimedia.Media.AVPlayer
92   * @crossplatform
93   * @atomicservice
94   * @since 12
95   */
96  function createAVPlayer(): Promise<AVPlayer>;
97
98  /**
99   * Creates an AVRecorder instance.
100   * @param { AsyncCallback<AVRecorder> } callback - used to return AVRecorder instance if the operation is successful; returns null otherwise.
101   * @throws { BusinessError } 5400101 - No memory. Return by callback.
102   * @syscap SystemCapability.Multimedia.Media.AVRecorder
103   * @since 9
104   */
105  /**
106   * Creates an AVRecorder instance.
107   * @param { AsyncCallback<AVRecorder> } callback - used to return AVRecorder instance if the operation is successful; returns null otherwise.
108   * @throws { BusinessError } 5400101 - No memory. Return by callback.
109   * @syscap SystemCapability.Multimedia.Media.AVRecorder
110   * @crossplatform
111   * @since 12
112   */
113  function createAVRecorder(callback: AsyncCallback<AVRecorder>): void;
114
115  /**
116   * Creates an AVRecorder instance.
117   * @returns { Promise<AVRecorder> } A Promise instance used to return AVRecorder instance if the operation is successful; returns null otherwise.
118   * @throws { BusinessError } 5400101 - No memory. Return by promise.
119   * @syscap SystemCapability.Multimedia.Media.AVRecorder
120   * @since 9
121   */
122  /**
123   * Creates an AVRecorder instance.
124   * @returns { Promise<AVRecorder> } A Promise instance used to return AVRecorder instance if the operation is successful; returns null otherwise.
125   * @throws { BusinessError } 5400101 - No memory. Return by promise.
126   * @syscap SystemCapability.Multimedia.Media.AVRecorder
127   * @crossplatform
128   * @atomicservice
129   * @since 12
130   */
131  function createAVRecorder(): Promise<AVRecorder>;
132
133  /**
134   * Creates an AudioPlayer instance.
135   * @returns { AudioPlayer } Returns an AudioPlayer instance if the operation is successful; returns null otherwise.
136   * @syscap SystemCapability.Multimedia.Media.AudioPlayer
137   * @since 6
138   * @deprecated since 9
139   * @useinstead ohos.multimedia.media/media#createAVPlayer
140   */
141  function createAudioPlayer(): AudioPlayer;
142
143  /**
144   * Creates an AudioRecorder instance.
145   * @returns { AudioRecorder } Returns an AudioRecorder instance if the operation is successful; returns null otherwise.
146   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
147   * @since 6
148   * @deprecated since 9
149   * @useinstead ohos.multimedia.media/media#createAVRecorder
150   */
151  function createAudioRecorder(): AudioRecorder;
152
153  /**
154   * Create MediaSource from url.
155   * @param { string } url : The location for the media source.
156   * @param { Record<string, string> } headers : Headers attached to network request while player request data.
157   * @returns { MediaSource } MediaSource instance if the operation is successful; returns null otherwise.
158   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
159   * <br>2. Incorrect parameter types. 3.Parameter verification failed.
160   * @throws { BusinessError } 5400101 - No memory.
161   * @syscap SystemCapability.Multimedia.Media.Core
162   * @since 12
163   */
164  /**
165   * Create MediaSource from url.
166   * @param { string } url : The location for the media source.
167   * @param { Record<string, string> } headers : Headers attached to network request while player request data.
168   * @returns { MediaSource } MediaSource instance if the operation is successful; returns null otherwise.
169   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
170   * <br>2. Incorrect parameter types. 3.Parameter verification failed.
171   * @throws { BusinessError } 5400101 - No memory.
172   * @syscap SystemCapability.Multimedia.Media.Core
173   * @atomicservice
174   * @since 13
175   */
176  function createMediaSourceWithUrl(url: string, headers?: Record<string, string>): MediaSource;
177
178  /**
179   * Creates an VideoPlayer instance.
180   * @param { AsyncCallback<VideoPlayer> } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise.
181   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
182   * @since 8
183   * @deprecated since 9
184   * @useinstead ohos.multimedia.media/media#createAVPlayer
185   */
186  function createVideoPlayer(callback: AsyncCallback<VideoPlayer>): void;
187
188  /**
189   * Creates an VideoPlayer instance.
190   * @returns { Promise<VideoPlayer> } A Promise instance used to return VideoPlayer instance if the operation is successful; returns null otherwise.
191   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
192   * @since 8
193   * @deprecated since 9
194   * @useinstead ohos.multimedia.media/media#createAVPlayer
195   */
196  function createVideoPlayer(): Promise<VideoPlayer>;
197
198  /**
199   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
200   * Creates an VideoRecorder instance.
201   * @param { AsyncCallback<VideoRecorder> } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise.
202   * @throws { BusinessError } 5400101 - No memory. Return by callback.
203   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
204   * @systemapi
205   * @since 9
206   */
207  /**
208   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
209   * Creates an VideoRecorder instance.
210   * @param { AsyncCallback<VideoRecorder> } callback - used to return AudioPlayer instance if the operation is successful; returns null otherwise.
211   * @throws { BusinessError } 202 - Not System App.
212   * @throws { BusinessError } 5400101 - No memory. Return by callback.
213   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
214   * @systemapi
215   * @since 12
216   */
217  function createVideoRecorder(callback: AsyncCallback<VideoRecorder>): void;
218
219  /**
220   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
221   * Creates an VideoRecorder instance.
222   * @returns { Promise<VideoRecorder> } A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise.
223   * @throws { BusinessError } 5400101 - No memory. Return by promise.
224   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
225   * @systemapi
226   * @since 9
227   */
228  /**
229   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder
230   * Creates an VideoRecorder instance.
231   * @returns { Promise<VideoRecorder> } A Promise instance used to return VideoRecorder instance if the operation is successful; returns null otherwise.
232   * @throws { BusinessError } 202 - Not System App.
233   * @throws { BusinessError } 5400101 - No memory. Return by promise.
234   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
235   * @systemapi
236   * @since 12
237   */
238  function createVideoRecorder(): Promise<VideoRecorder>;
239
240  /**
241   * Creates a soundPool instance.
242   *
243   * @param {number} maxStreams The maximum number of simultaneous streams for this soundPool instance
244   * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information
245   * @param {AsyncCallback<SoundPool>} callback Callback used to return soundPool instance if the operation is successful; returns null otherwise.
246   * @throws { BusinessError } 5400101 - No memory. Return by callback.
247   * @syscap SystemCapability.Multimedia.Media.SoundPool
248   * @since 10
249   */
250  function createSoundPool(
251    maxStreams: number,
252    audioRenderInfo: audio.AudioRendererInfo,
253    callback: AsyncCallback<SoundPool>
254  ): void;
255
256  /**
257   * Creates a soundPool instance.
258   *
259   * @param {number} maxStreams The maximum number of simultaneous streams for this soundPool instance
260   * @param {audio.AudioRendererInfo} audioRenderInfo Audio renderer information
261   * @returns {Promise<SoundPool>} A Promise instance used to return SoundPool instance if the operation is successful; returns null otherwise.
262   * @throws { BusinessError } 5400101 - No memory. Return by promise.
263   * @syscap SystemCapability.Multimedia.Media.SoundPool
264   * @since 10
265   */
266  function createSoundPool(maxStreams: number, audioRenderInfo: audio.AudioRendererInfo): Promise<SoundPool>;
267
268  /**
269   * Creates an AVScreenCaptureRecorder instance.
270   * @returns { Promise<AVScreenCaptureRecorder> } A Promise instance used to return AVScreenCaptureRecorder instance if the operation is successful;
271   * returns null otherwise.
272   * @throws { BusinessError } 5400101 - No memory. Return by promise.
273   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
274   * @since 12
275   */
276  function createAVScreenCaptureRecorder(): Promise<AVScreenCaptureRecorder>;
277
278  /**
279   * Report user choice back to AVScreenCapture server
280   *
281   * @param {number} sessionId The AVScreenCapture server session ID.
282   * @param {string} choice Content chosen by user.
283   * @returns { Promise<void> } Promise used to return the result.
284   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
285   * <br>2. Incorrect parameter types. 3.Parameter verification failed.
286   * @throws { BusinessError } 5400101 - No memory. Return by promise.
287   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
288   * @systemapi
289   * @since 12
290   */
291  function reportAVScreenCaptureUserChoice(sessionId: number, choice: string): Promise<void>;
292
293  /**
294   * Creates a AVTranscoder instance.
295   *
296   * @returns {Promise<AVTranscoder>} A Promise instance used to return AVTranscoder instance if the operation is successful; returns null otherwise.
297   * @throws { BusinessError } 5400101 - No memory. Return by promise.
298   * @syscap SystemCapability.Multimedia.Media.AVTranscoder
299   * @since 12
300   */
301  function createAVTranscoder(): Promise<AVTranscoder>;
302
303  /**
304   * Manages and plays sound. Before calling an SoundPool method, you must use createSoundPool()
305   * to create an SoundPool instance.
306   *
307   * @typedef { _SoundPool }
308   * @syscap SystemCapability.Multimedia.Media.SoundPool
309   * @since 10
310   */
311  type SoundPool = _SoundPool;
312
313  /**
314   * Describes play parameters.
315   *
316   * @typedef { _PlayParameters }
317   * @syscap SystemCapability.Multimedia.Media.SoundPool
318   * @since 10
319   */
320  type PlayParameters = _PlayParameters;
321
322  /**
323   * Enumerates state change reason.
324   *
325   * @enum { number }
326   * @syscap SystemCapability.Multimedia.Media.Core
327   * @since 9
328   */
329  /**
330   * Enumerates state change reason.
331   *
332   * @enum { number }
333   * @syscap SystemCapability.Multimedia.Media.Core
334   * @atomicservice
335   * @since 11
336   */
337  /**
338   * Enumerates state change reason.
339   *
340   * @enum { number }
341   * @syscap SystemCapability.Multimedia.Media.Core
342   * @crossplatform
343   * @atomicservice
344   * @since 12
345   */
346  enum StateChangeReason {
347    /**
348     * State changed by user operation.
349     * @syscap SystemCapability.Multimedia.Media.Core
350     * @since 9
351     */
352    /**
353     * State changed by user operation.
354     * @syscap SystemCapability.Multimedia.Media.Core
355     * @atomicservice
356     * @since 11
357     */
358    /**
359     * State changed by user operation.
360     * @syscap SystemCapability.Multimedia.Media.Core
361     * @crossplatform
362     * @atomicservice
363     * @since 12
364     */
365    USER = 1,
366
367    /**
368     * State changed by background action.
369     * @syscap SystemCapability.Multimedia.Media.Core
370     * @since 9
371     */
372    /**
373     * State changed by background action.
374     * @syscap SystemCapability.Multimedia.Media.Core
375     * @atomicservice
376     * @since 11
377     */
378    /**
379     * State changed by background action.
380     * @syscap SystemCapability.Multimedia.Media.Core
381     * @crossplatform
382     * @atomicservice
383     * @since 12
384     */
385    BACKGROUND = 2,
386  }
387
388  /**
389   * Creates an AVMetadataExtractor instance.
390   * @returns { Promise<AVMetadataExtractor> } A Promise instance used to return AVMetadataExtractor instance
391   * if the operation is successful; returns null otherwise.
392   * @throws { BusinessError } 5400101 - No memory. Returned by promise.
393   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
394   * @since 11
395   */
396  /**
397   * Creates an AVMetadataExtractor instance.
398   * @returns { Promise<AVMetadataExtractor> } A Promise instance used to return AVMetadataExtractor instance
399   * if the operation is successful; returns null otherwise.
400   * @throws { BusinessError } 5400101 - No memory. Returned by promise.
401   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
402   * @crossplatform
403   * @since 12
404   */
405  function createAVMetadataExtractor(): Promise<AVMetadataExtractor>;
406
407  /**
408   * Creates an AVMetadataExtractor instance.
409   * @param { AsyncCallback<AVMetadataExtractor> } callback - Callback used to return AVMetadataExtractor instance
410   * if the operation is successful; returns null otherwise.
411   * @throws { BusinessError } 5400101 - No memory. Returned by callback.
412   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
413   * @since 11
414   */
415  /**
416   * Creates an AVMetadataExtractor instance.
417   * @param { AsyncCallback<AVMetadataExtractor> } callback - Callback used to return AVMetadataExtractor instance
418   * if the operation is successful; returns null otherwise.
419   * @throws { BusinessError } 5400101 - No memory. Returned by callback.
420   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
421   * @crossplatform
422   * @since 12
423   */
424  function createAVMetadataExtractor(callback: AsyncCallback<AVMetadataExtractor>): void;
425
426  /**
427   * Creates an AVImageGenerator instance.
428   * @returns { Promise<AVImageGenerator> } A Promise instance used to return AVImageGenerator instance
429   * if the operation is successful; returns null otherwise.
430   * @throws { BusinessError } 5400101 - No memory. Returned by promise.
431   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
432   * @since 12
433   */
434  function createAVImageGenerator(): Promise<AVImageGenerator>;
435
436  /**
437   * Creates an AVImageGenerator instance.
438   * @param { AsyncCallback<AVImageGenerator> } callback - Callback used to return AVImageGenerator instance
439   * if the operation is successful; returns null otherwise.
440   * @throws { BusinessError } 5400101 - No memory. Returned by callback.
441   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
442   * @since 12
443   */
444  function createAVImageGenerator(callback: AsyncCallback<AVImageGenerator>): void;
445
446  /**
447   * Fetch media meta data or audio art picture from source. Before calling an AVMetadataExtractor method,
448   * you must use createAVMetadataExtractor() to create an AVMetadataExtractor instance.
449   * @typedef AVMetadataExtractor
450   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
451   * @since 11
452   */
453  /**
454   * Fetch media meta data or audio art picture from source. Before calling an AVMetadataExtractor method,
455   * you must use createAVMetadataExtractor() to create an AVMetadataExtractor instance.
456   * @typedef AVMetadataExtractor
457   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
458   * @crossplatform
459   * @since 12
460   */
461  interface AVMetadataExtractor {
462    /**
463     * Media file descriptor.
464     * @type { ?AVFileDescriptor }
465     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
466     * @since 11
467     */
468    /**
469     * Media file descriptor.
470     * @type { ?AVFileDescriptor }
471     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
472     * @crossplatform
473     * @since 12
474     */
475    fdSrc ?: AVFileDescriptor;
476
477    /**
478     * DataSource descriptor.
479     * @type { ?AVDataSrcDescriptor }
480     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
481     * @since 11
482     */
483    /**
484     * DataSource descriptor.
485     * @type { ?AVDataSrcDescriptor }
486     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
487     * @crossplatform
488     * @since 12
489     */
490    dataSrc ?: AVDataSrcDescriptor;
491
492    /**
493     * It will extract the resource to fetch media meta data info.
494     * @param { AsyncCallback<AVMetadata> } callback - A callback instance used to return when fetchMetadata completed.
495     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
496     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
497     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
498     * @since 11
499     */
500    /**
501     * It will extract the resource to fetch media meta data info.
502     * @param { AsyncCallback<AVMetadata> } callback - A callback instance used to return when fetchMetadata completed.
503     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
504     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
505     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
506     * @crossplatform
507     * @since 12
508     */
509    fetchMetadata(callback: AsyncCallback<AVMetadata>): void;
510
511    /**
512     * It will extract the resource to fetch media meta data info.
513     * @returns { Promise<AVMetadata> } A Promise instance used to return when fetchMetadata completed.
514     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
515     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
516     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
517     * @since 11
518     */
519    /**
520     * It will extract the resource to fetch media meta data info.
521     * @returns { Promise<AVMetadata> } A Promise instance used to return when fetchMetadata completed.
522     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
523     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
524     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
525     * @crossplatform
526     * @since 12
527     */
528    fetchMetadata(): Promise<AVMetadata>;
529
530    /**
531     * It will extract the audio resource to fetch an album cover.
532     * @param { AsyncCallback<image.PixelMap> } callback - A callback instance used
533     * to return when fetchAlbumCover completed.
534     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
535     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
536     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
537     * @since 11
538     */
539    /**
540     * It will extract the audio resource to fetch an album cover.
541     * @param { AsyncCallback<image.PixelMap> } callback - A callback instance used
542     * to return when fetchAlbumCover completed.
543     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
544     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
545     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
546     * @crossplatform
547     * @since 12
548     */
549    fetchAlbumCover(callback: AsyncCallback<image.PixelMap>): void;
550
551    /**
552     * It will extract the audio resource to fetch an album cover.
553     * @returns { Promise<image.PixelMap> } A Promise instance used to return when fetchAlbumCover completed.
554     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
555     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
556     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
557     * @since 11
558     */
559    /**
560     * It will extract the audio resource to fetch an album cover.
561     * @returns { Promise<image.PixelMap> } A Promise instance used to return when fetchAlbumCover completed.
562     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
563     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
564     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
565     * @crossplatform
566     * @since 12
567     */
568    fetchAlbumCover(): Promise<image.PixelMap>;
569
570    /**
571     * Get timestamp according to frame index.
572     * @param { number } index - Index of the frame.
573     * @returns { Promise<number> } A Promise instance used to return frame timestamp, in microseconds.
574     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
575     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
576     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
577     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
578     * @systemapi
579     * @since 12
580     */
581    getTimeByFrameIndex(index: number): Promise<number>;
582
583    /**
584     * Get frame index according to the given timestamp.
585     * @param { number } timeUs - Timestamp of the frame, in microseconds.
586     * @returns { Promise<number> } A Promise instance used to return frame index.
587     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
588     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
589     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
590     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
591     * @systemapi
592     * @since 12
593     */
594    getFrameIndexByTime(timeUs: number): Promise<number>;
595
596    /**
597     * Release resources used for AVMetadataExtractor.
598     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
599     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
600     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
601     * @since 11
602     */
603    /**
604     * Release resources used for AVMetadataExtractor.
605     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
606     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
607     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
608     * @crossplatform
609     * @since 12
610     */
611    release(callback: AsyncCallback<void>): void;
612
613    /**
614     * Release resources used for AVMetadataExtractor.
615     * @returns { Promise<void> } A Promise instance used to return when release completed.
616     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
617     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
618     * @since 11
619     */
620    /**
621     * Release resources used for AVMetadataExtractor.
622     * @returns { Promise<void> } A Promise instance used to return when release completed.
623     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
624     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
625     * @crossplatform
626     * @since 12
627     */
628    release(): Promise<void>;
629  }
630
631  /**
632   * Provides the container definition for media meta data.
633   * @typedef AVMetadata
634   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
635   * @since 11
636   */
637  /**
638   * Provides the container definition for media meta data.
639   * @typedef AVMetadata
640   * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
641   * @crossplatform
642   * @since 12
643   */
644  interface AVMetadata {
645    /**
646     * The metadata to retrieve the information about the album title
647     * of the media source.
648     * @type { ?string }
649     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
650     * @since 11
651     */
652    /**
653     * The metadata to retrieve the information about the album title
654     * of the media source. This field is readonly in current version.
655     * @type { ?string }
656     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
657     * @crossplatform
658     * @since 12
659     */
660    album?: string;
661
662    /**
663     * The metadata to retrieve the information about the performer or
664     * artist associated with the media source.
665     * @type { ?string }
666     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
667     * @since 11
668     */
669    /**
670     * The metadata to retrieve the information about the performer or
671     * artist associated with the media source. This field is readonly in current version.
672     * @type { ?string }
673     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
674     * @crossplatform
675     * @since 12
676     */
677    albumArtist?: string;
678
679    /**
680     * The metadata to retrieve the information about the artist of
681     * the media source.
682     * @type { ?string }
683     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
684     * @since 11
685     */
686    /**
687     * The metadata to retrieve the information about the artist of
688     * the media source. This field is readonly in current version.
689     * @type { ?string }
690     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
691     * @crossplatform
692     * @since 12
693     */
694    artist?: string;
695
696    /**
697     * The metadata to retrieve the information about the author of
698     * the media source.
699     * @type { ?string }
700     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
701     * @since 11
702     */
703    /**
704     * The metadata to retrieve the information about the author of
705     * the media source. This field is readonly in current version.
706     * @type { ?string }
707     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
708     * @crossplatform
709     * @since 12
710     */
711    author?: string;
712
713    /**
714     * The metadata to retrieve the information about the created time of
715     * the media source.
716     * @type { ?string }
717     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
718     * @since 11
719     */
720    /**
721     * The metadata to retrieve the information about the created time of
722     * the media source. This field is readonly in current version.
723     * @type { ?string }
724     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
725     * @crossplatform
726     * @since 12
727     */
728    dateTime?: string;
729
730    /**
731     * The metadata to retrieve the information about the created or modified time
732     * with the specific date format of the media source.
733     * @type { ?string }
734     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
735     * @since 11
736     */
737    /**
738     * The metadata to retrieve the information about the created or modified time
739     * with the specific date format of the media source. This field is readonly in current version.
740     * @type { ?string }
741     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
742     * @crossplatform
743     * @since 12
744     */
745    dateTimeFormat?: string;
746
747    /**
748     * The metadata to retrieve the information about the composer of
749     * the media source.
750     * @type { ?string }
751     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
752     * @since 11
753     */
754    /**
755     * The metadata to retrieve the information about the composer of
756     * the media source. This field is readonly in current version.
757     * @type { ?string }
758     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
759     * @crossplatform
760     * @since 12
761     */
762    composer?: string;
763
764    /**
765     * The metadata to retrieve the playback duration of the media source.
766     * @type { ?string }
767     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
768     * @since 11
769     */
770    /**
771     * The metadata to retrieve the playback duration of the media source. This field is readonly in current version.
772     * @type { ?string }
773     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
774     * @crossplatform
775     * @since 12
776     */
777    duration?: string;
778
779    /**
780     * The metadata to retrieve the content type or genre of the data
781     * source.
782     * @type { ?string }
783     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
784     * @since 11
785     */
786    /**
787     * The metadata to retrieve the content type or genre of the data
788     * source.
789     * @type { ?string }
790     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
791     * @crossplatform
792     * @since 12
793     */
794    genre?: string;
795
796    /**
797     * If this value exists the media contains audio content.
798     * @type { ?string }
799     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
800     * @since 11
801     */
802    /**
803     * If this value exists the media contains audio content. This field is readonly in current version.
804     * @type { ?string }
805     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
806     * @crossplatform
807     * @since 12
808     */
809    hasAudio?: string;
810
811    /**
812     * If this value exists the media contains video content.
813     * @type { ?string }
814     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
815     * @since 11
816     */
817    /**
818     * If this value exists the media contains video content. This field is readonly in current version.
819     * @type { ?string }
820     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
821     * @crossplatform
822     * @since 12
823     */
824    hasVideo?: string;
825
826    /**
827     * The metadata to retrieve the mime type of the media source. Some
828     * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb",
829     * @type { ?string }
830     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
831     * @since 11
832     */
833    /**
834     * The metadata to retrieve the mime type of the media source. Some
835     * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb". This field is readonly in current version.
836     * @type { ?string }
837     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
838     * @crossplatform
839     * @since 12
840     */
841    mimeType?: string;
842
843    /**
844     * The metadata to retrieve the number of tracks, such as audio, video,
845     * text, in the media source, such as a mp4 or 3gpp file.
846     * @type { ?string }
847     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
848     * @since 11
849     */
850    /**
851     * The metadata to retrieve the number of tracks, such as audio, video,
852     * text, in the media source, such as a mp4 or 3gpp file. This field is readonly in current version.
853     * @type { ?string }
854     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
855     * @crossplatform
856     * @since 12
857     */
858    trackCount?: string;
859
860    /**
861     * It is the audio sample rate, if available.
862     * @type { ?string }
863     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
864     * @since 11
865     */
866    /**
867     * It is the audio sample rate, if available. This field is readonly in current version.
868     * @type { ?string }
869     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
870     * @crossplatform
871     * @since 12
872     */
873    sampleRate?: string;
874
875    /**
876     * The metadata to retrieve the media source title.
877     * @type { ?string }
878     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
879     * @since 11
880     */
881    /**
882     * The metadata to retrieve the media source title. This field is readonly in current version.
883     * @type { ?string }
884     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
885     * @crossplatform
886     * @since 12
887     */
888    title?: string;
889
890    /**
891     * If the media contains video, this key retrieves its height.
892     * @type { ?string }
893     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
894     * @since 11
895     */
896    /**
897     * If the media contains video, this key retrieves its height. This field is readonly in current version.
898     * @type { ?string }
899     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
900     * @crossplatform
901     * @since 12
902     */
903    videoHeight?: string;
904
905    /**
906     * If the media contains video, this key retrieves its width.
907     * @type { ?string }
908     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
909     * @since 11
910     */
911    /**
912     * If the media contains video, this key retrieves its width. This field is readonly in current version.
913     * @type { ?string }
914     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
915     * @crossplatform
916     * @since 12
917     */
918    videoWidth?: string;
919
920    /**
921     * The metadata to retrieve the information about the video
922     * orientation.
923     * @type { ?string }
924     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
925     * @since 11
926     */
927    /**
928     * The metadata to retrieve the information about the video
929     * orientation.
930     * @type { ?string }
931     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
932     * @crossplatform
933     * @since 12
934     */
935    videoOrientation?: string;
936
937     /**
938     * This value exists if the video is HDR video.This field is readonly in current version.
939     * @type { ?HdrType }
940     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
941     * @crossplatform
942     * @since 12
943     */
944    hdrType?: HdrType;
945
946    /**
947     * The geographical location info of the video.
948     * @type { ?Location }
949     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
950     * @since 12
951     */
952    location?: Location;
953
954    /**
955     * Custom parameter key-value map read from moov.meta.list.
956     * @type { ?Record<string, string> }
957     * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor
958     * @since 12
959     */
960    customInfo?: Record<string, string>;
961  }
962
963  /**
964   * Enumerates options about the HDR Type of the video.
965   * @enum { number }
966   * @syscap SystemCapability.Multimedia.Media.Core
967   * @crossplatform
968   * @since 12
969   */
970  enum HdrType {
971    /**
972     * This option is used to mark none HDR type.
973     * @syscap SystemCapability.Multimedia.Media.Core
974     * @crossplatform
975     * @since 12
976     */
977    AV_HDR_TYPE_NONE = 0,
978
979    /**
980     * This option is used to mark HDR Vivid type.
981     * @syscap SystemCapability.Multimedia.Media.Core
982     * @crossplatform
983     * @since 12
984     */
985    AV_HDR_TYPE_VIVID = 1,
986  }
987
988  /**
989   * Generate an image from a video resource with the specific time. Before calling an AVImageGenerator method,
990   * you must use createAVImageGenerator() to create an AVImageGenerator instance.
991   * @typedef AVImageGenerator
992   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
993   * @since 12
994   */
995  interface AVImageGenerator {
996    /**
997     * Media file descriptor.
998     * @type { ?AVFileDescriptor }
999     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1000     * @since 12
1001     */
1002    fdSrc ?: AVFileDescriptor;
1003
1004    /**
1005     * It will fetch a picture at @timeUs from the given video resource.
1006     * @param { number } timeUs - The time expected to fetch picture from the video resource.
1007     * The unit is microsecond(us).
1008     * @param { AVImageQueryOptions } options - The time options about the relationship
1009     * between the given timeUs and a key frame, see @AVImageQueryOptions .
1010     * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams .
1011     * @param { AsyncCallback<image.PixelMap> } callback - A callback instance used
1012     * to return when fetchFrameByTime completed.
1013     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
1014     * @throws { BusinessError } 5400106 - Unsupported format. Returned by callback.
1015     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1016     * @since 12
1017     */
1018    fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams,
1019      callback: AsyncCallback<image.PixelMap>): void;
1020
1021    /**
1022     * It will decode the given video resource. Then fetch a picture
1023     * at @timeUs according the given @options and @param .
1024     * @param { number } timeUs - The time expected to fetch picture from the video resource.
1025     * The unit is microsecond(us).
1026     * @param { AVImageQueryOptions } options - The time options about the relationship
1027     * between the given timeUs and a key frame, see @AVImageQueryOptions .
1028     * @param { PixelMapParams } param - The output pixel map format params, see @PixelMapParams .
1029     * @returns { Promise<image.PixelMap> } A Promise instance used to return the pixel map
1030     * when fetchFrameByTime completed.
1031     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
1032     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
1033     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1034     * @since 12
1035     */
1036    fetchFrameByTime(timeUs: number, options: AVImageQueryOptions, param: PixelMapParams): Promise<image.PixelMap>;
1037
1038    /**
1039     * Release resources used for AVImageGenerator.
1040     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
1041     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback.
1042     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1043     * @since 12
1044     */
1045    release(callback: AsyncCallback<void>): void;
1046
1047    /**
1048     * Release resources used for AVImageGenerator.
1049     * @returns { Promise<void> } A Promise instance used to return when release completed.
1050     * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise.
1051     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1052     * @since 12
1053     */
1054    release(): Promise<void>;
1055  }
1056
1057  /**
1058   * Enumerates options about the relationship between the given timeUs and a key frame.
1059   * @enum { number }
1060   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1061   * @since 12
1062   */
1063  enum AVImageQueryOptions {
1064    /**
1065     * This option is used to fetch a key frame from the given media
1066     * resource that is located right after or at the given time.
1067     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1068     * @since 12
1069     */
1070    AV_IMAGE_QUERY_NEXT_SYNC,
1071
1072    /**
1073     * This option is used to fetch a key frame from the given media
1074     * resource that is located right before or at the given time.
1075     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1076     * @since 12
1077     */
1078    AV_IMAGE_QUERY_PREVIOUS_SYNC,
1079
1080    /**
1081     * This option is used to fetch a key frame from the given media
1082     * resource that is located closest to or at the given time.
1083     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1084     * @since 12
1085     */
1086    AV_IMAGE_QUERY_CLOSEST_SYNC,
1087
1088    /**
1089     * This option is used to fetch a frame (maybe not keyframe) from
1090     * the given media resource that is located closest to or at the given time.
1091     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1092     * @since 12
1093     */
1094    AV_IMAGE_QUERY_CLOSEST,
1095  }
1096
1097  /**
1098   * Expected pixel map format for the fetched image from video resource.
1099   * @typedef PixelMapParams
1100   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1101   * @since 12
1102   */
1103  interface PixelMapParams {
1104    /**
1105     * Expected pixelmap's width, -1 means to keep consistent with the
1106     * original dimensions of the given video resource.
1107     * @type { ?number }
1108     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1109     * @since 12
1110     */
1111    width?: number;
1112
1113    /**
1114     * Expected pixelmap's width, -1 means to keep consistent with the
1115     * original dimensions of the given video resource.
1116     * @type { ?number }
1117     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1118     * @since 12
1119     */
1120    height?: number;
1121
1122    /**
1123     * Expected pixelmap's color format, see {@link PixelFormat}.
1124     * @type { ?PixelFormat }
1125     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1126     * @systemapi
1127     * @since 11
1128     */
1129    colorFormat?: PixelFormat;
1130  }
1131
1132  /**
1133   * Enumerates options about the expected color options for the fetched image.
1134   * @enum { number }
1135   * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1136   * @systemapi
1137   * @since 11
1138   */
1139  enum PixelFormat {
1140    /**
1141     * RGB_565 options.
1142     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1143     * @systemapi
1144     * @since 11
1145     */
1146    RGB_565 = 2,
1147
1148    /**
1149     * RGBA_8888 options.
1150     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1151     * @systemapi
1152     * @since 11
1153     */
1154    RGBA_8888 = 3,
1155
1156    /**
1157     * RGB_888 options.
1158     * @syscap SystemCapability.Multimedia.Media.AVImageGenerator
1159     * @systemapi
1160     * @since 11
1161     */
1162    RGB_888 = 5,
1163  }
1164
1165  /**
1166    * Enumerates ErrorCode types, return in BusinessError::code.
1167    *
1168    * @enum { number }
1169    * @syscap SystemCapability.Multimedia.Media.Core
1170    * @since 9
1171    */
1172  /**
1173   * Enumerates ErrorCode types, return in BusinessError::code.
1174   *
1175   * @enum { number }
1176   * @syscap SystemCapability.Multimedia.Media.Core
1177   * @atomicservice
1178   * @since 11
1179   */
1180  /**
1181   * Enumerates ErrorCode types, return in BusinessError::code.
1182   *
1183   * @enum { number }
1184   * @syscap SystemCapability.Multimedia.Media.Core
1185   * @crossplatform
1186   * @atomicservice
1187   * @since 12
1188   */
1189  enum AVErrorCode {
1190    /**
1191     * Operation success.
1192     * @syscap SystemCapability.Multimedia.Media.Core
1193     * @since 9
1194     */
1195    /**
1196     * Operation success.
1197     * @syscap SystemCapability.Multimedia.Media.Core
1198     * @atomicservice
1199     * @since 11
1200     */
1201    /**
1202     * Operation success.
1203     * @syscap SystemCapability.Multimedia.Media.Core
1204     * @crossplatform
1205     * @atomicservice
1206     * @since 12
1207     */
1208    AVERR_OK = 0,
1209
1210    /**
1211     * Permission denied.
1212     * @syscap SystemCapability.Multimedia.Media.Core
1213     * @since 9
1214     */
1215    /**
1216     * Permission denied.
1217     * @syscap SystemCapability.Multimedia.Media.Core
1218     * @atomicservice
1219     * @since 11
1220     */
1221    /**
1222     * Permission denied.
1223     * @syscap SystemCapability.Multimedia.Media.Core
1224     * @crossplatform
1225     * @atomicservice
1226     * @since 12
1227     */
1228    AVERR_NO_PERMISSION = 201,
1229
1230    /**
1231     * Invalid parameter.
1232     * @syscap SystemCapability.Multimedia.Media.Core
1233     * @since 9
1234     */
1235    /**
1236     * Invalid parameter.
1237     * @syscap SystemCapability.Multimedia.Media.Core
1238     * @atomicservice
1239     * @since 11
1240     */
1241    /**
1242     * Invalid parameter.
1243     * @syscap SystemCapability.Multimedia.Media.Core
1244     * @crossplatform
1245     * @atomicservice
1246     * @since 12
1247     */
1248    AVERR_INVALID_PARAMETER = 401,
1249
1250    /**
1251     * The api is not supported in the current version.
1252     * @syscap SystemCapability.Multimedia.Media.Core
1253     * @since 9
1254     */
1255    /**
1256     * The api is not supported in the current version.
1257     * @syscap SystemCapability.Multimedia.Media.Core
1258     * @atomicservice
1259     * @since 11
1260     */
1261    /**
1262     * The api is not supported in the current version.
1263     * @syscap SystemCapability.Multimedia.Media.Core
1264     * @crossplatform
1265     * @atomicservice
1266     * @since 12
1267     */
1268    AVERR_UNSUPPORT_CAPABILITY = 801,
1269
1270    /**
1271     * The system memory is insufficient or the number of services reaches the upper limit.
1272     * @syscap SystemCapability.Multimedia.Media.Core
1273     * @since 9
1274     */
1275    /**
1276     * The system memory is insufficient or the number of services reaches the upper limit.
1277     * @syscap SystemCapability.Multimedia.Media.Core
1278     * @atomicservice
1279     * @since 11
1280     */
1281    /**
1282     * The system memory is insufficient or the number of services reaches the upper limit.
1283     * @syscap SystemCapability.Multimedia.Media.Core
1284     * @crossplatform
1285     * @atomicservice
1286     * @since 12
1287     */
1288    AVERR_NO_MEMORY = 5400101,
1289
1290    /**
1291     * Current status does not allow or do not have permission to perform this operation.
1292     * @syscap SystemCapability.Multimedia.Media.Core
1293     * @since 9
1294     */
1295    /**
1296     * Current status does not allow or do not have permission to perform this operation.
1297     * @syscap SystemCapability.Multimedia.Media.Core
1298     * @atomicservice
1299     * @since 11
1300     */
1301    /**
1302     * Current status does not allow or do not have permission to perform this operation.
1303     * @syscap SystemCapability.Multimedia.Media.Core
1304     * @crossplatform
1305     * @atomicservice
1306     * @since 12
1307     */
1308    AVERR_OPERATE_NOT_PERMIT = 5400102,
1309
1310    /**
1311     * Data flow exception information.
1312     * @syscap SystemCapability.Multimedia.Media.Core
1313     * @since 9
1314     */
1315    /**
1316     * Data flow exception information.
1317     * @syscap SystemCapability.Multimedia.Media.Core
1318     * @atomicservice
1319     * @since 11
1320     */
1321    /**
1322     * Data flow exception information.
1323     * @syscap SystemCapability.Multimedia.Media.Core
1324     * @crossplatform
1325     * @atomicservice
1326     * @since 12
1327     */
1328    AVERR_IO = 5400103,
1329
1330    /**
1331     * System or network response timeout.
1332     * @syscap SystemCapability.Multimedia.Media.Core
1333     * @since 9
1334     */
1335    /**
1336     * System or network response timeout.
1337     * @syscap SystemCapability.Multimedia.Media.Core
1338     * @atomicservice
1339     * @since 11
1340     */
1341    /**
1342     * System or network response timeout.
1343     * @syscap SystemCapability.Multimedia.Media.Core
1344     * @crossplatform
1345     * @atomicservice
1346     * @since 12
1347     */
1348    AVERR_TIMEOUT = 5400104,
1349
1350    /**
1351     * Service process died.
1352     * @syscap SystemCapability.Multimedia.Media.Core
1353     * @since 9
1354     */
1355    /**
1356     * Service process died.
1357     * @syscap SystemCapability.Multimedia.Media.Core
1358     * @atomicservice
1359     * @since 11
1360     */
1361    /**
1362     * Service process died.
1363     * @syscap SystemCapability.Multimedia.Media.Core
1364     * @crossplatform
1365     * @atomicservice
1366     * @since 12
1367     */
1368    AVERR_SERVICE_DIED = 5400105,
1369
1370    /**
1371     * Unsupported media format.
1372     * @syscap SystemCapability.Multimedia.Media.Core
1373     * @since 9
1374     */
1375    /**
1376     * Unsupported media format.
1377     * @syscap SystemCapability.Multimedia.Media.Core
1378     * @atomicservice
1379     * @since 11
1380     */
1381    /**
1382     * Unsupported media format.
1383     * @syscap SystemCapability.Multimedia.Media.Core
1384     * @crossplatform
1385     * @atomicservice
1386     * @since 12
1387     */
1388    AVERR_UNSUPPORT_FORMAT = 5400106,
1389
1390    /**
1391     * Audio interrupted.
1392     * @syscap SystemCapability.Multimedia.Media.Core
1393     * @atomicservice
1394     * @since 11
1395     */
1396    /**
1397     * Audio interrupted.
1398     * @syscap SystemCapability.Multimedia.Media.Core
1399     * @crossplatform
1400     * @atomicservice
1401     * @since 12
1402     */
1403    AVERR_AUDIO_INTERRUPTED = 5400107,
1404  }
1405
1406  /**
1407   * Describes AVPlayer states.
1408   * @typedef {'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'}
1409   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1410   * @since 9
1411
1412   */
1413  /**
1414   * Describes AVPlayer states.
1415   * @typedef {'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'}
1416   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1417   * @atomicservice
1418   * @since 11
1419
1420   */
1421  /**
1422   * Describes AVPlayer states.
1423   * @typedef {'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error'}
1424   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1425   * @crossplatform
1426   * @atomicservice
1427   * @since 12
1428   */
1429  type AVPlayerState = 'idle' | 'initialized' | 'prepared' | 'playing' | 'paused' | 'completed' | 'stopped' | 'released' | 'error';
1430
1431  /**
1432   * Define the TrackChange Event callback.
1433   * @typedef { function } OnTrackChangeHandler
1434   * @param { number } index - index number for change Track.
1435   * @param { boolean } isSelected - Target index number for moving elements.
1436   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1437   * @atomicservice
1438   * @since 12
1439   */
1440  type OnTrackChangeHandler = (index: number, isSelected: boolean) => void;
1441
1442  /**
1443   * Defines the OnStateChange callback.
1444   *
1445   * @typedef { function } OnAVPlayerStateChangeHandle
1446   * @param { AVPlayerState } state - state for AVPlayer.
1447   * @param { StateChangeReason } reason - reason for state change.
1448   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1449   * @crossplatform
1450   * @atomicservice
1451   * @since 12
1452   */
1453  type OnAVPlayerStateChangeHandle = (state: AVPlayerState, reason: StateChangeReason) => void;
1454
1455  /**
1456   * Defines the OnBufferingUpdateHandler callback.
1457   *
1458   * @typedef { function } OnBufferingUpdateHandler
1459   * @param { BufferingInfoType } infoType - define the Buffering info Type.
1460   * @param { number } value - define the value of buffering info type if exist.
1461   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1462   * @crossplatform
1463   * @atomicservice
1464   * @since 12
1465   */
1466  type OnBufferingUpdateHandler = (infoType: BufferingInfoType, value: number) => void;
1467
1468  /**
1469   * Defines the OnVideoSizeChangeHandler callback.
1470   *
1471   * @typedef { function } OnVideoSizeChangeHandler
1472   * @param { number } width - Value of video Width.
1473   * @param { number } height - Value of video Height.
1474   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1475   * @crossplatform
1476   * @atomicservice
1477   * @since 12
1478   */
1479  type OnVideoSizeChangeHandler = (width: number, height: number) => void;
1480
1481  /**
1482   * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer()
1483   * to create an AVPlayer instance.
1484   *
1485   * @typedef AVPlayer
1486   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1487   * @since 9
1488   */
1489  /**
1490   * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer()
1491   * to create an AVPlayer instance.
1492   *
1493   * @typedef AVPlayer
1494   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1495   * @atomicservice
1496   * @since 11
1497   */
1498  /**
1499   * Manages and plays media. Before calling an AVPlayer method, you must use createAVPlayer()
1500   * to create an AVPlayer instance.
1501   *
1502   * @typedef AVPlayer
1503   * @syscap SystemCapability.Multimedia.Media.AVPlayer
1504   * @crossplatform
1505   * @atomicservice
1506   * @since 12
1507   */
1508  interface AVPlayer {
1509    /**
1510     * Prepare audio/video playback, it will request resource for playing.
1511     * @param { AsyncCallback<void> } callback - instance used to return when prepare completed.
1512     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1513     * @throws { BusinessError } 5400106 - Unsupported format. Return by callback.
1514     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1515     * @since 9
1516     */
1517    /**
1518     * Prepare audio/video playback, it will request resource for playing.
1519     * @param { AsyncCallback<void> } callback - instance used to return when prepare completed.
1520     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1521     * @throws { BusinessError } 5400106 - Unsupported format. Return by callback.
1522     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1523     * @atomicservice
1524     * @since 11
1525     */
1526    /**
1527     * Prepare audio/video playback, it will request resource for playing.
1528     * @param { AsyncCallback<void> } callback - instance used to return when prepare completed.
1529     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1530     * @throws { BusinessError } 5400106 - Unsupported format. Return by callback.
1531     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1532     * @crossplatform
1533     * @atomicservice
1534     * @since 12
1535     */
1536    prepare(callback: AsyncCallback<void>): void;
1537
1538    /**
1539     * Prepare audio/video playback, it will request resource for playing.
1540     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
1541     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1542     * @throws { BusinessError } 5400106 - Unsupported format. Return by promise.
1543     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1544     * @since 9
1545     */
1546    /**
1547     * Prepare audio/video playback, it will request resource for playing.
1548     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
1549     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1550     * @throws { BusinessError } 5400106 - Unsupported format. Return by promise.
1551     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1552     * @atomicservice
1553     * @since 11
1554     */
1555    /**
1556     * Prepare audio/video playback, it will request resource for playing.
1557     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
1558     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1559     * @throws { BusinessError } 5400106 - Unsupported format. Return by promise.
1560     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1561     * @crossplatform
1562     * @atomicservice
1563     * @since 12
1564     */
1565    prepare(): Promise<void>;
1566
1567    /**
1568     * Play audio/video playback.
1569     * @param { AsyncCallback<void> } callback - instance used to return when play completed.
1570     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1571     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1572     * @since 9
1573     */
1574    /**
1575     * Play audio/video playback.
1576     * @param { AsyncCallback<void> } callback - instance used to return when play completed.
1577     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1578     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1579     * @atomicservice
1580     * @since 11
1581     */
1582    /**
1583     * Play audio/video playback.
1584     * @param { AsyncCallback<void> } callback - instance used to return when play completed.
1585     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1586     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1587     * @crossplatform
1588     * @atomicservice
1589     * @since 12
1590     */
1591    play(callback: AsyncCallback<void>): void;
1592
1593    /**
1594     * Play audio/video playback.
1595     * @returns { Promise<void> } A Promise instance used to return when play completed.
1596     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1597     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1598     * @since 9
1599     */
1600    /**
1601     * Play audio/video playback.
1602     * @returns { Promise<void> } A Promise instance used to return when play completed.
1603     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1604     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1605     * @atomicservice
1606     * @since 11
1607     */
1608    /**
1609     * Play audio/video playback.
1610     * @returns { Promise<void> } A Promise instance used to return when play completed.
1611     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1612     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1613     * @crossplatform
1614     * @atomicservice
1615     * @since 12
1616     */
1617    play(): Promise<void>;
1618
1619    /**
1620     * Pause audio/video playback.
1621     * @param { AsyncCallback<void> } callback - instance used to return when pause completed.
1622     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1623     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1624     * @since 9
1625     */
1626    /**
1627     * Pause audio/video playback.
1628     * @param { AsyncCallback<void> } callback - instance used to return when pause completed.
1629     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1630     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1631     * @atomicservice
1632     * @since 11
1633     */
1634    /**
1635     * Pause audio/video playback.
1636     * @param { AsyncCallback<void> } callback - instance used to return when pause completed.
1637     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1638     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1639     * @crossplatform
1640     * @atomicservice
1641     * @since 12
1642     */
1643    pause(callback: AsyncCallback<void>): void;
1644
1645    /**
1646     * Pause audio/video playback.
1647     * @returns { Promise<void> } A Promise instance used to return when pause completed.
1648     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1649     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1650     * @since 9
1651     */
1652    /**
1653     * Pause audio/video playback.
1654     * @returns { Promise<void> } A Promise instance used to return when pause completed.
1655     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1656     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1657     * @atomicservice
1658     * @since 11
1659     */
1660    /**
1661     * Pause audio/video playback.
1662     * @returns { Promise<void> } A Promise instance used to return when pause completed.
1663     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1664     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1665     * @crossplatform
1666     * @atomicservice
1667     * @since 12
1668     */
1669    pause(): Promise<void>;
1670
1671    /**
1672     * Stop audio/video playback.
1673     * @param { AsyncCallback<void> } callback - instance used to return when stop completed.
1674     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1675     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1676     * @since 9
1677     */
1678    /**
1679     * Stop audio/video playback.
1680     * @param { AsyncCallback<void> } callback - instance used to return when stop completed.
1681     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1682     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1683     * @atomicservice
1684     * @since 11
1685     */
1686    /**
1687     * Stop audio/video playback.
1688     * @param { AsyncCallback<void> } callback - instance used to return when stop completed.
1689     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1690     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1691     * @crossplatform
1692     * @atomicservice
1693     * @since 12
1694     */
1695    stop(callback: AsyncCallback<void>): void;
1696
1697    /**
1698     * Stop audio/video playback.
1699     * @returns { Promise<void> } A Promise instance used to return when stop completed.
1700     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1701     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1702     * @since 9
1703     */
1704    /**
1705     * Stop audio/video playback.
1706     * @returns { Promise<void> } A Promise instance used to return when stop completed.
1707     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1708     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1709     * @atomicservice
1710     * @since 11
1711     */
1712    /**
1713     * Stop audio/video playback.
1714     * @returns { Promise<void> } A Promise instance used to return when stop completed.
1715     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1716     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1717     * @crossplatform
1718     * @atomicservice
1719     * @since 12
1720     */
1721    stop(): Promise<void>;
1722
1723    /**
1724     * Reset AVPlayer, it will to idle state and can set src again.
1725     * @param { AsyncCallback<void> } callback - instance used to return when reset completed.
1726     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1727     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1728     * @since 9
1729     */
1730    /**
1731     * Reset AVPlayer, it will to idle state and can set src again.
1732     * @param { AsyncCallback<void> } callback - instance used to return when reset completed.
1733     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1734     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1735     * @atomicservice
1736     * @since 11
1737     */
1738    /**
1739     * Reset AVPlayer, it will to idle state and can set src again.
1740     * @param { AsyncCallback<void> } callback - instance used to return when reset completed.
1741     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1742     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1743     * @crossplatform
1744     * @atomicservice
1745     * @since 12
1746     */
1747    reset(callback: AsyncCallback<void>): void;
1748
1749    /**
1750     * Reset AVPlayer, it will to idle state and can set src again.
1751     * @returns { Promise<void> } A Promise instance used to return when reset completed.
1752     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1753     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1754     * @since 9
1755     */
1756    /**
1757     * Reset AVPlayer, it will to idle state and can set src again.
1758     * @returns { Promise<void> } A Promise instance used to return when reset completed.
1759     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1760     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1761     * @atomicservice
1762     * @since 11
1763     */
1764    /**
1765     * Reset AVPlayer, it will to idle state and can set src again.
1766     * @returns { Promise<void> } A Promise instance used to return when reset completed.
1767     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1768     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1769     * @crossplatform
1770     * @atomicservice
1771     * @since 12
1772     */
1773    reset(): Promise<void>;
1774
1775    /**
1776     * Releases resources used for AVPlayer.
1777     * @param { AsyncCallback<void> } callback - instance used to return when release completed.
1778     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1779     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1780     * @since 9
1781     */
1782    /**
1783     * Releases resources used for AVPlayer.
1784     * @param { AsyncCallback<void> } callback - instance used to return when release completed.
1785     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1786     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1787     * @atomicservice
1788     * @since 11
1789     */
1790    /**
1791     * Releases resources used for AVPlayer.
1792     * @param { AsyncCallback<void> } callback - instance used to return when release completed.
1793     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1794     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1795     * @crossplatform
1796     * @atomicservice
1797     * @since 12
1798     */
1799    release(callback: AsyncCallback<void>): void;
1800
1801    /**
1802     * Releases resources used for AVPlayer.
1803     * @returns { Promise<void> } A Promise instance used to return when release completed.
1804     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1805     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1806     * @since 9
1807     */
1808    /**
1809     * Releases resources used for AVPlayer.
1810     * @returns { Promise<void> } A Promise instance used to return when release completed.
1811     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1812     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1813     * @atomicservice
1814     * @since 11
1815     */
1816    /**
1817     * Releases resources used for AVPlayer.
1818     * @returns { Promise<void> } A Promise instance used to return when release completed.
1819     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1820     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1821     * @crossplatform
1822     * @atomicservice
1823     * @since 12
1824     */
1825    release(): Promise<void>;
1826
1827    /**
1828     * Jumps to the specified playback position.
1829     * @param { number } timeMs - Playback position to jump, should be in [0, duration].
1830     * @param { SeekMode } mode - See @SeekMode .
1831     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1832     * @since 9
1833     */
1834    /**
1835     * Jumps to the specified playback position.
1836     * @param { number } timeMs - Playback position to jump, should be in [0, duration].
1837     * @param { SeekMode } mode - See @SeekMode .
1838     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1839     * @atomicservice
1840     * @since 11
1841     */
1842    /**
1843     * Jumps to the specified playback position.
1844     * @param { number } timeMs - Playback position to jump, should be in [0, duration].
1845     * @param { SeekMode } mode - See @SeekMode .
1846     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1847     * @crossplatform
1848     * @atomicservice
1849     * @since 12
1850     */
1851    seek(timeMs: number, mode?: SeekMode): void;
1852
1853    /**
1854     * Sets the volume.
1855     * @param { number } volume - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
1856     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1857     * @since 9
1858     */
1859    /**
1860     * Sets the volume.
1861     * @param { number } volume - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
1862     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1863     * @crossplatform
1864     * @atomicservice
1865     * @since 12
1866     */
1867    setVolume(volume: number): void;
1868
1869    /**
1870     * Get all track infos in MediaDescription, should be called after data loaded callback.
1871     * @param { AsyncCallback<Array<MediaDescription>> } callback - Async callback return track info in MediaDescription.
1872     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1873     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1874     * @since 9
1875     */
1876    /**
1877     * Get all track infos in MediaDescription, should be called after data loaded callback.
1878     * @param { AsyncCallback<Array<MediaDescription>> } callback - Async callback return track info in MediaDescription.
1879     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1880     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1881     * @atomicservice
1882     * @since 11
1883     */
1884    /**
1885     * Get all track infos in MediaDescription, should be called after data loaded callback.
1886     * @param { AsyncCallback<Array<MediaDescription>> } callback - Async callback return track info in MediaDescription.
1887     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
1888     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1889     * @crossplatform
1890     * @atomicservice
1891     * @since 12
1892     */
1893    getTrackDescription(callback: AsyncCallback<Array<MediaDescription>>): void;
1894
1895    /**
1896     * Get all track infos in MediaDescription, should be called after data loaded callback.
1897     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
1898     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1899     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1900     * @since 9
1901     */
1902    /**
1903     * Get all track infos in MediaDescription, should be called after data loaded callback.
1904     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
1905     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1906     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1907     * @atomicservice
1908     * @since 11
1909     */
1910    /**
1911     * Get all track infos in MediaDescription, should be called after data loaded callback.
1912     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
1913     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1914     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1915     * @crossplatform
1916     * @atomicservice
1917     * @since 12
1918     */
1919    getTrackDescription(): Promise<Array<MediaDescription>>;
1920
1921    /**
1922     * Get selected tracks, should be called after prepared state.
1923     * @returns { Promise<Array<number>> } A Promise instance used to return selected track index.
1924     * @throws { BusinessError } 5400102 - Operation not allowed.
1925     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1926     * @atomicservice
1927     * @since 12
1928     */
1929    getSelectedTracks(): Promise<Array<number>>;
1930
1931    /**
1932     * Select specific track to play.
1933     * @param { number } index - Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX
1934     * @param { SwitchMode } mode - set switchmode for track select behavior.
1935     * @returns { Promise<void> } A Promise instance used to return when select track completed.
1936     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
1937     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1938     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1939     * @atomicservice
1940     * @since 12
1941     */
1942    selectTrack(index: number, mode?: SwitchMode): Promise<void>;
1943
1944    /**
1945     * Deselect specific track to play.
1946     * @param { number } index : Track index returned by getTrackDescription#MD_KEY_TRACK_INDEX
1947     * @returns { Promise<void> } A Promise instance used to return when deselect track completed.
1948     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
1949     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1950     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1951     * @atomicservice
1952     * @since 12
1953     */
1954    deselectTrack(index: number): Promise<void>;
1955
1956    /**
1957     * Set MediaSource to AVPlayer, this interface is exclusive with fd/url/dataSrc assign.
1958     * @param { MediaSource } src : MediaSource instance to be set to the avplayer instance.
1959     * @param { PlaybackStrategy } strategy : Play strategy of the media source.
1960     * @returns { Promise<void> } A Promise instance used to return when setMediaSource completed.
1961     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
1962     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
1963     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1964     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1965     * @atomicservice
1966     * @since 12
1967     */
1968    setMediaSource(src: MediaSource, strategy?: PlaybackStrategy): Promise<void>;
1969
1970    /**
1971     * Add subtitle resource represented by FD to the player.
1972     * @param { number } fd : The file descriptor of subtitle source from file system.
1973     * The caller is responsible to close the file descriptor.
1974     * @param { number } offset : The offset into the file where the data to be read, in bytes.
1975     * By default, the offset is zero.
1976     * @param { number } length : The length in bytes of the data to be read.
1977     * By default, the length is the rest of bytes in the file from the offset.
1978     * @returns { Promise<void> } Promise used to return the result.
1979     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
1980     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1981     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1982     * @atomicservice
1983     * @since 12
1984     */
1985    addSubtitleFromFd(fd: number, offset?: number, length?: number): Promise<void>;
1986
1987    /**
1988     * Add subtitle resource represented by url to the player. After the Promise returns,
1989     * subtitle info can be obtained by @getTrackDescription
1990     * @param { string } url : Address of external subtitle file.
1991     * @returns { Promise<void> } Promise used to return the result.
1992     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
1993     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
1994     * @syscap SystemCapability.Multimedia.Media.AVPlayer
1995     * @atomicservice
1996     * @since 12
1997     */
1998    addSubtitleFromUrl(url: string): Promise<void>;
1999
2000    /**
2001     * Get statistic infos of current player.
2002     * @returns { Promise<PlaybackInfo> } Statistic infos of current player.
2003     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2004     * @since 12
2005     */
2006    getPlaybackInfo(): Promise<PlaybackInfo>;
2007
2008    /**
2009     * Set playback strategy to AVPlayer.
2010     * @param { PlaybackStrategy } strategy : specified strategy of the AVPlayer.
2011     * @returns { Promise<void> }  A Promise instance used to return when setPlaybackStrategy completed.
2012     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Incorrect parameter types. 2. Parameter verification failed.
2013     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2014     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2015     * @atomicservice
2016     * @since 12
2017     */
2018    setPlaybackStrategy(strategy: PlaybackStrategy): Promise<void>;
2019
2020    /**
2021     * Mute specified media stream.
2022     * @param { MediaType } mediaType - specified media Type, see @MediaType..
2023     * @param { boolean } muted - true for mute, false for unmute.
2024     * @returns { Promise<void> } A Promise instance used to return when setMediaMuted completed.
2025     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2026     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2027     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2028     * @atomicservice
2029     * @since 12
2030     */
2031    setMediaMuted(mediaType: MediaType, muted: boolean): Promise<void>;
2032
2033    /**
2034     * Set playback start position and end position.
2035     * @param { number } startTimeMs - Playback start position, should be in [0, duration),
2036     *                                 -1 means that the start position is not set,
2037     *                                 and the playback will start from 0.
2038     * @param { number } endTimeMs - Playback end position, which should usually be in (startTimeMs, duration],
2039     *                               -1 means that the end position is not set,
2040     *                               and the playback will be ended at the end of the stream.
2041     * @param { SeekMode } [mode] - Use the specified seek mode to jump to the playback start position,
2042     *                             currently support SeekMode.SEEK_PREV_SYNC and SeekMode.SEEK_CLOSEST,
2043     *                             other values are invalid, the default value is SeekMode.SEEK_PREV_SYNC.
2044     * @returns { Promise<void> } Promise used to return the result.
2045     * @throws { BusinessError } 202 - Called from Non-System applications. Return by promise.
2046     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
2047     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
2048     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2049     * @systemapi
2050     * @since 12
2051     */
2052    setPlaybackRange(startTimeMs: number, endTimeMs: number, mode?: SeekMode) : Promise<void>;
2053
2054    /**
2055     * Media URI. Mainstream media formats are supported.
2056     * Network:http://xxx
2057     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2058     * @since 9
2059     */
2060    /**
2061     * Media URI. Mainstream media formats are supported.
2062     * Network:http://xxx
2063     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2064     * @atomicservice
2065     * @since 11
2066     */
2067    /**
2068     * Media URI. Mainstream media formats are supported.
2069     * Network:http://xxx
2070     * @type { ?string }
2071     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2072     * @crossplatform
2073     * @atomicservice
2074     * @since 12
2075     */
2076    url?: string;
2077
2078    /**
2079     * Media file descriptor. Mainstream media formats are supported.
2080     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2081     * @since 9
2082     */
2083    /**
2084     * Media file descriptor. Mainstream media formats are supported.
2085     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2086     * @atomicservice
2087     * @since 11
2088     */
2089    /**
2090     * Media file descriptor. Mainstream media formats are supported.
2091     * @type { ?AVFileDescriptor }
2092     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2093     * @crossplatform
2094     * @atomicservice
2095     * @since 12
2096     */
2097    fdSrc?: AVFileDescriptor;
2098
2099    /**
2100     * DataSource descriptor. Supports mainstream media formats.
2101     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2102     * @since 10
2103     */
2104    /**
2105     * DataSource descriptor. Supports mainstream media formats.
2106     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2107     * @atomicservice
2108     * @since 11
2109     */
2110    /**
2111     * DataSource descriptor. Supports mainstream media formats.
2112     * @type { ?AVDataSrcDescriptor }
2113     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2114     * @crossplatform
2115     * @atomicservice
2116     * @since 12
2117     */
2118    dataSrc?: AVDataSrcDescriptor;
2119
2120    /**
2121     * Whether to loop media playback.
2122     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2123     * @since 9
2124     */
2125    /**
2126     * Whether to loop media playback.
2127     * @type { boolean }
2128     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2129     * @crossplatform
2130     * @atomicservice
2131     * @since 12
2132     */
2133    loop: boolean;
2134
2135    /**
2136     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
2137     * set, the default mode will be used. Set it before calling the {@link #play()} in the
2138     * first time in order for the interrupt mode to become effective thereafter.
2139     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2140     * @since 9
2141     */
2142    /**
2143     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
2144     * set, the default mode will be used. Set it before calling the {@link #play()} in the
2145     * first time in order for the interrupt mode to become effective thereafter.
2146     * @type { ?audio.InterruptMode }
2147     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2148     * @atomicservice
2149     * @since 12
2150     */
2151    audioInterruptMode?: audio.InterruptMode;
2152
2153    /**
2154     * Describes audio renderer info, refer to {@link #audio.AudioRendererInfo}. Set it before
2155     * calling the {@link #prepare()} in the first time in order for the audio renderer info to
2156     * become effective thereafter.
2157     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2158     * @since 10
2159     */
2160    /**
2161     * Describes audio renderer info, refer to {@link #audio.AudioRendererInfo}. Set it before
2162     * calling the {@link #prepare()} in the first time in order for the audio renderer info to
2163     * become effective thereafter.
2164     * @type { ?audio.AudioRendererInfo }
2165     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2166     * @atomicservice
2167     * @since 12
2168     */
2169    audioRendererInfo?: audio.AudioRendererInfo;
2170
2171    /**
2172     * Obtains the current audio effect mode, refer to {@link #audio.AudioEffectMode}.
2173     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2174     * @since 10
2175     */
2176    /**
2177     * Obtains the current audio effect mode, refer to {@link #audio.AudioEffectMode}.
2178     * @type { ?audio.AudioEffectMode }
2179     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2180     * @atomicservice
2181     * @since 12
2182     */
2183    audioEffectMode ?: audio.AudioEffectMode;
2184
2185    /**
2186     * Current playback position.
2187     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2188     * @since 9
2189     */
2190    /**
2191     * Current playback position.
2192     * @type { number }
2193     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2194     * @crossplatform
2195     * @atomicservice
2196     * @since 12
2197     */
2198    readonly currentTime: number;
2199
2200    /**
2201     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
2202     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2203     * @since 9
2204     */
2205    /**
2206     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
2207     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2208     * @atomicservice
2209     * @since 11
2210     */
2211    /**
2212     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
2213     * @type { number }
2214     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2215     * @crossplatform
2216     * @atomicservice
2217     * @since 12
2218     */
2219    readonly duration: number;
2220
2221    /**
2222     * Playback state.
2223     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2224     * @since 9
2225     */
2226    /**
2227     * Playback state.
2228     * @type { AVPlayerState }
2229     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2230     * @crossplatform
2231     * @atomicservice
2232     * @since 12
2233     */
2234    readonly state: AVPlayerState;
2235
2236    /**
2237     * Video player will use this id get a surface instance.
2238     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2239     * @since 9
2240     */
2241    /**
2242     * Video player will use this id get a surface instance.
2243     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2244     * @atomicservice
2245     * @since 11
2246     */
2247    /**
2248     * Video player will use this id get a surface instance.
2249     * @type { ?string }
2250     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2251     * @crossplatform
2252     * @atomicservice
2253     * @since 12
2254     */
2255    surfaceId?: string;
2256
2257    /**
2258     * Video width, valid after prepared.
2259     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2260     * @since 9
2261     */
2262    /**
2263     * Video width, valid after prepared.
2264     * @type { number }
2265     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2266     * @crossplatform
2267     * @atomicservice
2268     * @since 12
2269     */
2270    readonly width: number;
2271
2272    /**
2273     * Video height, valid after prepared.
2274     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2275     * @since 9
2276     */
2277    /**
2278     * Video height, valid after prepared.
2279     * @type { number }
2280     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2281     * @crossplatform
2282     * @atomicservice
2283     * @since 12
2284     */
2285    readonly height: number;
2286
2287    /**
2288     * Video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more
2289     * information, refer to {@link #VideoScaleType} .
2290     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2291     * @since 9
2292     */
2293    /**
2294     * Video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more
2295     * information, refer to {@link #VideoScaleType} .
2296     * @type { ?VideoScaleType }
2297     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2298     * @crossplatform
2299     * @atomicservice
2300     * @since 12
2301     */
2302    videoScaleType?: VideoScaleType;
2303
2304    /**
2305     * Set payback speed.
2306     * @param { PlaybackSpeed } speed - playback speed, see @PlaybackSpeed .
2307     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2308     * @since 9
2309     */
2310    /**
2311     * Set payback speed.
2312     * @param { PlaybackSpeed } speed - playback speed, see @PlaybackSpeed .
2313     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2314     * @crossplatform
2315     * @atomicservice
2316     * @since 12
2317     */
2318    setSpeed(speed: PlaybackSpeed): void;
2319
2320    /**
2321     * select a specified bitrate to playback, only valid for HLS protocol network stream. By default, the
2322     * player will select the appropriate bitrate according to the network connection speed. The
2323     * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select
2324     * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player
2325     * will select the minimal and closest one from the available bitrate list.
2326     * @param { number } bitrate - the playback bitrate must be expressed in bits per second.
2327     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2328     * @since 9
2329     */
2330    /**
2331     * select a specified bitrate to playback, only valid for HLS protocol network stream. By default, the
2332     * player will select the appropriate bitrate according to the network connection speed. The
2333     * available bitrate list reported by {@link #on('availableBitrates')}. Set it to select
2334     * a specified bitrate. If the specified bitrate is not in the list of available bitrate, the player
2335     * will select the minimal and closest one from the available bitrate list.
2336     * @param { number } bitrate - the playback bitrate must be expressed in bits per second.
2337     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2338     * @crossplatform
2339     * @atomicservice
2340     * @since 12
2341     */
2342    setBitrate(bitrate: number): void;
2343
2344    /**
2345     * Set decryption session to codec module.
2346     * @param { drm.MediaKeySession } mediaKeySession - Handle of MediaKeySession to decrypt encrypted media.
2347     * @param { boolean } secureVideoPath - Secure video path required or not.
2348     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2349     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2350     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2351     * @since 11
2352     */
2353    /**
2354     * Set decryption session to codec module.
2355     * @param { drm.MediaKeySession } mediaKeySession - Handle of MediaKeySession to decrypt encrypted media.
2356     * @param { boolean } secureVideoPath - Secure video path required or not.
2357     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2358     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2359     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2360     * @atomicservice
2361     * @since 12
2362     */
2363    setDecryptionConfig(mediaKeySession: drm.MediaKeySession, secureVideoPath: boolean): void;
2364
2365    /**
2366     * Get media key system info from media source.
2367     * @returns { Array<drm.MediaKeySystemInfo> } MediaKeySystemInfo with PSSH.
2368     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2369     * @since 11
2370     */
2371    /**
2372     * Get media key system info from media source.
2373     * @returns { Array<drm.MediaKeySystemInfo> } MediaKeySystemInfo with PSSH.
2374     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2375     * @atomicservice
2376     * @since 12
2377     */
2378    getMediaKeySystemInfos(): Array<drm.MediaKeySystemInfo>;
2379
2380    /**
2381     * Register listens for mediaKeySystemInfoUpdate events.
2382     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
2383     * @param { function } callback - Callback used to listen for the mediaKeySystemInfoUpdate event.
2384     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2385     * @since 11
2386     */
2387    /**
2388     * Register listens for mediaKeySystemInfoUpdate events.
2389     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
2390     * @param { Callback<Array<drm.MediaKeySystemInfo>> } callback - Callback used to listen for the mediaKeySystemInfoUpdate event.
2391     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2392     * @atomicservice
2393     * @since 12
2394     */
2395    on(type: 'mediaKeySystemInfoUpdate', callback: Callback<Array<drm.MediaKeySystemInfo>>): void;
2396
2397    /**
2398     * Unregister listens for mediaKeySystemInfoUpdate events.
2399     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
2400     * @param { function } callback - Callback for event.
2401     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2402     * @since 11
2403     */
2404    /**
2405     * Unregister listens for mediaKeySystemInfoUpdate events.
2406     * @param { 'mediaKeySystemInfoUpdate' } type - Type of the event to listen for.
2407     * @param { Callback<Array<drm.MediaKeySystemInfo>> } callback - Callback for event.
2408     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2409     * @atomicservice
2410     * @since 12
2411     */
2412    off(type: 'mediaKeySystemInfoUpdate', callback?: Callback<Array<drm.MediaKeySystemInfo>>): void;
2413
2414    /**
2415     * Register listens for media playback stateChange event.
2416     * @param { 'stateChange' } type - Type of the playback event to listen for.
2417     * @param { function } callback - Callback used to listen for the playback stateChange event.
2418     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2419     * @since 9
2420     */
2421    /**
2422     * Register listens for media playback stateChange event.
2423     * @param { 'stateChange' } type - Type of the playback event to listen for.
2424     * @param { function } callback - Callback used to listen for the playback stateChange event.
2425     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2426     * @atomicservice
2427     * @since 11
2428     */
2429    /**
2430     * Register listens for media playback stateChange event.
2431     * @param { 'stateChange' } type - Type of the playback event to listen for.
2432     * @param { OnAVPlayerStateChangeHandle } callback - Callback used to listen for the playback stateChange event.
2433     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2434     * @crossplatform
2435     * @atomicservice
2436     * @since 12
2437     */
2438    on(type: 'stateChange', callback: OnAVPlayerStateChangeHandle): void;
2439    /**
2440     * Unregister listens for media playback stateChange event.
2441     * @param { 'stateChange' } type - Type of the playback event to listen for.
2442     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2443     * @since 9
2444     */
2445    /**
2446     * Unregister listens for media playback stateChange event.
2447     * @param { 'stateChange' } type - Type of the playback event to listen for.
2448     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2449     * @atomicservice
2450     * @since 11
2451     */
2452    /**
2453     * Unregister listens for media playback stateChange event.
2454     * @param { 'stateChange' } type - Type of the playback event to listen for.
2455     * @param { OnAVPlayerStateChangeHandle } callback - Callback used to listen for stateChange event
2456     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2457     * @crossplatform
2458     * @atomicservice
2459     * @since 12
2460     */
2461    off(type: 'stateChange', callback?: OnAVPlayerStateChangeHandle): void;
2462    /**
2463     * Register listens for media playback volumeChange event.
2464     * @param { 'volumeChange' } type - Type of the playback event to listen for.
2465     * @param { Callback<number> } callback - Callback used to listen for the playback volume event.
2466     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2467     * @since 9
2468     */
2469    /**
2470     * Register listens for media playback volumeChange event.
2471     * @param { 'volumeChange' } type - Type of the playback event to listen for.
2472     * @param { Callback<number> } callback - Callback used to listen for the playback volume event.
2473     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2474     * @crossplatform
2475     * @atomicservice
2476     * @since 12
2477     */
2478    on(type: 'volumeChange', callback: Callback<number>): void;
2479    /**
2480     * Unregister listens for media playback volumeChange event.
2481     * @param { 'volumeChange' } type - Type of the playback event to listen for.
2482     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2483     * @since 9
2484     */
2485    /**
2486     * Unregister listens for media playback volumeChange event.
2487     * @param { 'volumeChange' } type - Type of the playback event to listen for.
2488     * @param { Callback<number> } callback - Callback used to listen for the playback volume event.
2489     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2490     * @crossplatform
2491     * @since 12
2492     */
2493    off(type: 'volumeChange', callback?: Callback<number>): void;
2494    /**
2495     * Register listens for media playback endOfStream event.
2496     * @param { 'endOfStream' } type - Type of the playback event to listen for.
2497     * @param { Callback<void> } callback - Callback used to listen for the playback end of stream.
2498     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2499     * @since 9
2500     */
2501    /**
2502     * Register listens for media playback endOfStream event.
2503     * @param { 'endOfStream' } type - Type of the playback event to listen for.
2504     * @param { Callback<void> } callback - Callback used to listen for the playback end of stream.
2505     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2506     * @crossplatform
2507     * @atomicservice
2508     * @since 12
2509     */
2510    on(type: 'endOfStream', callback: Callback<void>): void;
2511    /**
2512     * Unregister listens for media playback endOfStream event.
2513     * @param { 'endOfStream' } type - Type of the playback event to listen for.
2514     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2515     * @since 9
2516     */
2517    /**
2518     * Unregister listens for media playback endOfStream event.
2519     * @param { 'endOfStream' } type - Type of the playback event to listen for.
2520     * @param { Callback<void> } callback - Callback used to listen for the playback end of stream.
2521     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2522     * @crossplatform
2523     * @since 12
2524     */
2525    off(type: 'endOfStream', callback?: Callback<void>): void;
2526    /**
2527     * Register listens for media playback seekDone event.
2528     * @param { 'seekDone' } type - Type of the playback event to listen for.
2529     * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event.
2530     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2531     * @since 9
2532     */
2533    /**
2534     * Register listens for media playback seekDone event.
2535     * @param { 'seekDone' } type - Type of the playback event to listen for.
2536     * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event.
2537     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2538     * @atomicservice
2539     * @since 11
2540     */
2541    /**
2542     * Register listens for media playback seekDone event.
2543     * @param { 'seekDone' } type - Type of the playback event to listen for.
2544     * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event.
2545     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2546     * @crossplatform
2547     * @atomicservice
2548     * @since 12
2549     */
2550    on(type: 'seekDone', callback: Callback<number>): void;
2551    /**
2552     * Unregister listens for media playback seekDone event.
2553     * @param { 'seekDone' } type - Type of the playback event to listen for.
2554     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2555     * @since 9
2556     */
2557    /**
2558     * Unregister listens for media playback seekDone event.
2559     * @param { 'seekDone' } type - Type of the playback event to listen for.
2560     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2561     * @atomicservice
2562     * @since 11
2563     */
2564    /**
2565     * Unregister listens for media playback seekDone event.
2566     * @param { 'seekDone' } type - Type of the playback event to listen for.
2567     * @param { Callback<number> } callback - Callback used to listen for the playback seekDone event.
2568     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2569     * @crossplatform
2570     * @atomicservice
2571     * @since 12
2572     */
2573    off(type: 'seekDone', callback?: Callback<number>): void;
2574    /**
2575     * Register listens for media playback speedDone event.
2576     * @param { 'speedDone' } type - Type of the playback event to listen for.
2577     * @param { Callback<number> } callback - Callback used to listen for the playback speedDone event.
2578     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2579     * @since 9
2580     */
2581    /**
2582     * Register listens for media playback speedDone event.
2583     * @param { 'speedDone' } type - Type of the playback event to listen for.
2584     * @param { Callback<number> } callback - Callback used to listen for the playback speedDone event.
2585     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2586     * @crossplatform
2587     * @atomicservice
2588     * @since 12
2589     */
2590    on(type: 'speedDone', callback: Callback<number>): void;
2591    /**
2592     * Unregister listens for media playback speedDone event.
2593     * @param { 'speedDone' } type - Type of the playback event to listen for.
2594     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2595     * @since 9
2596     */
2597    /**
2598     * Unregister listens for media playback speedDone event.
2599     * @param { 'speedDone' } type - Type of the playback event to listen for.
2600     * @param { Callback<number> } callback - Callback used to listen for the playback speedDone event.
2601     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2602     * @crossplatform
2603     * @since 12
2604     */
2605    off(type: 'speedDone', callback?: Callback<number>): void;
2606    /**
2607     * Register listens for media playback setBitrateDone event.
2608     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
2609     * @param { Callback<number> } callback - Callback used to listen for the playback setBitrateDone event.
2610     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2611     * @since 9
2612     */
2613    /**
2614     * Register listens for media playback setBitrateDone event.
2615     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
2616     * @param { Callback<number> } callback - Callback used to listen for the playback setBitrateDone event.
2617     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2618     * @atomicservice
2619     * @since 12
2620     */
2621    on(type: 'bitrateDone', callback: Callback<number>): void;
2622    /**
2623     * Unregister listens for media playback setBitrateDone event.
2624     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
2625     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2626     * @since 9
2627     */
2628    /**
2629     * Unregister listens for media playback setBitrateDone event.
2630     * @param { 'bitrateDone' } type - Type of the playback event to listen for.
2631     * @param { Callback<number> } callback - Callback used to listen for the playback setBitrateDone event.
2632     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2633     * @since 12
2634     */
2635    off(type: 'bitrateDone', callback?: Callback<number>): void;
2636    /**
2637     * Register listens for media playback timeUpdate event.
2638     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
2639     * @param { Callback<number> } callback - Callback used to listen for the playback timeUpdate event.
2640     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2641     * @since 9
2642     */
2643    /**
2644     * Register listens for media playback timeUpdate event.
2645     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
2646     * @param { Callback<number> } callback - Callback used to listen for the playback timeUpdate event.
2647     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2648     * @atomicservice
2649     * @since 11
2650     */
2651    /**
2652     * Register listens for media playback timeUpdate event.
2653     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
2654     * @param { Callback<number> } callback - Callback used to listen for the playback timeUpdate event.
2655     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2656     * @crossplatform
2657     * @atomicservice
2658     * @since 12
2659     */
2660    on(type: 'timeUpdate', callback: Callback<number>): void;
2661    /**
2662     * Unregister listens for media playback timeUpdate event.
2663     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
2664     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2665     * @since 9
2666     */
2667    /**
2668     * Unregister listens for media playback timeUpdate event.
2669     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
2670     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2671     * @atomicservice
2672     * @since 11
2673     */
2674    /**
2675     * Unregister listens for media playback timeUpdate event.
2676     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
2677     * @param { Callback<number> } callback - Callback used to listen for the playback timeUpdate event.
2678     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2679     * @crossplatform
2680     * @atomicservice
2681     * @since 12
2682     */
2683    off(type: 'timeUpdate', callback?: Callback<number>): void;
2684    /**
2685     * Register listens for media playback durationUpdate event.
2686     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
2687     * @param { Callback<number> } callback - Callback used to listen for the playback durationUpdate event.
2688     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2689     * @since 9
2690     */
2691    /**
2692     * Register listens for media playback durationUpdate event.
2693     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
2694     * @param { Callback<number> } callback - Callback used to listen for the playback durationUpdate event.
2695     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2696     * @crossplatform
2697     * @atomicservice
2698     * @since 12
2699     */
2700    on(type: 'durationUpdate', callback: Callback<number>): void;
2701    /**
2702     * Unregister listens for media playback durationUpdate event.
2703     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
2704     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2705     * @since 9
2706     */
2707    /**
2708     * Unregister listens for media playback durationUpdate event.
2709     * @param { 'durationUpdate' } type - Type of the playback event to listen for.
2710     * @param { Callback<number> } callback - Callback used to listen for the playback durationUpdate event.
2711     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2712     * @crossplatform
2713     * @since 12
2714     */
2715    off(type: 'durationUpdate', callback?: Callback<number>): void;
2716
2717    /**
2718     * Register listens for video playback buffering events.
2719     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
2720     * @param { function } callback - Callback used to listen for the buffering update event,
2721	   * return BufferingInfoType and the value.
2722     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2723     * @since 9
2724     */
2725    /**
2726     * Register listens for video playback buffering events.
2727     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
2728     * @param { OnBufferingUpdateHandler } callback - Callback used to listen for the buffering update event,
2729	   * return BufferingInfoType and the value.
2730     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2731     * @crossplatform
2732     * @atomicservice
2733     * @since 12
2734     */
2735    on(type: 'bufferingUpdate', callback: OnBufferingUpdateHandler): void;
2736
2737    /**
2738     * Unregister listens for video playback buffering events.
2739     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
2740	   * return BufferingInfoType and the value.
2741     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2742     * @since 9
2743     */
2744    /**
2745     * Unregister listens for video playback buffering events.
2746     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
2747     * @param { OnBufferingUpdateHandler } callback - Callback used to listen for the buffering update event,
2748	   * return BufferingInfoType and the value.
2749     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2750     * @crossplatform
2751     * @atomicservice
2752     * @since 12
2753     */
2754    off(type: 'bufferingUpdate', callback?: OnBufferingUpdateHandler): void;
2755    /**
2756     * Register listens for start render video frame events.
2757     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
2758     * @param { Callback<void> } callback - Callback used to listen for the playback event return .
2759     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2760     * @since 9
2761     */
2762    /**
2763     * Register listens for start render video frame events.
2764     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
2765     * @param { Callback<void> } callback - Callback used to listen for the playback event return .
2766     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2767     * @atomicservice
2768     * @since 12
2769     */
2770    on(type: 'startRenderFrame', callback: Callback<void>): void;
2771    /**
2772     * Unregister listens for start render video frame events.
2773     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
2774     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2775     * @since 9
2776     */
2777    /**
2778     * Unregister listens for start render video frame events.
2779     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
2780     * @param { Callback<void> } callback - Callback used to listen for the playback event return .
2781     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2782     * @since 12
2783     */
2784    off(type: 'startRenderFrame', callback?: Callback<void>): void;
2785
2786    /**
2787     * Register listens for video size change event.
2788     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
2789     * @param { function } callback - Callback used to listen for the playback event return video size.
2790     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2791     * @since 9
2792     */
2793    /**
2794     * Register listens for video size change event.
2795     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
2796     * @param { OnVideoSizeChangeHandler } callback - Callback used to listen for the playback event return video size.
2797     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2798     * @crossplatform
2799     * @atomicservice
2800     * @since 12
2801     */
2802    on(type: 'videoSizeChange', callback: OnVideoSizeChangeHandler): void;
2803    /**
2804     * Unregister listens for video size change event.
2805     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
2806     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2807     * @since 9
2808     */
2809    /**
2810     * Unregister listens for video size change event.
2811     * @param { 'videoSizeChange' } type - Type of the playback event to listen for.
2812     * @param { OnVideoSizeChangeHandler } callback - Callback used to listen for the playback event return video size.
2813     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2814     * @crossplatform
2815     * @atomicservice
2816     * @since 12
2817     */
2818    off(type: 'videoSizeChange', callback?: OnVideoSizeChangeHandler): void;
2819    /**
2820     * Register listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
2821     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
2822     * @param { function } callback - Callback used to listen for the playback event return audio interrupt info.
2823     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2824     * @since 9
2825     */
2826    /**
2827     * Register listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
2828     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
2829     * @param { Callback<audio.InterruptEvent> } callback - Callback used to listen for the playback event return audio interrupt info.
2830     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2831     * @crossplatform
2832     * @atomicservice
2833     * @since 12
2834     */
2835    on(type: 'audioInterrupt', callback: Callback<audio.InterruptEvent>): void;
2836    /**
2837     * Unregister listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
2838     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
2839     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2840     * @since 9
2841     */
2842    /**
2843     * Unregister listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
2844     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
2845     * @param { Callback<audio.InterruptEvent> } callback - Callback used to listen for the playback event return audio interrupt info.
2846     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2847     * @crossplatform
2848     * @atomicservice
2849     * @since 12
2850     */
2851    off(type: 'audioInterrupt', callback?: Callback<audio.InterruptEvent>): void;
2852    /**
2853     * Register listens for available bitrate list collect completed events for HLS protocol stream playback.
2854     * This event will be reported after the {@link #prepare} called.
2855     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
2856     * @param { function } callback - Callback used to listen for the playback event return available bitrate list.
2857     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2858     * @since 9
2859     */
2860    /**
2861     * Register listens for available bitrate list collect completed events for HLS protocol stream playback.
2862     * This event will be reported after the {@link #prepare} called.
2863     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
2864     * @param { Callback<Array<number>> } callback - Callback used to listen for the playback event return available bitrate list.
2865     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2866     * @crossplatform
2867     * @atomicservice
2868     * @since 12
2869     */
2870    on(type: 'availableBitrates', callback: Callback<Array<number>>): void;
2871    /**
2872     * Unregister listens for available bitrate list collect completed events for HLS protocol stream playback.
2873     * This event will be reported after the {@link #prepare} called.
2874     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
2875     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2876     * @since 9
2877     */
2878    /**
2879     * Unregister listens for available bitrate list collect completed events for HLS protocol stream playback.
2880     * This event will be reported after the {@link #prepare} called.
2881     * @param { 'availableBitrates' } type - Type of the playback event to listen for.
2882     * @param { Callback<Array<number>> } callback - Callback used to listen for the playback event return available bitrate list.
2883     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2884     * @crossplatform
2885     * @atomicservice
2886     * @since 12
2887     */
2888    off(type: 'availableBitrates', callback?: Callback<Array<number>>): void;
2889    /**
2890     * Register listens for playback error events.
2891     * @param { 'error' } type - Type of the playback error event to listen for.
2892     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
2893     * @throws { BusinessError } 201 - Permission denied.
2894     * @throws { BusinessError } 401 - The parameter check failed.
2895     * @throws { BusinessError } 801 - Capability not supported.
2896     * @throws { BusinessError } 5400101 - No memory.
2897     * @throws { BusinessError } 5400102 - Operation not allowed.
2898     * @throws { BusinessError } 5400103 - I/O error.
2899     * @throws { BusinessError } 5400104 - Time out.
2900     * @throws { BusinessError } 5400105 - Service died.
2901     * @throws { BusinessError } 5400106 - Unsupported format.
2902     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2903     * @since 9
2904     */
2905    /**
2906     * Register listens for playback error events.
2907     * @param { 'error' } type - Type of the playback error event to listen for.
2908     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
2909     * @throws { BusinessError } 201 - Permission denied.
2910     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2911     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2912     * @throws { BusinessError } 801 - Capability not supported.
2913     * @throws { BusinessError } 5400101 - No memory.
2914     * @throws { BusinessError } 5400102 - Operation not allowed.
2915     * @throws { BusinessError } 5400103 - I/O error.
2916     * @throws { BusinessError } 5400104 - Time out.
2917     * @throws { BusinessError } 5400105 - Service died.
2918     * @throws { BusinessError } 5400106 - Unsupported format.
2919     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2920     * @atomicservice
2921     * @since 11
2922     */
2923    /**
2924     * Register listens for playback error events.
2925     * @param { 'error' } type - Type of the playback error event to listen for.
2926     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
2927     * @throws { BusinessError } 201 - Permission denied.
2928     * @throws { BusinessError } 401 - The parameter check failed.
2929     * @throws { BusinessError } 801 - Capability not supported.
2930     * @throws { BusinessError } 5400101 - No memory.
2931     * @throws { BusinessError } 5400102 - Operation not allowed.
2932     * @throws { BusinessError } 5400103 - I/O error.
2933     * @throws { BusinessError } 5400104 - Time out.
2934     * @throws { BusinessError } 5400105 - Service died.
2935     * @throws { BusinessError } 5400106 - Unsupported format.
2936     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2937     * @crossplatform
2938     * @atomicservice
2939     * @since 12
2940     */
2941    on(type: 'error', callback: ErrorCallback): void;
2942    /**
2943     * Unregister listens for playback error events.
2944     * @param { 'error' } type - Type of the playback error event to listen for.
2945     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2946     * @since 9
2947     */
2948    /**
2949     * Unregister listens for playback error events.
2950     * @param { 'error' } type - Type of the playback error event to listen for.
2951     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2952     * @atomicservice
2953     * @since 11
2954     */
2955    /**
2956     * Unregister listens for playback error events.
2957     * @param { 'error' } type - Type of the playback error event to listen for.
2958     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
2959     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2960     * @crossplatform
2961     * @atomicservice
2962     * @since 12
2963     */
2964    off(type: 'error', callback?: ErrorCallback): void;
2965
2966    /**
2967     * Subscribes output device change event callback.
2968     * The event is triggered when output device change for this stream.
2969     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
2970     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event.
2971     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2972     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2973     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2974     * @since 11
2975     */
2976    /**
2977     * Subscribes output device change event callback.
2978     * The event is triggered when output device change for this stream.
2979     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
2980     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event.
2981     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2982     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2983     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2984     * @atomicservice
2985     * @since 12
2986     */
2987    on(type: 'audioOutputDeviceChangeWithInfo', callback: Callback<audio.AudioStreamDeviceChangeInfo>): void;
2988
2989    /**
2990     * Unsubscribes output device change event callback.
2991     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
2992     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event.
2993     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
2994     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
2995     * @syscap SystemCapability.Multimedia.Media.AVPlayer
2996     * @since 11
2997     */
2998    /**
2999     * Unsubscribes output device change event callback.
3000     * @param { 'audioOutputDeviceChangeWithInfo' } type - Type of the event to listen for.
3001     * @param { Callback<audio.AudioStreamDeviceChangeInfo> } callback - Callback used to listen device change event.
3002     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3003     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3004     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3005     * @atomicservice
3006     * @since 12
3007     */
3008    off(type: 'audioOutputDeviceChangeWithInfo', callback?: Callback<audio.AudioStreamDeviceChangeInfo>): void;
3009
3010    /**
3011     * Subscribes listener for subtitle update event.
3012     * @param { 'subtitleUpdate' } type - Type of the event to listen for.
3013     * @param { Callback<SubtitleInfo> } callback - Callback used to listen subtitle update event.
3014     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3015     * @atomicservice
3016     * @since 12
3017     */
3018    on(type: 'subtitleUpdate', callback: Callback<SubtitleInfo>): void
3019
3020    /**
3021     * Unsubscribes listener for subtitle update event.
3022     * @param { 'subtitleUpdate' } type - Type of the event to listen for.
3023     * @param { Callback<SubtitleInfo> } callback - Callback used to listen subtitle update event.
3024     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3025     * @atomicservice
3026     * @since 12
3027     */
3028    off(type: 'subtitleUpdate', callback?: Callback<SubtitleInfo>): void
3029
3030    /**
3031     * Subscribes listener for track change event.
3032     * @param { 'trackChange' } type - Type of the event to listen for.
3033     * @param { OnTrackChangeHandler } callback - Callback used to listen track change event.
3034     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3035     * @atomicservice
3036     * @since 12
3037     */
3038    on(type: 'trackChange', callback: OnTrackChangeHandler): void
3039
3040    /**
3041     * Unsubscribes listener for track change event.
3042     * @param { 'trackChange' } type - Type of the event to listen for.
3043     * @param { OnTrackChangeHandler } callback - Callback used to listen track change event.
3044     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3045     * @atomicservice
3046     * @since 12
3047     */
3048    off(type: 'trackChange', callback?: OnTrackChangeHandler): void
3049
3050    /**
3051     * Subscribes listener for trackinfo update event.
3052     * @param { 'trackInfoUpdate' } type - Type of the event to listen for.
3053     * @param { Callback<Array<MediaDescription>> } callback - Callback used to listen trackinfo update event.
3054     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3055     * @atomicservice
3056     * @since 12
3057     */
3058    on(type: 'trackInfoUpdate', callback: Callback<Array<MediaDescription>>): void
3059
3060    /**
3061     * Unsubscribes listener for trackinfo update event.
3062     * @param { 'trackInfoUpdate' } type - Type of the event to listen for.
3063     * @param { Callback<Array<MediaDescription>> } callback - Callback used to listen trackinfo update event.
3064     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3065     * @atomicservice
3066     * @since 12
3067     */
3068    off(type: 'trackInfoUpdate', callback?: Callback<Array<MediaDescription>>): void
3069
3070    /**
3071     * Subscrips listener for audio playback amplitude update event.
3072     * In each event, an array of amplitude is reported, large index indicates closer to current time.
3073     * @param { 'amplitudeUpdate' } type - Type of the event to listen for.
3074     * @param { Callback<Array<number>> } callback - Callback used to listen amplitude update event.
3075     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3076     * @since 13
3077     */
3078    on(type: 'amplitudeUpdate', callback: Callback<Array<number>>): void
3079
3080    /**
3081     * UnSubscrips listener for audio playback amplitude update event
3082     * @param { 'amplitudeUpdate' } type - Type of the event to listen for.
3083     * @param { Callback<Array<number>> } callback - Callback used to listen amplitude update event.
3084     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3085     * @since 13
3086     */
3087    off(type: 'amplitudeUpdate', callback?: Callback<Array<number>>): void
3088  }
3089
3090  /**
3091   * Provides player statistic info.
3092   *
3093   * @typedef PlaybackInfo
3094   * @syscap SystemCapability.Multimedia.Media.Core
3095   * @since 12
3096   */
3097  interface PlaybackInfo {
3098    /**
3099     * key:value pair, key see @PlaybackInfoKey.
3100     * @syscap SystemCapability.Multimedia.Media.Core
3101     * @since 12
3102     */
3103    [key:string]: Object;
3104  }
3105
3106  /**
3107   * Enumerates statistics info keys for player.
3108   *
3109   * @enum { string }
3110   * @syscap SystemCapability.Multimedia.Media.Core
3111   * @since 12
3112   */
3113  enum PlaybackInfoKey {
3114    /**
3115     * IP address of current network stream.
3116     * @syscap SystemCapability.Multimedia.Media.Core
3117     * @since 12
3118     */
3119    SERVER_IP_ADDRESS = 'server_ip_address',
3120
3121    /**
3122     * Average download rate during playing except for suspend downloading.
3123     * @syscap SystemCapability.Multimedia.Media.Core
3124     * @since 12
3125     */
3126    AVG_DOWNLOAD_RATE = 'average_download_rate',
3127
3128    /**
3129     * Current download rate of the last second except for suspend downloading.
3130     * @syscap SystemCapability.Multimedia.Media.Core
3131     * @since 12
3132     */
3133    DOWNLOAD_RATE = 'download_rate',
3134
3135    /**
3136     * Boolean value, true for current is downloading, false for suspend downloading.
3137     * @syscap SystemCapability.Multimedia.Media.Core
3138     * @since 12
3139     */
3140    IS_DOWNLOADING = 'is_downloading',
3141
3142    /**
3143     * Cached duration in milliseconds.
3144     * @syscap SystemCapability.Multimedia.Media.Core
3145     * @since 12
3146     */
3147    BUFFER_DURATION = 'buffer_duration',
3148  }
3149
3150  /**
3151   * Enumerates ErrorCode types, return in BusinessError::code
3152   *
3153   * @enum { number }
3154   * @syscap SystemCapability.Multimedia.Media.Core
3155   * @since 8
3156   * @deprecated since 11
3157   * @useinstead ohos.multimedia.media/media.AVErrorCode
3158   */
3159  enum MediaErrorCode {
3160    /**
3161     * operation success.
3162     * @syscap SystemCapability.Multimedia.Media.Core
3163     * @since 8
3164     * @deprecated since 11
3165     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_OK
3166     */
3167    MSERR_OK = 0,
3168
3169    /**
3170     * malloc or new memory failed. maybe system have no memory.
3171     * @syscap SystemCapability.Multimedia.Media.Core
3172     * @since 8
3173     * @deprecated since 11
3174     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_NO_MEMORY
3175     */
3176    MSERR_NO_MEMORY = 1,
3177
3178    /**
3179     * no permission for the operation.
3180     * @syscap SystemCapability.Multimedia.Media.Core
3181     * @since 8
3182     * @deprecated since 11
3183     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_OPERATE_NOT_PERMIT
3184     */
3185    MSERR_OPERATION_NOT_PERMIT = 2,
3186
3187    /**
3188     * invalid argument.
3189     * @syscap SystemCapability.Multimedia.Media.Core
3190     * @since 8
3191     * @deprecated since 11
3192     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER
3193     */
3194    MSERR_INVALID_VAL = 3,
3195
3196    /**
3197     * an I/O error occurred.
3198     * @syscap SystemCapability.Multimedia.Media.Core
3199     * @since 8
3200     * @deprecated since 11
3201     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_IO
3202     */
3203    MSERR_IO = 4,
3204
3205    /**
3206     * operation time out.
3207     * @syscap SystemCapability.Multimedia.Media.Core
3208     * @since 8
3209     * @deprecated since 11
3210     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_TIMEOUT
3211     */
3212    MSERR_TIMEOUT = 5,
3213
3214    /**
3215     * unknown error.
3216     * @syscap SystemCapability.Multimedia.Media.Core
3217     * @since 8
3218     * @deprecated since 11
3219     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER
3220     */
3221    MSERR_UNKNOWN = 6,
3222
3223    /**
3224     * media service died.
3225     * @syscap SystemCapability.Multimedia.Media.Core
3226     * @since 8
3227     * @deprecated since 11
3228     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_SERVICE_DIED
3229     */
3230    MSERR_SERVICE_DIED = 7,
3231
3232    /**
3233     * operation is not permit in current state.
3234     * @syscap SystemCapability.Multimedia.Media.Core
3235     * @since 8
3236     * @deprecated since 11
3237     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_INVALID_PARAMETER
3238     */
3239    MSERR_INVALID_STATE = 8,
3240
3241    /**
3242     * operation is not supported in current version.
3243     * @syscap SystemCapability.Multimedia.Media.Core
3244     * @since 8
3245     * @deprecated since 11
3246     * @useinstead ohos.multimedia.media/media.AVErrorCode#AVERR_UNSUPPORT_CAPABILITY
3247     */
3248    MSERR_UNSUPPORTED = 9,
3249  }
3250
3251  /**
3252   * Enumerates buffering info type, for network playback.
3253   *
3254   * @enum { number }
3255   * @syscap SystemCapability.Multimedia.Media.Core
3256   * @since 8
3257   */
3258  /**
3259   * Enumerates buffering info type, for network playback.
3260   *
3261   * @enum { number }
3262   * @syscap SystemCapability.Multimedia.Media.Core
3263   * @crossplatform
3264   * @atomicservice
3265   * @since 12
3266   */
3267  enum BufferingInfoType {
3268    /**
3269     * begin to buffering
3270     * @syscap SystemCapability.Multimedia.Media.Core
3271     * @since 8
3272     */
3273    /**
3274     * begin to buffering
3275     * @syscap SystemCapability.Multimedia.Media.Core
3276     * @crossplatform
3277     * @atomicservice
3278     * @since 12
3279     */
3280    BUFFERING_START = 1,
3281
3282    /**
3283     * end to buffering
3284     * @syscap SystemCapability.Multimedia.Media.Core
3285     * @since 8
3286     */
3287    /**
3288     * end to buffering
3289     * @syscap SystemCapability.Multimedia.Media.Core
3290     * @crossplatform
3291     * @atomicservice
3292     * @since 12
3293     */
3294    BUFFERING_END = 2,
3295
3296    /**
3297     * buffering percent
3298     * @syscap SystemCapability.Multimedia.Media.Core
3299     * @since 8
3300     */
3301    /**
3302     * buffering percent
3303     * @syscap SystemCapability.Multimedia.Media.Core
3304     * @crossplatform
3305     * @atomicservice
3306     * @since 12
3307     */
3308    BUFFERING_PERCENT = 3,
3309
3310    /**
3311     * cached duration in milliseconds
3312     * @syscap SystemCapability.Multimedia.Media.Core
3313     * @since 8
3314     */
3315    /**
3316     * cached duration in milliseconds
3317     * @syscap SystemCapability.Multimedia.Media.Core
3318     * @crossplatform
3319     * @atomicservice
3320     * @since 12
3321     */
3322    CACHED_DURATION = 4,
3323  }
3324
3325  /**
3326   * Media source descriptor. User can set media data information
3327
3328   * @typedef MediaSource
3329   * @syscap SystemCapability.Multimedia.Media.Core
3330   * @atomicservice
3331   * @since 12
3332   */
3333  interface MediaSource {
3334    /**
3335     * Set Media Mime Type to help player handle extended Media source.
3336     * @param { AVMimeTypes } mimeType - for MediaSource define. see @ AVMimeTypes.
3337     * @syscap SystemCapability.Multimedia.Media.Core
3338     * @atomicservice
3339     * @since 12
3340     */
3341    setMimeType(mimeType: AVMimeTypes): void;
3342  }
3343
3344  /**
3345   * Enumerates Media Mime types, used for MediaSource define;
3346   * @enum { string }
3347   * @syscap SystemCapability.Multimedia.Media.Core
3348   * @atomicservice
3349   * @since 12
3350   */
3351  enum AVMimeTypes {
3352    /**
3353     * Indicate current file is index file for hls Media.
3354     * @syscap SystemCapability.Multimedia.Media.Core
3355     * @atomicservice
3356     * @since 12
3357     */
3358    APPLICATION_M3U8 = 'application/m3u8',
3359  }
3360  /**
3361   * Provides preferred playback settings for player.
3362   *
3363   * @typedef PlaybackStrategy
3364   * @syscap SystemCapability.Multimedia.Media.Core
3365   * @atomicservice
3366   * @since 12
3367   */
3368  interface PlaybackStrategy {
3369    /**
3370     * Choose a stream with width close to it.
3371     * @type { ?number }
3372     * @syscap SystemCapability.Multimedia.Media.Core
3373     * @atomicservice
3374     * @since 12
3375     */
3376    preferredWidth?: number;
3377    /**
3378     * Choose a stream with height close to it.
3379     * @type { ?number }
3380     * @syscap SystemCapability.Multimedia.Media.Core
3381     * @atomicservice
3382     * @since 12
3383     */
3384    preferredHeight?: number;
3385    /**
3386     * Choose a preferred buffer duration.
3387     * @type { ?number }
3388     * @syscap SystemCapability.Multimedia.Media.Core
3389     * @atomicservice
3390     * @since 12
3391     */
3392    preferredBufferDuration?: number;
3393
3394    /**
3395     * If true, the player should choose HDR stream if exist.
3396     * @type { ?boolean }
3397     * @syscap SystemCapability.Multimedia.Media.Core
3398     * @atomicservice
3399     * @since 12
3400     */
3401    preferredHdr?: boolean;
3402
3403    /**
3404     * mute the specified media stream when playing.
3405     * @type { ?MediaType }
3406     * @syscap SystemCapability.Multimedia.Media.Core
3407     * @since 12
3408     */
3409    mutedMediaType?: MediaType;
3410
3411    /**
3412     * Audio language.
3413     * @type { ?string }
3414     * @syscap SystemCapability.Multimedia.Media.Core
3415     * @atomicservice
3416     * @since 13
3417     */
3418    preferredAudioLanguage?: string;
3419
3420    /**
3421     * Subtitle language.
3422     * @type { ?string }
3423     * @syscap SystemCapability.Multimedia.Media.Core
3424     * @atomicservice
3425     * @since 13
3426     */
3427    preferredSubtitleLanguage?: string;
3428  }
3429
3430  /**
3431   * Media file descriptor. The caller needs to ensure that the fd is valid and
3432   * the offset and length are correct.
3433   *
3434   * @typedef AVFileDescriptor
3435   * @syscap SystemCapability.Multimedia.Media.Core
3436   * @since 9
3437   */
3438  /**
3439   * Media file descriptor. The caller needs to ensure that the fd is valid and
3440   * the offset and length are correct.
3441   *
3442   * @typedef AVFileDescriptor
3443   * @syscap SystemCapability.Multimedia.Media.Core
3444   * @atomicservice
3445   * @since 11
3446   */
3447  /**
3448   * Media file descriptor. The caller needs to ensure that the fd is valid and
3449   * the offset and length are correct.
3450   *
3451   * @typedef AVFileDescriptor
3452   * @syscap SystemCapability.Multimedia.Media.Core
3453   * @crossplatform
3454   * @atomicservice
3455   * @since 12
3456   */
3457  interface AVFileDescriptor {
3458    /**
3459     * The file descriptor of audio or video source from file system. The caller
3460     * is responsible to close the file descriptor.
3461     * @syscap SystemCapability.Multimedia.Media.Core
3462     * @since 9
3463     */
3464    /**
3465     * The file descriptor of audio or video source from file system. The caller
3466     * is responsible to close the file descriptor.
3467     * @syscap SystemCapability.Multimedia.Media.Core
3468     * @atomicservice
3469     * @since 11
3470     */
3471    /**
3472     * The file descriptor of audio or video source from file system. The caller
3473     * is responsible to close the file descriptor.
3474     * @type { number }
3475     * @syscap SystemCapability.Multimedia.Media.Core
3476     * @crossplatform
3477     * @atomicservice
3478     * @since 12
3479     */
3480    fd: number
3481
3482    /**
3483     * The offset into the file where the data to be read, in bytes. By default,
3484     * the offset is zero.
3485     * @syscap SystemCapability.Multimedia.Media.Core
3486     * @since 9
3487     */
3488    /**
3489     * The offset into the file where the data to be read, in bytes. By default,
3490     * the offset is zero.
3491     * @syscap SystemCapability.Multimedia.Media.Core
3492     * @atomicservice
3493     * @since 11
3494     */
3495    /**
3496     * The offset into the file where the data to be read, in bytes. By default,
3497     * the offset is zero.
3498     * @type { ?number }
3499     * @syscap SystemCapability.Multimedia.Media.Core
3500     * @crossplatform
3501     * @atomicservice
3502     * @since 12
3503     */
3504    offset?: number
3505
3506    /**
3507     * The length in bytes of the data to be read. By default, the length is the
3508     * rest of bytes in the file from the offset.
3509     * @syscap SystemCapability.Multimedia.Media.Core
3510     * @since 9
3511     */
3512    /**
3513     * The length in bytes of the data to be read. By default, the length is the
3514     * rest of bytes in the file from the offset.
3515     * @syscap SystemCapability.Multimedia.Media.Core
3516     * @atomicservice
3517     * @since 11
3518     */
3519    /**
3520     * The length in bytes of the data to be read. By default, the length is the
3521     * rest of bytes in the file from the offset.
3522     * @type { ?number }
3523     * @syscap SystemCapability.Multimedia.Media.Core
3524     * @crossplatform
3525     * @atomicservice
3526     * @since 12
3527     */
3528    length?: number
3529  }
3530
3531  /**
3532    * DataSource descriptor. The caller needs to ensure that the fileSize and
3533    * callback is valid.
3534    *
3535    * @typedef AVDataSrcDescriptor
3536    * @syscap SystemCapability.Multimedia.Media.AVPlayer
3537    * @since 10
3538    */
3539  /**
3540   * DataSource descriptor. The caller needs to ensure that the fileSize and
3541   * callback is valid.
3542   *
3543   * @typedef AVDataSrcDescriptor
3544   * @syscap SystemCapability.Multimedia.Media.AVPlayer
3545   * @atomicservice
3546   * @since 11
3547   */
3548  /**
3549   * DataSource descriptor. The caller needs to ensure that the fileSize and
3550   * callback is valid.
3551   *
3552   * @typedef AVDataSrcDescriptor
3553   * @syscap SystemCapability.Multimedia.Media.AVPlayer
3554   * @crossplatform
3555   * @atomicservice
3556   * @since 12
3557   */
3558  interface AVDataSrcDescriptor {
3559    /**
3560     * Size of the file, -1 means the file size is unknown, in this case,
3561     * seek and setSpeed can't be executed, loop can't be set, and can't replay.
3562     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3563     * @since 10
3564     */
3565    /**
3566     * Size of the file, -1 means the file size is unknown, in this case,
3567     * seek and setSpeed can't be executed, loop can't be set, and can't replay.
3568     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3569     * @atomicservice
3570     * @since 11
3571     */
3572    /**
3573     * Size of the file, -1 means the file size is unknown, in this case,
3574     * seek and setSpeed can't be executed, loop can't be set, and can't replay.
3575     * @type { number }
3576     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3577     * @crossplatform
3578     * @atomicservice
3579     * @since 12
3580     */
3581    fileSize: number;
3582    /**
3583     * Callback function implemented by users, which is used to fill data.
3584     * buffer - The buffer need to fill.
3585     * length - The stream length player want to get.
3586     * pos - The stream position player want get start, and is an optional parameter.
3587     * When fileSize set to -1, this parameter is not used.
3588     * Returns length of the data to be filled.
3589     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3590     * @since 10
3591     */
3592    /**
3593     * Callback function implemented by users, which is used to fill data.
3594     * buffer - The buffer need to fill.
3595     * length - The stream length player want to get.
3596     * pos - The stream position player want get start, and is an optional parameter.
3597     * When fileSize set to -1, this parameter is not used.
3598     * Returns length of the data to be filled.
3599     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3600     * @atomicservice
3601     * @since 11
3602     */
3603    /**
3604     * Callback function implemented by users, which is used to fill data.
3605     * buffer - The buffer need to fill.
3606     * length - The stream length player want to get.
3607     * pos - The stream position player want get start, and is an optional parameter.
3608     * When fileSize set to -1, this parameter is not used.
3609     * Returns length of the data to be filled.
3610     * @type { function }
3611     * @syscap SystemCapability.Multimedia.Media.AVPlayer
3612     * @crossplatform
3613     * @atomicservice
3614     * @since 12
3615     */
3616    callback: (buffer: ArrayBuffer, length: number, pos?: number) => number;
3617  }
3618
3619  /**
3620   * Provides subtitle information.
3621   * Can be synchronized to the time reported by AVPlayer#timeUpdate event
3622   *
3623   * @typedef SubtitleInfo
3624   * @syscap SystemCapability.Multimedia.Media.Core
3625   * @atomicservice
3626   * @since 12
3627   */
3628  interface SubtitleInfo {
3629    /**
3630     * Duration of the text to be displayed, as milliseconds.
3631     * @type { ?number }
3632     * @syscap SystemCapability.Multimedia.Media.Core
3633     * @atomicservice
3634     * @since 12
3635     */
3636    duration?: number;
3637    /**
3638     * Display start time of the text, as milliseconds.
3639     * @type { ?number }
3640     * @syscap SystemCapability.Multimedia.Media.Core
3641     * @atomicservice
3642     * @since 12
3643     */
3644    startTime?: number;
3645    /**
3646     * Text information of current update event.
3647     * @type { ?string }
3648     * @syscap SystemCapability.Multimedia.Media.Core
3649     * @atomicservice
3650     * @since 12
3651     */
3652    text?: string;
3653  }
3654
3655  /**
3656   * Describes audio playback states.
3657   * @typedef { 'idle' | 'playing' | 'paused' | 'stopped' | 'error' }
3658   * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3659   * @since 6
3660   * @deprecated since 9
3661   * @useinstead ohos.multimedia.media/media.AVPlayerState
3662   */
3663  type AudioState = 'idle' | 'playing' | 'paused' | 'stopped' | 'error';
3664
3665  /**
3666   * Manages and plays audio. Before calling an AudioPlayer method, you must use createAudioPlayer()
3667   * to create an AudioPlayer instance.
3668   *
3669   * @typedef AudioPlayer
3670   * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3671   * @since 6
3672   * @deprecated since 9
3673   * @useinstead ohos.multimedia.media/media.AVPlayer
3674   */
3675  interface AudioPlayer {
3676    /**
3677     * Starts audio playback.
3678     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3679     * @since 6
3680     * @deprecated since 9
3681     * @useinstead ohos.multimedia.media/media.AVPlayer#play
3682     */
3683    play(): void;
3684
3685    /**
3686     * Pauses audio playback.
3687     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3688     * @since 6
3689     * @deprecated since 9
3690     * @useinstead ohos.multimedia.media/media.AVPlayer#pause
3691     */
3692    pause(): void;
3693
3694    /**
3695     * Stops audio playback.
3696     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3697     * @since 6
3698     * @deprecated since 9
3699     * @useinstead ohos.multimedia.media/media.AVPlayer#stop
3700     */
3701    stop(): void;
3702
3703    /**
3704     * Resets audio playback.
3705     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3706     * @since 7
3707     * @deprecated since 9
3708     * @useinstead ohos.multimedia.media/media.AVPlayer#reset
3709     */
3710    reset(): void;
3711
3712    /**
3713     * Jumps to the specified playback position.
3714     * @param { number } timeMs - Playback position to jump
3715     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3716     * @since 6
3717     * @deprecated since 9
3718     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
3719     */
3720    seek(timeMs: number): void;
3721
3722    /**
3723     * Sets the volume.
3724     * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
3725     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3726     * @since 6
3727     * @deprecated since 9
3728     * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume
3729     */
3730    setVolume(vol: number): void;
3731
3732    /**
3733     * Releases resources used for audio playback.
3734     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3735     * @since 6
3736     * @deprecated since 9
3737     * @useinstead ohos.multimedia.media/media.AVPlayer#release
3738     */
3739    release(): void;
3740
3741    /**
3742     * Get all track infos in MediaDescription, should be called after data loaded callback.
3743     * @param { AsyncCallback<Array<MediaDescription>> } callback - async callback return track info in MediaDescription.
3744     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3745     * @since 8
3746     * @deprecated since 9
3747     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
3748     */
3749    getTrackDescription(callback: AsyncCallback<Array<MediaDescription>>): void;
3750
3751    /**
3752     * Get all track infos in MediaDescription, should be called after data loaded callback.
3753     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
3754     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3755     * @since 8
3756     * @deprecated since 9
3757     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
3758     */
3759    getTrackDescription(): Promise<Array<MediaDescription>>;
3760
3761    /**
3762     * Listens for audio playback buffering events.
3763     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
3764     * @param { function } callback - Callback used to listen for the buffering update event,
3765	 * return BufferingInfoType and the value.
3766     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3767     * @since 8
3768     * @deprecated since 9
3769     * @useinstead ohos.multimedia.media/media.AVPlayer#event:bufferingUpdate
3770     */
3771    on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
3772
3773    /**
3774     * Audio media URI. Mainstream audio formats are supported.
3775     * local:fd://XXX, file://XXX. network:http://xxx
3776     * @type { string }
3777     * @permission ohos.permission.READ_MEDIA or ohos.permission.INTERNET
3778     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3779     * @since 6
3780     * @deprecated since 9
3781     * @useinstead ohos.multimedia.media/media.AVPlayer#url
3782     */
3783    src: string;
3784
3785    /**
3786     * Audio file descriptor. Mainstream audio formats are supported.
3787     * @type { AVFileDescriptor }
3788     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3789     * @since 9
3790     * @deprecated since 9
3791     * @useinstead ohos.multimedia.media/media.AVPlayer#fdSrc
3792     */
3793    fdSrc: AVFileDescriptor;
3794
3795    /**
3796     * Whether to loop audio playback. The value true means to loop playback.
3797     * @type { boolean }
3798     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3799     * @since 6
3800     * @deprecated since 9
3801     * @useinstead ohos.multimedia.media/media.AVPlayer#loop
3802     */
3803    loop: boolean;
3804
3805    /**
3806     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
3807     * set, the default mode will be used. Set it before calling the {@link #play()} in the
3808     * first time in order for the interrupt mode to become effective thereafter.
3809     * @type { ?audio.InterruptMode }
3810     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3811     * @since 9
3812     * @deprecated since 9
3813     * @useinstead ohos.multimedia.media/media.AVPlayer#audioInterruptMode
3814     */
3815    audioInterruptMode?: audio.InterruptMode;
3816
3817    /**
3818     * Current playback position.
3819     * @type { number }
3820     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3821     * @since 6
3822     * @deprecated since 9
3823     * @useinstead ohos.multimedia.media/media.AVPlayer#currentTime
3824     */
3825    readonly currentTime: number;
3826
3827    /**
3828     * Playback duration, When the data source does not support seek, it returns - 1, such as a live broadcast scenario.
3829     * @type { number }
3830     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3831     * @since 6
3832     * @deprecated since 9
3833     * @useinstead ohos.multimedia.media/media.AVPlayer#duration
3834     */
3835    readonly duration: number;
3836
3837    /**
3838     * Playback state.
3839     * @type { AudioState }
3840     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3841     * @since 6
3842     * @deprecated since 9
3843     * @useinstead ohos.multimedia.media/media.AVPlayer#state
3844     */
3845    readonly state: AudioState;
3846
3847    /**
3848     * Listens for audio playback events.
3849     * @param { 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange' } type - Type of the playback event to listen for.
3850     * @param { function } callback - Callback used to listen for the playback event.
3851     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3852     * @since 6
3853     * @deprecated since 9
3854     * @useinstead ohos.multimedia.media/media.AVPlayer#event:stateChange
3855     */
3856    on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeChange', callback: () => void): void;
3857
3858    /**
3859     * Listens for audio playback events.
3860     * @param { 'timeUpdate' } type - Type of the playback event to listen for.
3861     * @param { Callback<number> } callback - Callback used to listen for the playback event.
3862     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3863     * @since 6
3864     * @deprecated since 9
3865     * @useinstead ohos.multimedia.media/media.AVPlayer#event:timeUpdate
3866     */
3867    on(type: 'timeUpdate', callback: Callback<number>): void;
3868
3869    /**
3870     * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
3871     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
3872     * @param { function } callback - Callback used to listen for the playback event return audio interrupt info.
3873     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3874     * @since 9
3875     * @deprecated since 9
3876     * @useinstead ohos.multimedia.media/media.AVPlayer#event:audioInterrupt
3877     */
3878    on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
3879
3880    /**
3881     * Listens for playback error events.
3882     * @param { 'error' } type - Type of the playback error event to listen for.
3883     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
3884     * @syscap SystemCapability.Multimedia.Media.AudioPlayer
3885     * @since 6
3886     * @deprecated since 9
3887     * @useinstead ohos.multimedia.media/media.AVPlayer#event:error
3888     */
3889    on(type: 'error', callback: ErrorCallback): void;
3890  }
3891
3892  /**
3893  * Describes media recorder states.
3894  * @typedef {'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error'}
3895  * @syscap SystemCapability.Multimedia.Media.AVRecorder
3896  * @since 9
3897  */
3898  /**
3899  * Describes media recorder states.
3900  * @typedef {'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error'}
3901  * @syscap SystemCapability.Multimedia.Media.AVRecorder
3902  * @crossplatform
3903  * @atomicservice
3904  * @since 12
3905  */
3906  type AVRecorderState = 'idle' | 'prepared' | 'started' | 'paused' | 'stopped' | 'released' | 'error';
3907
3908  /**
3909   * Defines the onMove callback.
3910   *
3911   * @typedef { function } OnAVRecorderStateChangeHandler
3912   * @param { AVRecorderState } state - state value for AVRecorder.
3913   * @param { StateChangeReason } reason - reason for state change.
3914   * @syscap SystemCapability.Multimedia.Media.AVPlayer
3915   * @crossplatform
3916   * @atomicservice
3917   * @since 12
3918   */
3919  type OnAVRecorderStateChangeHandler = (state: AVRecorderState, reason: StateChangeReason) => void;
3920
3921  /**
3922   * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder()
3923   * to create an AVRecorder instance.
3924   *
3925   * @typedef AVRecorder
3926   * @syscap SystemCapability.Multimedia.Media.AVRecorder
3927   * @since 9
3928   */
3929  /**
3930   * Manages and record audio/video. Before calling an AVRecorder method, you must use createAVRecorder()
3931   * to create an AVRecorder instance.
3932   *
3933   * @typedef AVRecorder
3934   * @syscap SystemCapability.Multimedia.Media.AVRecorder
3935   * @crossplatform
3936   * @atomicservice
3937   * @since 12
3938   */
3939  interface AVRecorder {
3940    /**
3941     * Prepares for recording.
3942     * @permission ohos.permission.MICROPHONE
3943     * @param { AVRecorderConfig } config - Recording parameters.
3944     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
3945     * @throws { BusinessError } 201 - Permission denied. Return by callback.
3946     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3947     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3948     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
3949     * @throws { BusinessError } 5400105 - Service died. Return by callback.
3950     * @syscap SystemCapability.Multimedia.Media.AVRecorder
3951     * @since 9
3952     */
3953    /**
3954     * Prepares for recording.
3955     * @permission ohos.permission.MICROPHONE
3956     * @param { AVRecorderConfig } config - Recording parameters.
3957     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
3958     * @throws { BusinessError } 201 - Permission denied. Return by callback.
3959     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3960     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3961     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
3962     * @throws { BusinessError } 5400105 - Service died. Return by callback.
3963     * @syscap SystemCapability.Multimedia.Media.AVRecorder
3964     * @crossplatform
3965     * @since 12
3966     */
3967    prepare(config: AVRecorderConfig, callback: AsyncCallback<void>): void;
3968
3969    /**
3970     * Prepares for recording.
3971     * @permission ohos.permission.MICROPHONE
3972     * @param { AVRecorderConfig } config - Recording parameters.
3973     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
3974     * @throws { BusinessError } 201 - Permission denied. Return by promise.
3975     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
3976     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
3977     * @throws { BusinessError } 5400105 - Service died. Return by promise.
3978     * @syscap SystemCapability.Multimedia.Media.AVRecorder
3979     * @since 9
3980     */
3981    /**
3982     * Prepares for recording.
3983     * @permission ohos.permission.MICROPHONE
3984     * @param { AVRecorderConfig } config - Recording parameters.
3985     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
3986     * @throws { BusinessError } 201 - Permission denied. Return by promise.
3987     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
3988     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
3989     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
3990     * @throws { BusinessError } 5400105 - Service died. Return by promise.
3991     * @syscap SystemCapability.Multimedia.Media.AVRecorder
3992     * @crossplatform
3993     * @atomicservice
3994     * @since 12
3995     */
3996    prepare(config: AVRecorderConfig): Promise<void>;
3997
3998    /**
3999     * Get AVRecorderConfig.it must be called after prepare.
4000     * @param { AsyncCallback<AVRecorderConfig> } callback - Callback used to return the input config in AVRecorderConfig.
4001     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4002     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4003     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4004     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4005     * @since 11
4006     */
4007    getAVRecorderConfig(callback: AsyncCallback<AVRecorderConfig>): void;
4008
4009    /**
4010     * Get AVRecorderConfig.it must be called after prepare.
4011     * @returns { Promise<AVRecorderConfig> } A Promise instance used to return the input config in AVRecorderConfig.
4012     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4013     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4014     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4015     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4016     * @since 11
4017     */
4018    getAVRecorderConfig(): Promise<AVRecorderConfig>;
4019
4020    /**
4021     * Get input surface.it must be called between prepare completed and start.
4022     * @param { AsyncCallback<string> } callback - Callback used to return the input surface id in string.
4023     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4024     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4025     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4026     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4027     * @since 9
4028     */
4029    getInputSurface(callback: AsyncCallback<string>): void;
4030
4031    /**
4032     * Get input surface. it must be called between prepare completed and start.
4033     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
4034     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4035     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4036     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4037     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4038     * @since 9
4039     */
4040    getInputSurface(): Promise<string>;
4041
4042    /**
4043     * Get input meta surface for specified meta source type. it must be called between prepare completed and start.
4044     * @param { MetaSourceType } type - Meta source type.
4045     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
4046     * @throws { BusinessError } 202 - Called from Non-System applications. Return by promise.
4047     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
4048     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
4049     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4050     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4051     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4052     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4053     * @systemapi
4054     * @since 12
4055     */
4056    getInputMetaSurface(type: MetaSourceType): Promise<string>;
4057
4058    /**
4059     * Check if the avrecorder has watermark capability.
4060     * @returns { Promise<boolean> } A Promise instance used to return true or false when the function is finished.
4061     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4062     * @systemapi
4063     * @since 13
4064     */
4065    isWatermarkSupported(): Promise<boolean>;
4066    /**
4067     * Set watermark image to recorder.
4068     * @param { image.PixelMap } watermark : Watermark image.
4069     * @param { WatermarkConfig } config : Configures of the watermark.
4070     * @returns { Promise<void> } A Promise instance used to return when the function is finished.
4071     * @throws { BusinessError } 401 - The parameter check failed.
4072     * @throws { BusinessError } 801 - Capability not supported.
4073     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4074     * @systemapi
4075     * @since 13
4076     */
4077    setWatermark(watermark: image.PixelMap, config: WatermarkConfig): Promise<void>
4078    /**
4079     * Update the video orientation before recorder start.
4080     * @param { number } rotation - Rotation angle, should be [0, 90, 180, 270].
4081     * @returns { Promise<void> } A Promise instance used to return when the function is finished.
4082     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
4083     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
4084     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
4085     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4086     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4087     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4088     * @since 12
4089     */
4090    updateRotation(rotation: number): Promise<void>;
4091
4092    /**
4093     * Start AVRecorder, it will to started state.
4094     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
4095     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4096     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4097     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4098     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4099     * @since 9
4100     */
4101    /**
4102     * Start AVRecorder, it will to started state.
4103     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
4104     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4105     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4106     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4107     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4108     * @crossplatform
4109     * @since 12
4110     */
4111    start(callback: AsyncCallback<void>): void;
4112
4113    /**
4114     * Start AVRecorder, it will to started state.
4115     * @returns { Promise<void> } A Promise instance used to return when start completed.
4116     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4117     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4118     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4119     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4120     * @since 9
4121     */
4122    /**
4123     * Start AVRecorder, it will to started state.
4124     * @returns { Promise<void> } A Promise instance used to return when start completed.
4125     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4126     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4127     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4128     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4129     * @crossplatform
4130     * @atomicservice
4131     * @since 12
4132     */
4133    start(): Promise<void>;
4134
4135    /**
4136     * Start AVRecorder, it will to paused state.
4137     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
4138     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4139     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4140     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4141     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4142     * @since 9
4143     */
4144    /**
4145     * Start AVRecorder, it will to paused state.
4146     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
4147     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4148     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4149     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4150     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4151     * @crossplatform
4152     * @since 12
4153     */
4154    pause(callback: AsyncCallback<void>): void;
4155
4156    /**
4157     * Start AVRecorder, it will to paused state.
4158     * @returns { Promise<void> } A Promise instance used to return when pause completed.
4159     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4160     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4161     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4162     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4163     * @since 9
4164     */
4165    /**
4166     * Start AVRecorder, it will to paused state.
4167     * @returns { Promise<void> } A Promise instance used to return when pause completed.
4168     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4169     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4170     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4171     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4172     * @crossplatform
4173     * @atomicservice
4174     * @since 12
4175     */
4176    pause(): Promise<void>;
4177
4178    /**
4179     * Resume AVRecorder, it will to started state.
4180     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
4181     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4182     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4183     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4184     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4185     * @since 9
4186     */
4187    /**
4188     * Resume AVRecorder, it will to started state.
4189     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
4190     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4191     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4192     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4193     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4194     * @crossplatform
4195     * @since 12
4196     */
4197    resume(callback: AsyncCallback<void>): void;
4198
4199    /**
4200     * Resume AVRecorder, it will to started state.
4201     * @returns { Promise<void> } A Promise instance used to return when resume completed.
4202     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4203     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4204     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4205     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4206     * @since 9
4207     */
4208    /**
4209     * Resume AVRecorder, it will to started state.
4210     * @returns { Promise<void> } A Promise instance used to return when resume completed.
4211     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4212     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4213     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4214     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4215     * @crossplatform
4216     * @atomicservice
4217     * @since 12
4218     */
4219    resume(): Promise<void>;
4220
4221    /**
4222     * Stop AVRecorder, it will to stopped state.
4223     * @param { AsyncCallback<void> } callback - A callback instance used to return when stop completed.
4224     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4225     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4226     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4227     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4228     * @since 9
4229     */
4230    /**
4231     * Stop AVRecorder, it will to stopped state.
4232     * @param { AsyncCallback<void> } callback - A callback instance used to return when stop completed.
4233     * @throws { BusinessError } 5400102 - Operate not permit. Return by callback.
4234     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4235     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4236     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4237     * @crossplatform
4238     * @since 12
4239     */
4240    stop(callback: AsyncCallback<void>): void;
4241
4242    /**
4243     * Stop AVRecorder, it will to stopped state.
4244     * @returns { Promise<void> } A Promise instance used to return when stop completed.
4245     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4246     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4247     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4248     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4249     * @since 9
4250     */
4251    /**
4252     * Stop AVRecorder, it will to stopped state.
4253     * @returns { Promise<void> } A Promise instance used to return when stop completed.
4254     * @throws { BusinessError } 5400102 - Operate not permit. Return by promise.
4255     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4256     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4257     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4258     * @crossplatform
4259     * @atomicservice
4260     * @since 12
4261     */
4262    stop(): Promise<void>;
4263
4264    /**
4265     * Reset AVRecorder, it will to idle state.
4266     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
4267     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4268     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4269     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4270     * @since 9
4271     */
4272    /**
4273     * Reset AVRecorder, it will to idle state.
4274     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
4275     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4276     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4277     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4278     * @crossplatform
4279     * @since 12
4280     */
4281    reset(callback: AsyncCallback<void>): void;
4282
4283    /**
4284     * Reset AVRecorder, it will to idle state.
4285     * @returns { Promise<void> } A Promise instance used to return when reset completed.
4286     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4287     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4288     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4289     * @since 9
4290     */
4291    /**
4292     * Reset AVRecorder, it will to idle state.
4293     * @returns { Promise<void> } A Promise instance used to return when reset completed.
4294     * @throws { BusinessError } 5400103 - IO error. Return by promise.
4295     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4296     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4297     * @crossplatform
4298     * @since 12
4299     */
4300    reset(): Promise<void>;
4301
4302    /**
4303     * Releases resources used for AVRecorder, it will to released state.
4304     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
4305     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4306     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4307     * @since 9
4308     */
4309    /**
4310     * Releases resources used for AVRecorder, it will to released state.
4311     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
4312     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4313     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4314     * @crossplatform
4315     * @since 12
4316     */
4317    release(callback: AsyncCallback<void>): void;
4318
4319    /**
4320     * Releases resources used for AVRecorder, it will to released state.
4321     * @returns { Promise<void> } A Promise instance used to return when release completed.
4322     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4323     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4324     * @since 9
4325     */
4326    /**
4327     * Releases resources used for AVRecorder, it will to released state.
4328     * @returns { Promise<void> } A Promise instance used to return when release completed.
4329     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4330     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4331     * @crossplatform
4332     * @atomicservice
4333     * @since 12
4334     */
4335    release(): Promise<void>;
4336
4337    /**
4338     * Get AudioCapturer info from current AVRecorder.
4339     * @param { AsyncCallback<audio.AudioCapturerChangeInfo> } callback - A callback used to return AudioCapturerChangeInfo.
4340     * @throws { BusinessError } 5400102 - Operation not allowed.
4341     * @throws { BusinessError } 5400103 - I/O error.
4342     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4343     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4344     * @since 11
4345     */
4346    getCurrentAudioCapturerInfo(callback: AsyncCallback<audio.AudioCapturerChangeInfo>): void;
4347
4348    /**
4349     * Get AudioCapturer info from current AVRecorder.
4350     * @returns { Promise<audio.AudioCapturerChangeInfo> } A Promise instance used to return AudioCapturerChangeInfo.
4351     * @throws { BusinessError } 5400102 - Operation not allowed.
4352     * @throws { BusinessError } 5400103 - I/O error.
4353     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4354     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4355     * @since 11
4356     */
4357    getCurrentAudioCapturerInfo(): Promise<audio.AudioCapturerChangeInfo>;
4358
4359    /**
4360     * Get max audio capturer amplitude from current AVRecorder.
4361     * @param { AsyncCallback<number> } callback - A callback used to return max Amplitude.
4362     * @throws { BusinessError } 5400102 - Operation not allowed.
4363     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4364     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4365     * @since 11
4366     */
4367    getAudioCapturerMaxAmplitude(callback: AsyncCallback<number>): void;
4368
4369    /**
4370     * Get max audio capturer amplitude from current AVRecorder.
4371     * @returns { Promise<number> } A Promise instance used to return max Amplitude.
4372     * @throws { BusinessError } 5400102 - Operation not allowed.
4373     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4374     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4375     * @since 11
4376     */
4377    getAudioCapturerMaxAmplitude(): Promise<number>;
4378
4379    /**
4380     * Get available encoder and encoder info for AVRecorder.
4381     * @param { AsyncCallback<Array<EncoderInfo>> } callback - A callback used to return available encoder info.
4382     * @throws { BusinessError } 5400102 - Operation not allowed.
4383     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4384     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4385     * @since 11
4386     */
4387    getAvailableEncoder(callback: AsyncCallback<Array<EncoderInfo>>): void;
4388
4389    /**
4390     * Get available encoder and encoder info for AVRecorder.
4391     * @returns { Promise<Array<EncoderInfo>> } A Promise instance used to return available encoder info.
4392     * @throws { BusinessError } 5400102 - Operation not allowed.
4393     * @throws { BusinessError } 5400105 - Service died. Return by promise.
4394     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4395     * @since 11
4396     */
4397    getAvailableEncoder(): Promise<Array<EncoderInfo>>;
4398
4399    /**
4400     * Recorder state.
4401     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4402     * @since 9
4403     */
4404    /**
4405     * Recorder state.
4406     * @type { AVRecorderState }
4407     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4408     * @crossplatform
4409     * @atomicservice
4410     * @since 12
4411     */
4412    readonly state: AVRecorderState;
4413
4414    /**
4415     * Listens for recording audioCapturerChange events.
4416     * @param { 'audioCapturerChange' } type - Type of the audioCapturerChange event to listen for.
4417     * @param { Callback<audio.AudioCapturerChangeInfo> } callback - Callback used to listen device change event.
4418     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
4419     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
4420     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4421     * @since 11
4422     */
4423    on(type: 'audioCapturerChange', callback: Callback<audio.AudioCapturerChangeInfo>): void;
4424
4425    /**
4426     * Listens for photo asset events.
4427     * @param { 'photoAssetAvailable' } type - Type of the recording event to listen for.
4428     * @param { Callback<photoAccessHelper.PhotoAsset> } callback - Callback used to listen for the photo asset event.
4429     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4430     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4431     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4432     * @since 12
4433     */
4434    on(type: 'photoAssetAvailable', callback: Callback<photoAccessHelper.PhotoAsset>): void;
4435    /**
4436     * Listens for recording stateChange events.
4437     * @param { 'stateChange' } type - Type of the recording event to listen for.
4438     * @param { function } callback - Callback used to listen for the recorder stateChange event.
4439     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4440     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4441     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4442     * @since 9
4443     */
4444    /**
4445     * Listens for recording stateChange events.
4446     * @param { 'stateChange' } type - Type of the recording event to listen for.
4447     * @param { OnAVRecorderStateChangeHandler } callback - Callback used to listen for the recorder stateChange event.
4448     * @throws { BusinessError } 5400103 - IO error. Return by callback.
4449     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4450     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4451     * @crossplatform
4452     * @atomicservice
4453     * @since 12
4454     */
4455    on(type: 'stateChange', callback: OnAVRecorderStateChangeHandler): void;
4456
4457    /**
4458     * Listens for recording error events.
4459     * @param { 'error' } type - Type of the recording error event to listen for.
4460     * @param { ErrorCallback } callback - Callback used to listen for the recorder error event.
4461     * @throws { BusinessError } 201 - Permission denied.
4462     * @throws { BusinessError } 401 - The parameter check failed.
4463     * @throws { BusinessError } 801 - Capability not supported.
4464     * @throws { BusinessError } 5400101 - No memory.
4465     * @throws { BusinessError } 5400102 - Operation not allowed.
4466     * @throws { BusinessError } 5400103 - I/O error.
4467     * @throws { BusinessError } 5400104 - Time out.
4468     * @throws { BusinessError } 5400105 - Service died.
4469     * @throws { BusinessError } 5400106 - Unsupported format.
4470     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4471     * @since 9
4472     */
4473    /**
4474     * Listens for recording error events.
4475     * @param { 'error' } type - Type of the recording error event to listen for.
4476     * @param { ErrorCallback } callback - Callback used to listen for the recorder error event.
4477     * @throws { BusinessError } 201 - Permission denied.
4478     * @throws { BusinessError } 401 - The parameter check failed.
4479     * @throws { BusinessError } 801 - Capability not supported.
4480     * @throws { BusinessError } 5400101 - No memory.
4481     * @throws { BusinessError } 5400102 - Operation not allowed.
4482     * @throws { BusinessError } 5400103 - I/O error.
4483     * @throws { BusinessError } 5400104 - Time out.
4484     * @throws { BusinessError } 5400105 - Service died.
4485     * @throws { BusinessError } 5400106 - Unsupported format.
4486     * @throws { BusinessError } 5400107 - Audio interrupted.
4487     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4488     * @since 11
4489     */
4490    /**
4491     * Listens for recording error events.
4492     * @param { 'error' } type - Type of the recording error event to listen for.
4493     * @param { ErrorCallback } callback - Callback used to listen for the recorder error event.
4494     * @throws { BusinessError } 201 - Permission denied.
4495     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
4496     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
4497     * @throws { BusinessError } 801 - Capability not supported.
4498     * @throws { BusinessError } 5400101 - No memory.
4499     * @throws { BusinessError } 5400102 - Operation not allowed.
4500     * @throws { BusinessError } 5400103 - I/O error.
4501     * @throws { BusinessError } 5400104 - Time out.
4502     * @throws { BusinessError } 5400105 - Service died.
4503     * @throws { BusinessError } 5400106 - Unsupported format.
4504     * @throws { BusinessError } 5400107 - Audio interrupted.
4505     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4506     * @crossplatform
4507     * @atomicservice
4508     * @since 12
4509     */
4510    on(type: 'error', callback: ErrorCallback): void;
4511
4512    /**
4513     * Cancel Listens for recording stateChange events.
4514     * @param { 'stateChange' } type - Type of the recording stateChange event to listen for.
4515     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4516     * @since 9
4517     */
4518    /**
4519     * Cancel Listens for recording stateChange events.
4520     * @param { 'stateChange' } type - Type of the recording stateChange event to listen for.
4521     * @param { OnAVRecorderStateChangeHandler } callback - Callback used to listen for the recorder stateChange event.
4522     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4523     * @crossplatform
4524     * @atomicservice
4525     * @since 12
4526     */
4527    off(type: 'stateChange', callback?: OnAVRecorderStateChangeHandler): void;
4528
4529    /**
4530     * Cancel Listens for recording error events.
4531     * @param { 'error' } type - Type of the recording error event to listen for.
4532     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4533     * @since 9
4534     */
4535    /**
4536     * Cancel Listens for recording error events.
4537     * @param { 'error' } type - Type of the recording error event to listen for.
4538     * @param { ErrorCallback } callback - Callback used to listen for the recorder error event.
4539     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4540     * @crossplatform
4541     * @atomicservice
4542     * @since 12
4543     */
4544    off(type: 'error', callback?: ErrorCallback): void;
4545
4546    /**
4547     * Cancel Listens for recording audioCapturerChange events.
4548     * @param { 'audioCapturerChange' } type - Type of the audioCapturerChange event to listen for.
4549     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4550     * @since 11
4551     */
4552    /**
4553     * Cancel Listens for recording audioCapturerChange events.
4554     * @param { 'audioCapturerChange' } type - Type of the audioCapturerChange event to listen for.
4555     * @param { Callback<audio.AudioCapturerChangeInfo> } callback - Callback used to listen device change event.
4556     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4557     * @since 12
4558     */
4559    off(type: 'audioCapturerChange', callback?: Callback<audio.AudioCapturerChangeInfo>): void;
4560
4561    /**
4562     * Cancel Listens for photo asset events.
4563     * @param { 'photoAssetAvailable' } type - Type of the recording event to listen for.
4564     * @param { Callback<photoAccessHelper.PhotoAsset> } callback - Callback used to listen for the photo asset event.
4565     * @syscap SystemCapability.Multimedia.Media.AVRecorder
4566     * @since 12
4567     */
4568    off(type: 'photoAssetAvailable', callback?: Callback<photoAccessHelper.PhotoAsset>): void;
4569  }
4570
4571  /**
4572   * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace.
4573   *
4574   * @enum { number }
4575   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4576   * @since 6
4577   * @deprecated since 8
4578   * @useinstead ohos.multimedia.media/media.CodecMimeType
4579   */
4580  enum AudioEncoder {
4581    /**
4582     * Default audio encoding format, which is AMR-NB.
4583     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4584     * @since 6
4585     * @deprecated since 8
4586     */
4587    DEFAULT = 0,
4588
4589    /**
4590     * Indicates the AMR-NB audio encoding format.
4591     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4592     * @since 6
4593     * @deprecated since 8
4594     */
4595    AMR_NB = 1,
4596
4597    /**
4598     * Indicates the AMR-WB audio encoding format.
4599     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4600     * @since 6
4601     * @deprecated since 8
4602     */
4603    AMR_WB = 2,
4604
4605    /**
4606     * Advanced Audio Coding Low Complexity (AAC-LC).
4607     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4608     * @since 6
4609     * @deprecated since 8
4610     */
4611    AAC_LC = 3,
4612
4613    /**
4614     * High-Efficiency Advanced Audio Coding (HE-AAC).
4615     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4616     * @since 6
4617     * @deprecated since 8
4618     */
4619    HE_AAC = 4
4620  }
4621
4622  /**
4623   * Enumerates audio output formats, it will be deprecated after API8, use @ContainerFormatType to replace.
4624   *
4625   * @enum { number }
4626   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4627   * @since 6
4628   * @deprecated since 8
4629   * @useinstead ohos.multimedia.media/media.ContainerFormatType
4630   */
4631  enum AudioOutputFormat {
4632    /**
4633     * Default audio output format, which is Moving Pictures Expert Group 4 (MPEG-4).
4634     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4635     * @since 6
4636     * @deprecated since 8
4637     */
4638    DEFAULT = 0,
4639
4640    /**
4641     * Indicates the Moving Picture Experts Group-4 (MPEG4) media format.
4642     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4643     * @since 6
4644     * @deprecated since 8
4645     */
4646    MPEG_4 = 2,
4647
4648    /**
4649     * Indicates the Adaptive Multi-Rate Narrowband (AMR-NB) media format.
4650     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4651     * @since 6
4652     * @deprecated since 8
4653     */
4654    AMR_NB = 3,
4655
4656    /**
4657     * Indicates the Adaptive Multi-Rate Wideband (AMR-WB) media format.
4658     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4659     * @since 6
4660     * @deprecated since 8
4661     */
4662    AMR_WB = 4,
4663
4664    /**
4665     * Audio Data Transport Stream (ADTS), a transmission stream format of Advanced Audio Coding (AAC) audio.
4666     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4667     * @since 6
4668     * @deprecated since 8
4669     */
4670    AAC_ADTS = 6
4671  }
4672
4673  /**
4674   * Provides the geographical location definitions for media resources.
4675   *
4676   * @typedef Location
4677   * @syscap SystemCapability.Multimedia.Media.Core
4678   * @since 6
4679   */
4680  /**
4681   * Provides the geographical location definitions for media resources.
4682   *
4683   * @typedef Location
4684   * @syscap SystemCapability.Multimedia.Media.Core
4685   * @crossplatform
4686   * @since 12
4687   */
4688  interface Location {
4689    /**
4690     * Latitude.
4691     * @syscap SystemCapability.Multimedia.Media.Core
4692     * @since 6
4693     */
4694    /**
4695     * Latitude.
4696     * @type { number }
4697     * @syscap SystemCapability.Multimedia.Media.Core
4698     * @crossplatform
4699     * @since 12
4700     */
4701    latitude: number;
4702
4703    /**
4704     * Longitude.
4705     * @syscap SystemCapability.Multimedia.Media.Core
4706     * @since 6
4707     */
4708    /**
4709     * Longitude.
4710     * @type { number }
4711     * @syscap SystemCapability.Multimedia.Media.Core
4712     * @crossplatform
4713     * @since 12
4714     */
4715    longitude: number;
4716  }
4717  /**
4718   * Set configures of a watermark to AVRecorder. The position starts at top left corner.
4719   *
4720   * @typedef WatermarkConfig
4721   * @syscap SystemCapability.Multimedia.Media.Core
4722   * @systemapi
4723   * @since 13
4724   */
4725  interface WatermarkConfig {
4726    /**
4727     * Offset of the watermark to the top line of pixel.
4728     * @type { number }
4729     * @syscap SystemCapability.Multimedia.Media.Core
4730     * @systemapi
4731     * @since 13
4732     */
4733    top: number;
4734    /**
4735     * Offset of the watermark to the left line of pixel.
4736     * @type { number }
4737     * @syscap SystemCapability.Multimedia.Media.Core
4738     * @systemapi
4739     * @since 13
4740     */
4741    left: number;
4742  }
4743
4744  /**
4745   * Provides the audio recorder configuration definitions.
4746   *
4747   * @typedef AudioRecorderConfig
4748   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4749   * @since 6
4750   * @deprecated since 9
4751   * @useinstead ohos.multimedia.media/media.AVRecorderConfig
4752   */
4753  interface AudioRecorderConfig {
4754    /**
4755     * Audio encoding format. The default value is DEFAULT, it will be deprecated after API8.
4756     * use "audioEncoderMime" instead.
4757     * @type { ?AudioEncoder }
4758     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4759     * @since 6
4760     * @deprecated since 8
4761     * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.audioEncoderMime
4762     */
4763    audioEncoder?: AudioEncoder;
4764
4765    /**
4766     * Audio encoding bit rate.
4767     * @type { ?number }
4768     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4769     * @since 6
4770     * @deprecated since 9
4771     */
4772    audioEncodeBitRate?: number;
4773
4774    /**
4775     * Audio sampling rate.
4776     * @type { ?number }
4777     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4778     * @since 6
4779     * @deprecated since 9
4780     */
4781    audioSampleRate?: number;
4782
4783    /**
4784     * Number of audio channels.
4785     * @type { ?number }
4786     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4787     * @since 6
4788     * @deprecated since 9
4789     */
4790    numberOfChannels?: number;
4791
4792    /**
4793     * Audio output format. The default value is DEFAULT, it will be deprecated after API8.
4794     * it will be replaced with "fileFormat".
4795     * @type { ?AudioOutputFormat }
4796     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4797     * @since 6
4798     * @deprecated since 8
4799     * @useinstead ohos.multimedia.media/media.AudioRecorderConfig.fileFormat
4800     */
4801    format?: AudioOutputFormat;
4802
4803    /**
4804     * Audio output uri.support two kind of uri now.
4805     * format like: scheme + "://" + "context".
4806     * file:  file://path
4807     * fd:    fd://fd
4808     * @type { string }
4809     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4810     * @since 6
4811     * @deprecated since 9
4812     */
4813    uri: string;
4814
4815    /**
4816     * Geographical location information.
4817     * @type { ?Location }
4818     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4819     * @since 6
4820     * @deprecated since 9
4821     */
4822    location?: Location;
4823
4824    /**
4825     * audio encoding format MIME. it used to replace audioEncoder.
4826     * @type { ?CodecMimeType }
4827     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4828     * @since 8
4829     * @deprecated since 9
4830     */
4831    audioEncoderMime?: CodecMimeType;
4832    /**
4833     * output file format. see @ContainerFormatType , it used to replace "format".
4834     * @type { ?ContainerFormatType }
4835     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4836     * @since 8
4837     * @deprecated since 9
4838     */
4839    fileFormat?: ContainerFormatType;
4840  }
4841
4842  /**
4843   * Manages and record audio. Before calling an AudioRecorder method, you must use createAudioRecorder()
4844   * to create an AudioRecorder instance.
4845   *
4846   * @typedef AudioRecorder
4847   * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4848   * @since 6
4849   * @deprecated since 9
4850   * @useinstead ohos.multimedia.media/media.AVRecorder
4851   */
4852  interface AudioRecorder {
4853    /**
4854     * Prepares for recording.
4855     * @permission ohos.permission.MICROPHONE
4856     * @param { AudioRecorderConfig } config - Recording parameters.
4857     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4858     * @since 6
4859     * @deprecated since 9
4860     * @useinstead ohos.multimedia.media/media.AVRecorder#prepare
4861     */
4862    /**
4863     * Prepares for recording.
4864     * @permission ohos.permission.MICROPHONE
4865     * @param { AudioRecorderConfig } config - Recording parameters.
4866     * @throws { BusinessError } 201 - permission denied.
4867     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4868     * @since 12
4869     * @deprecated since 9
4870     * @useinstead ohos.multimedia.media/media.AVRecorder#prepare
4871     */
4872    prepare(config: AudioRecorderConfig): void;
4873
4874    /**
4875     * Starts audio recording.
4876     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4877     * @since 6
4878     * @deprecated since 9
4879     * @useinstead ohos.multimedia.media/media.AVRecorder#start
4880     */
4881    start(): void;
4882
4883    /**
4884     * Pauses audio recording.
4885     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4886     * @since 6
4887     * @deprecated since 9
4888     * @useinstead ohos.multimedia.media/media.AVRecorder#pause
4889     */
4890    pause(): void;
4891
4892    /**
4893     * Resumes audio recording.
4894     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4895     * @since 6
4896     * @deprecated since 9
4897     * @useinstead ohos.multimedia.media/media.AVRecorder#resume
4898     */
4899    resume(): void;
4900
4901    /**
4902     * Stops audio recording.
4903     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4904     * @since 6
4905     * @deprecated since 9
4906     * @useinstead ohos.multimedia.media/media.AVRecorder#stop
4907     */
4908    stop(): void;
4909
4910    /**
4911     * Releases resources used for audio recording.
4912     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4913     * @since 6
4914     * @deprecated since 9
4915     * @useinstead ohos.multimedia.media/media.AVRecorder#release
4916     */
4917    release(): void;
4918
4919    /**
4920     * Resets audio recording.
4921     * Before resetting audio recording, you must call stop() to stop recording. After audio recording is reset,
4922     * you must call prepare() to set the recording configurations for another recording.
4923     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4924     * @since 6
4925     * @deprecated since 9
4926     * @useinstead ohos.multimedia.media/media.AVRecorder#reset
4927     */
4928    reset(): void;
4929
4930    /**
4931     * Listens for audio recording events.
4932     * @param { 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset' } type - Type of the audio recording event to listen for.
4933     * @param { function } callback - Callback used to listen for the audio recording event.
4934     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4935     * @since 6
4936     * @deprecated since 9
4937     * @useinstead ohos.multimedia.media/media.AVRecorder#on
4938     */
4939    on(type: 'prepare' | 'start' | 'pause' | 'resume' | 'stop' | 'release' | 'reset', callback: () => void): void;
4940
4941    /**
4942     * Listens for audio recording error events.
4943     * @param { 'error' } type - Type of the audio recording error event to listen for.
4944     * @param { ErrorCallback } callback - Callback used to listen for the audio recording error event.
4945     * @syscap SystemCapability.Multimedia.Media.AudioRecorder
4946     * @since 6
4947     * @deprecated since 9
4948     * @useinstead ohos.multimedia.media/media.AVRecorder#on
4949     */
4950    on(type: 'error', callback: ErrorCallback): void;
4951  }
4952
4953  /**
4954  * The maintenance of this interface has been stopped since version api 9. Please use AVRecorderState.
4955  * Describes video recorder states.
4956  *
4957  * @typedef { 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error' }
4958  * @syscap SystemCapability.Multimedia.Media.VideoRecorder
4959  * @systemapi
4960  * @since 9
4961  */
4962  type VideoRecordState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error';
4963
4964  /**
4965   * The maintenance of this interface has been stopped since version api 9. Please use AVRecorder.
4966   * Manages and record video. Before calling an VideoRecorder method, you must use createVideoRecorder()
4967   * to create an VideoRecorder instance.
4968   *
4969   * @typedef VideoRecorder
4970   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
4971   * @systemapi
4972   * @since 9
4973   */
4974  interface VideoRecorder {
4975    /**
4976     * Prepares for recording.
4977     * @permission ohos.permission.MICROPHONE
4978     * @param { VideoRecorderConfig } config - Recording parameters.
4979     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
4980     * @throws { BusinessError } 201 - Permission denied. Return by callback.
4981     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
4982     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
4983     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
4984     * @throws { BusinessError } 5400105 - Service died. Return by callback.
4985     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
4986     * @systemapi
4987     * @since 9
4988     */
4989    /**
4990     * Prepares for recording.
4991     * @permission ohos.permission.MICROPHONE
4992     * @param { VideoRecorderConfig } config - Recording parameters.
4993     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
4994     * @throws { BusinessError } 201 - Permission denied. Return by callback.
4995     * @throws { BusinessError } 202 - Not System App.
4996     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
4997     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
4998     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
4999     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5000     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5001     * @systemapi
5002     * @since 12
5003     */
5004    prepare(config: VideoRecorderConfig, callback: AsyncCallback<void>): void;
5005    /**
5006     * Prepares for recording.
5007     * @permission ohos.permission.MICROPHONE
5008     * @param { VideoRecorderConfig } config - Recording parameters.
5009     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
5010     * @throws { BusinessError } 201 - Permission denied. Return by promise.
5011     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5012     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
5013     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5014     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5015     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5016     * @systemapi
5017     * @since 9
5018     */
5019    /**
5020     * Prepares for recording.
5021     * @permission ohos.permission.MICROPHONE
5022     * @param { VideoRecorderConfig } config - Recording parameters.
5023     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
5024     * @throws { BusinessError } 201 - Permission denied. Return by promise.
5025     * @throws { BusinessError } 202 - Not System App.
5026     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
5027     * <br>2. Incorrect parameter types. 3.Parameter verification failed.
5028     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5029     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5030     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5031     * @systemapi
5032     * @since 12
5033     */
5034    prepare(config: VideoRecorderConfig): Promise<void>;
5035    /**
5036     * get input surface.it must be called between prepare completed and start.
5037     * @param { AsyncCallback<string> } callback - Callback used to return the input surface id in string.
5038     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5039     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5040     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5041     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5042     * @systemapi
5043     * @since 9
5044     */
5045    /**
5046     * get input surface.it must be called between prepare completed and start.
5047     * @param { AsyncCallback<string> } callback - Callback used to return the input surface id in string.
5048     * @throws { BusinessError } 202 - Not System App.
5049     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5050     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5051     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5052     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5053     * @systemapi
5054     * @since 12
5055     */
5056    getInputSurface(callback: AsyncCallback<string>): void;
5057    /**
5058     * get input surface. it must be called between prepare completed and start.
5059     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
5060     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5061     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5062     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5063     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5064     * @systemapi
5065     * @since 9
5066     */
5067    /**
5068     * get input surface. it must be called between prepare completed and start.
5069     * @returns { Promise<string> } A Promise instance used to return the input surface id in string.
5070     * @throws { BusinessError } 202 - Not System App.
5071     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5072     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5073     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5074     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5075     * @systemapi
5076     * @since 12
5077     */
5078    getInputSurface(): Promise<string>;
5079    /**
5080     * Starts video recording.
5081     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
5082     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5083     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5084     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5085     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5086     * @systemapi
5087     * @since 9
5088     */
5089    /**
5090     * Starts video recording.
5091     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
5092     * @throws { BusinessError } 202 - Not System App.
5093     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5094     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5095     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5096     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5097     * @systemapi
5098     * @since 12
5099     */
5100    start(callback: AsyncCallback<void>): void;
5101    /**
5102     * Starts video recording.
5103     * @returns { Promise<void> } A Promise instance used to return when start completed.
5104     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5105     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5106     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5107     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5108     * @systemapi
5109     * @since 9
5110     */
5111    /**
5112     * Starts video recording.
5113     * @returns { Promise<void> } A Promise instance used to return when start completed.
5114     * @throws { BusinessError } 202 - Not System App.
5115     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5116     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5117     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5118     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5119     * @systemapi
5120     * @since 12
5121     */
5122    start(): Promise<void>;
5123    /**
5124     * Pauses video recording.
5125     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
5126     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5127     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5128     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5129     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5130     * @systemapi
5131     * @since 9
5132     */
5133    /**
5134     * Pauses video recording.
5135     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
5136     * @throws { BusinessError } 202 - Not System App.
5137     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5138     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5139     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5140     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5141     * @systemapi
5142     * @since 12
5143     */
5144    pause(callback: AsyncCallback<void>): void;
5145    /**
5146     * Pauses video recording.
5147     * @returns { Promise<void> } A Promise instance used to return when pause completed.
5148     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5149     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5150     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5151     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5152     * @systemapi
5153     * @since 9
5154     */
5155    /**
5156     * Pauses video recording.
5157     * @returns { Promise<void> } A Promise instance used to return when pause completed.
5158     * @throws { BusinessError } 202 - Not System App.
5159     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5160     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5161     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5162     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5163     * @systemapi
5164     * @since 12
5165     */
5166    pause(): Promise<void>;
5167    /**
5168     * Resumes video recording.
5169     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
5170     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5171     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5172     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5173     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5174     * @systemapi
5175     * @since 9
5176     */
5177    /**
5178     * Resumes video recording.
5179     * @param { AsyncCallback<void> } callback - A callback instance used to return when resume completed.
5180     * @throws { BusinessError } 202 - Not System App.
5181     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5182     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5183     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5184     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5185     * @systemapi
5186     * @since 12
5187     */
5188    resume(callback: AsyncCallback<void>): void;
5189    /**
5190     * Resumes video recording.
5191     * @returns { Promise<void> } A Promise instance used to return when resume completed.
5192     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5193     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5194     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5195     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5196     * @systemapi
5197     * @since 9
5198     */
5199    /**
5200     * Resumes video recording.
5201     * @returns { Promise<void> } A Promise instance used to return when resume completed.
5202     * @throws { BusinessError } 202 - Not System App.
5203     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5204     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5205     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5206     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5207     * @systemapi
5208     * @since 12
5209     */
5210    resume(): Promise<void>;
5211    /**
5212     * Stops video recording.
5213     * @param { AsyncCallback<void>  } callback A callback instance used to return when stop completed.
5214     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5215     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5216     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5217     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5218     * @systemapi
5219     * @since 9
5220     */
5221    /**
5222     * Stops video recording.
5223     * @param { AsyncCallback<void>  } callback A callback instance used to return when stop completed.
5224     * @throws { BusinessError } 202 - Not System App.
5225     * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback.
5226     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5227     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5228     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5229     * @systemapi
5230     * @since 12
5231     */
5232    stop(callback: AsyncCallback<void>): void;
5233    /**
5234     * Stops video recording.
5235     * @returns { Promise<void> } A Promise instance used to return when stop completed.
5236     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5237     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5238     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5239     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5240     * @systemapi
5241     * @since 9
5242     */
5243    /**
5244     * Stops video recording.
5245     * @returns { Promise<void> } A Promise instance used to return when stop completed.
5246     * @throws { BusinessError } 202 - Not System App.
5247     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
5248     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5249     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5250     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5251     * @systemapi
5252     * @since 12
5253     */
5254    stop(): Promise<void>;
5255    /**
5256     * Releases resources used for video recording.
5257     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
5258     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5259     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5260     * @systemapi
5261     * @since 9
5262     */
5263    /**
5264     * Releases resources used for video recording.
5265     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
5266     * @throws { BusinessError } 202 - Not System App.
5267     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5268     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5269     * @systemapi
5270     * @since 12
5271     */
5272    release(callback: AsyncCallback<void>): void;
5273    /**
5274     * Releases resources used for video recording.
5275     * @returns { Promise<void> } A Promise instance used to return when release completed.
5276     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5277     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5278     * @systemapi
5279     * @since 9
5280     */
5281    /**
5282     * Releases resources used for video recording.
5283     * @returns { Promise<void> } A Promise instance used to return when release completed.
5284     * @throws { BusinessError } 202 - Not System App.
5285     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5286     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5287     * @systemapi
5288     * @since 12
5289     */
5290    release(): Promise<void>;
5291    /**
5292     * Resets video recording.
5293     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
5294     * you must call prepare() to set the recording configurations for another recording.
5295     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
5296     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5297     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5298     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5299     * @systemapi
5300     * @since 9
5301     */
5302    /**
5303     * Resets video recording.
5304     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
5305     * you must call prepare() to set the recording configurations for another recording.
5306     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
5307     * @throws { BusinessError } 202 - Not System App.
5308     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5309     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5310     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5311     * @systemapi
5312     * @since 12
5313     */
5314    reset(callback: AsyncCallback<void>): void;
5315    /**
5316     * Resets video recording.
5317     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
5318     * you must call prepare() to set the recording configurations for another recording.
5319     * @returns { Promise<void> } A Promise instance used to return when reset completed.
5320     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5321     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5322     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5323     * @systemapi
5324     * @since 9
5325     */
5326    /**
5327     * Resets video recording.
5328     * Before resetting video recording, you must call stop() to stop recording. After video recording is reset,
5329     * you must call prepare() to set the recording configurations for another recording.
5330     * @returns { Promise<void> } A Promise instance used to return when reset completed.
5331     * @throws { BusinessError } 202 - Not System App.
5332     * @throws { BusinessError } 5400103 - I/O error. Return by promise.
5333     * @throws { BusinessError } 5400105 - Service died. Return by promise.
5334     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5335     * @systemapi
5336     * @since 12
5337     */
5338    reset(): Promise<void>;
5339    /**
5340     * Listens for video recording error events.
5341     * @param { 'error' } type - Type of the video recording error event to listen for.
5342     * @param { ErrorCallback } callback - Callback used to listen for the video recording error event.
5343     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5344     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5345     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5346     * @systemapi
5347     * @since 9
5348     */
5349    /**
5350     * Listens for video recording error events.
5351     * @param { 'error' } type - Type of the video recording error event to listen for.
5352     * @param { ErrorCallback } callback - Callback used to listen for the video recording error event.
5353     * @throws { BusinessError } 201 - permission denied.
5354     * @throws { BusinessError } 202 - Not System App.
5355     * @throws { BusinessError } 5400103 - I/O error. Return by callback.
5356     * @throws { BusinessError } 5400105 - Service died. Return by callback.
5357     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5358     * @systemapi
5359     * @since 12
5360     */
5361    on(type: 'error', callback: ErrorCallback): void;
5362
5363    /**
5364     * video recorder state.
5365     * @type { VideoRecordState }
5366     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
5367     * @systemapi
5368     * @since 9
5369     */
5370    readonly state: VideoRecordState;
5371  }
5372
5373  /**
5374   * Describes video playback states.
5375   * @typedef { 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error' }
5376   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5377   * @since 8
5378   * @deprecated since 9
5379   * @useinstead ohos.multimedia.media/media.AVPlayerState
5380   */
5381  type VideoPlayState = 'idle' | 'prepared' | 'playing' | 'paused' | 'stopped' | 'error';
5382
5383  /**
5384   * Enumerates playback speed.
5385   *
5386   * @enum { number }
5387   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5388   * @since 8
5389   */
5390  /**
5391   * Enumerates playback speed.
5392   *
5393   * @enum { number }
5394   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5395   * @crossplatform
5396   * @atomicservice
5397   * @since 12
5398   */
5399  enum PlaybackSpeed {
5400    /**
5401     * playback at 0.75x normal speed
5402     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5403     * @since 8
5404     */
5405    /**
5406     * playback at 0.75x normal speed
5407     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5408     * @crossplatform
5409     * @atomicservice
5410     * @since 12
5411     */
5412    SPEED_FORWARD_0_75_X = 0,
5413    /**
5414     * playback at normal speed
5415     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5416     * @since 8
5417     */
5418    /**
5419     * playback at normal speed
5420     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5421     * @crossplatform
5422     * @atomicservice
5423     * @since 12
5424     */
5425    SPEED_FORWARD_1_00_X = 1,
5426    /**
5427     * playback at 1.25x normal speed
5428     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5429     * @since 8
5430     */
5431    /**
5432     * playback at 1.25x normal speed
5433     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5434     * @crossplatform
5435     * @atomicservice
5436     * @since 12
5437     */
5438    SPEED_FORWARD_1_25_X = 2,
5439    /**
5440     * playback at 1.75x normal speed
5441     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5442     * @since 8
5443     */
5444    /**
5445     * playback at 1.75x normal speed
5446     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5447     * @crossplatform
5448     * @atomicservice
5449     * @since 12
5450     */
5451    SPEED_FORWARD_1_75_X = 3,
5452    /**
5453     * playback at 2.0x normal speed
5454     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5455     * @since 8
5456     */
5457    /**
5458     * playback at 2.0x normal speed
5459     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5460     * @crossplatform
5461     * @atomicservice
5462     * @since 12
5463     */
5464    SPEED_FORWARD_2_00_X = 4,
5465    /**
5466     * playback at 0.5x normal speed
5467     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5468     * @atomicservice
5469     * @since 12
5470     */
5471    SPEED_FORWARD_0_50_X = 5,
5472    /**
5473     * playback at 1.5x normal speed
5474     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5475     * @atomicservice
5476     * @since 12
5477     */
5478    SPEED_FORWARD_1_50_X = 6,
5479    /**
5480     * playback at 3.0x normal speed
5481     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5482     * @atomicservice
5483     * @since 13
5484     */
5485    SPEED_FORWARD_3_00_X = 7,
5486    /**
5487     * playback at 0.25x normal speed
5488     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5489     * @atomicservice
5490     * @since 12
5491     */
5492    SPEED_FORWARD_0_25_X = 8,
5493    /**
5494     * playback at 0.125x normal speed
5495     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5496     * @atomicservice
5497     * @since 12
5498     */
5499    SPEED_FORWARD_0_125_X = 9,
5500  }
5501
5502  /**
5503   * Manages and plays video. Before calling an video method, you must use createVideoPlayer() to create an VideoPlayer
5504   * instance.
5505   *
5506   * @typedef VideoPlayer
5507   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5508   * @since 8
5509   * @deprecated since 9
5510   * @useinstead ohos.multimedia.media/media.AVPlayer
5511   */
5512  interface VideoPlayer {
5513    /**
5514     * Set display surface.
5515     * @param {string} surfaceId - surface id, video player will use this id get a surface instance.
5516     * @param { AsyncCallback<void> } callback - A callback instance used to return when release output buffer completed.
5517     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5518     * @since 8
5519     * @deprecated since 9
5520     * @useinstead ohos.multimedia.media/media.AVPlayer#surfaceId
5521     */
5522    setDisplaySurface(surfaceId: string, callback: AsyncCallback<void>): void;
5523    /**
5524     * Set display surface.
5525     * @param {string} surfaceId - surface id, video player will use this id get a surface instance.
5526     * @returns { Promise<void> } A Promise instance used to return when release output buffer completed.
5527     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5528     * @since 8
5529     * @deprecated since 9
5530     * @useinstead ohos.multimedia.media/media.AVPlayer#surfaceId
5531     */
5532    setDisplaySurface(surfaceId: string): Promise<void>;
5533    /**
5534     * Prepare video playback, it will request resource for playing.
5535     * @param { AsyncCallback<void> } callback - A callback instance used to return when prepare completed.
5536     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5537     * @since 8
5538     * @deprecated since 9
5539     * @useinstead ohos.multimedia.media/media.AVPlayer#prepare
5540     */
5541    prepare(callback: AsyncCallback<void>): void;
5542    /**
5543     * Prepare video playback, it will request resource for playing.
5544     * @returns { Promise<void> } A Promise instance used to return when prepare completed.
5545     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5546     * @since 8
5547     * @deprecated since 9
5548     * @useinstead ohos.multimedia.media/media.AVPlayer#prepare
5549     */
5550    prepare(): Promise<void>;
5551    /**
5552     * Starts video playback.
5553     * @param { AsyncCallback<void> } callback - A callback instance used to return when start completed.
5554     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5555     * @since 8
5556     * @deprecated since 9
5557     * @useinstead ohos.multimedia.media/media.AVPlayer#play
5558     */
5559    play(callback: AsyncCallback<void>): void;
5560    /**
5561     * Starts video playback.
5562     * @returns { Promise<void> } A Promise instance used to return when start completed.
5563     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5564     * @since 8
5565     * @deprecated since 9
5566     * @useinstead ohos.multimedia.media/media.AVPlayer#play
5567     */
5568    play(): Promise<void>;
5569    /**
5570     * Pauses video playback.
5571     * @param { AsyncCallback<void> } callback - A callback instance used to return when pause completed.
5572     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5573     * @since 8
5574     * @deprecated since 9
5575     * @useinstead ohos.multimedia.media/media.AVPlayer#pause
5576     */
5577    pause(callback: AsyncCallback<void>): void;
5578    /**
5579     * Pauses video playback.
5580     * @returns { Promise<void> } A Promise instance used to return when pause completed.
5581     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5582     * @since 8
5583     * @deprecated since 9
5584     * @useinstead ohos.multimedia.media/media.AVPlayer#pause
5585     */
5586    pause(): Promise<void>;
5587    /**
5588     * Stops video playback.
5589     * @param { AsyncCallback<void> } callback - A callback instance used to return when stop completed.
5590     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5591     * @since 8
5592     * @deprecated since 9
5593     * @useinstead ohos.multimedia.media/media.AVPlayer#stop
5594     */
5595    stop(callback: AsyncCallback<void>): void;
5596    /**
5597     * Stops video playback.
5598     * @returns { Promise<void> } A Promise instance used to return when stop completed.
5599     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5600     * @since 8
5601     * @deprecated since 9
5602     * @useinstead ohos.multimedia.media/media.AVPlayer#stop
5603     */
5604    stop(): Promise<void>;
5605    /**
5606     * Resets video playback, it will release the resource.
5607     * @param { AsyncCallback<void> } callback - A callback instance used to return when reset completed.
5608     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5609     * @since 8
5610     * @deprecated since 9
5611     * @useinstead ohos.multimedia.media/media.AVPlayer#reset
5612     */
5613    reset(callback: AsyncCallback<void>): void;
5614    /**
5615     * Resets video playback, it will release the resource.
5616     * @returns { Promise<void> } A Promise instance used to return when reset completed.
5617     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5618     * @since 8
5619     * @deprecated since 9
5620     * @useinstead ohos.multimedia.media/media.AVPlayer#reset
5621     */
5622    reset(): Promise<void>;
5623    /**
5624     * Jumps to the specified playback position by default SeekMode(SEEK_PREV_SYNC),
5625     * the performance may be not the best.
5626     * @param { number } timeMs - Playback position to jump
5627     * @param { AsyncCallback<number> } callback - A callback instance used to return when seek completed
5628     * and return the seeking position result.
5629     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5630     * @since 8
5631     * @deprecated since 9
5632     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
5633     */
5634    seek(timeMs: number, callback: AsyncCallback<number>): void;
5635    /**
5636     * Jumps to the specified playback position.
5637     * @param { number } timeMs - Playback position to jump
5638     * @param { SeekMode } mode - seek mode, see @SeekMode .
5639     * @param { AsyncCallback<number> } callback - A callback instance used to return when seek completed
5640     * and return the seeking position result.
5641     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5642     * @since 8
5643     * @deprecated since 9
5644     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
5645     */
5646    seek(timeMs: number, mode: SeekMode, callback: AsyncCallback<number>): void;
5647    /**
5648     * Jumps to the specified playback position.
5649     * @param { number } timeMs - Playback position to jump
5650     * @param { SeekMode } mode - seek mode, see @SeekMode .
5651     * @returns { Promise<number> } A Promise instance used to return when seek completed
5652     * and return the seeking position result.
5653     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5654     * @since 8
5655     * @deprecated since 9
5656     * @useinstead ohos.multimedia.media/media.AVPlayer#seek
5657     */
5658    seek(timeMs: number, mode?: SeekMode): Promise<number>;
5659    /**
5660     * Sets the volume.
5661     * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
5662     * @param { AsyncCallback<void> } callback - A callback instance used to return when set volume completed.
5663     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5664     * @since 8
5665     * @deprecated since 9
5666     * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume
5667     */
5668    setVolume(vol: number, callback: AsyncCallback<void>): void;
5669    /**
5670     * Sets the volume.
5671     * @param { number } vol - Relative volume. The value ranges from 0.00 to 1.00. The value 1 indicates the maximum volume (100%).
5672     * @returns { Promise<void> } A Promise instance used to return when set volume completed.
5673     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5674     * @since 8
5675     * @deprecated since 9
5676     * @useinstead ohos.multimedia.media/media.AVPlayer#setVolume
5677     */
5678    setVolume(vol: number): Promise<void>;
5679    /**
5680     * Releases resources used for video playback.
5681     * @param { AsyncCallback<void> } callback - A callback instance used to return when release completed.
5682     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5683     * @since 8
5684     * @deprecated since 9
5685     * @useinstead ohos.multimedia.media/media.AVPlayer#release
5686     */
5687    release(callback: AsyncCallback<void>): void;
5688    /**
5689     * Releases resources used for video playback.
5690     * @returns { Promise<void> } A Promise instance used to return when release completed.
5691     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5692     * @since 8
5693     * @deprecated since 9
5694     * @useinstead ohos.multimedia.media/media.AVPlayer#release
5695     */
5696    release(): Promise<void>;
5697    /**
5698     * Get all track infos in MediaDescription, should be called after data loaded callback.
5699     * @param { AsyncCallback<Array<MediaDescription>> } callback - async callback return track info in MediaDescription.
5700     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5701     * @since 8
5702     * @deprecated since 9
5703     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
5704     */
5705    getTrackDescription(callback: AsyncCallback<Array<MediaDescription>>): void;
5706
5707    /**
5708     * Get all track infos in MediaDescription, should be called after data loaded callback.
5709     * @returns { Promise<Array<MediaDescription>> } A Promise instance used to return the track info in MediaDescription.
5710     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5711     * @since 8
5712     * @deprecated since 9
5713     * @useinstead ohos.multimedia.media/media.AVPlayer#getTrackDescription
5714     */
5715    getTrackDescription(): Promise<Array<MediaDescription>>;
5716
5717    /**
5718     * media url. Mainstream video formats are supported.
5719     * local:fd://XXX, file://XXX. network:http://xxx
5720     * @type { string }
5721     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5722     * @since 8
5723     * @deprecated since 9
5724     * @useinstead ohos.multimedia.media/media.AVPlayer#url
5725     */
5726    url: string;
5727
5728    /**
5729     * Video file descriptor. Mainstream video formats are supported.
5730     * @type { AVFileDescriptor }
5731     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5732     * @since 9
5733     * @deprecated since 9
5734     * @useinstead ohos.multimedia.media/media.AVPlayer#fdSrc
5735     */
5736    fdSrc: AVFileDescriptor;
5737
5738    /**
5739     * Whether to loop video playback. The value true means to loop playback.
5740     * @type { boolean }
5741     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5742     * @since 8
5743     * @deprecated since 9
5744     * @useinstead ohos.multimedia.media/media.AVPlayer#loop
5745     */
5746    loop: boolean;
5747
5748    /**
5749     * Current playback position.
5750     * @type { number }
5751     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5752     * @since 8
5753     * @deprecated since 9
5754     * @useinstead ohos.multimedia.media/media.AVPlayer#currentTime
5755     */
5756    readonly currentTime: number;
5757
5758    /**
5759     * Playback duration, if -1 means cannot seek.
5760     * @type { number }
5761     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5762     * @since 8
5763     * @deprecated since 9
5764     * @useinstead ohos.multimedia.media/media.AVPlayer#duration
5765     */
5766    readonly duration: number;
5767
5768    /**
5769     * Playback state.
5770     * @type { VideoPlayState }
5771     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5772     * @since 8
5773     * @deprecated since 9
5774     * @useinstead ohos.multimedia.media/media.AVPlayer#state
5775     */
5776    readonly state: VideoPlayState;
5777
5778    /**
5779     * video width, valid after prepared.
5780     * @type { number }
5781     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5782     * @since 8
5783     * @deprecated since 9
5784     * @useinstead ohos.multimedia.media/media.AVPlayer#width
5785     */
5786    readonly width: number;
5787
5788    /**
5789     * video height, valid after prepared.
5790     * @type { number }
5791     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5792     * @since 8
5793     * @deprecated since 9
5794     * @useinstead ohos.multimedia.media/media.AVPlayer#height
5795     */
5796    readonly height: number;
5797
5798    /**
5799     * Describes audio interrupt mode, refer to {@link #audio.InterruptMode}. If it is not
5800     * set, the default mode will be used. Set it before calling the {@link #play()} in the
5801     * first time in order for the interrupt mode to become effective thereafter.
5802     * @type { ?audio.InterruptMode }
5803     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5804     * @since 9
5805     * @deprecated since 9
5806     * @useinstead ohos.multimedia.media/media.AVPlayer#audioInterruptMode
5807     */
5808    audioInterruptMode?: audio.InterruptMode;
5809
5810    /**
5811     * video scale type. By default, the {@link #VIDEO_SCALE_TYPE_FIT} will be used, for more
5812     * information, refer to {@link #VideoScaleType}
5813     * @type { ?VideoScaleType }
5814     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5815     * @since 9
5816     * @deprecated since 9
5817     * @useinstead ohos.multimedia.media/media.AVPlayer#videoScaleType
5818     */
5819    videoScaleType?: VideoScaleType;
5820
5821    /**
5822     * set payback speed.
5823     * @param { number } speed - playback speed, see @PlaybackSpeed .
5824     * @param { AsyncCallback<number> } callback Callback used to return actually speed.
5825     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5826     * @since 8
5827     * @deprecated since 9
5828     * @useinstead ohos.multimedia.media/media.AVPlayer#setSpeed
5829     */
5830    setSpeed(speed: number, callback: AsyncCallback<number>): void;
5831    /**
5832     * set output surface.
5833     * @param { number } speed - playback speed, see @PlaybackSpeed .
5834     * @returns { Promise<number> } A Promise instance used to return actually speed.
5835     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5836     * @since 8
5837     * @deprecated since 9
5838     * @useinstead ohos.multimedia.media/media.AVPlayer#setSpeed
5839     */
5840    setSpeed(speed: number): Promise<number>;
5841
5842    /**
5843     * Listens for video playback completed events.
5844     * @param { 'playbackCompleted' } type - Type of the playback event to listen for.
5845     * @param { Callback<void> } callback - Callback used to listen for the playback event return.
5846     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5847     * @since 8
5848     * @deprecated since 9
5849     * @useinstead ohos.multimedia.media/media.AVPlayer#event:stateChange
5850     */
5851    on(type: 'playbackCompleted', callback: Callback<void>): void;
5852
5853    /**
5854     * Listens for video playback buffering events.
5855     * @param { 'bufferingUpdate' } type - Type of the playback buffering update event to listen for.
5856     * @param { function } callback - Callback used to listen for the buffering update event,
5857	 * return BufferingInfoType and the value.
5858     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5859     * @since 8
5860     * @deprecated since 9
5861     * @useinstead ohos.multimedia.media/media.AVPlayer#event:bufferingUpdate
5862     */
5863    on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;
5864
5865    /**
5866     * Listens for start render video frame events.
5867     * @param { 'startRenderFrame' } type - Type of the playback event to listen for.
5868     * @param { Callback<void> } callback - Callback used to listen for the playback event return.
5869     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5870     * @since 8
5871     * @deprecated since 9
5872     * @useinstead ohos.multimedia.media/media.AVPlayer#event:startRenderFrame
5873     */
5874    on(type: 'startRenderFrame', callback: Callback<void>): void;
5875
5876    /**
5877     * Listens for video size changed event.
5878     * @param { 'videoSizeChanged' } type - Type of the playback event to listen for.
5879     * @param { function } callback - Callback used to listen for the playback event return video size.
5880     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5881     * @since 8
5882     * @deprecated since 9
5883     * @useinstead ohos.multimedia.media/media.AVPlayer#event:videoSizeChange
5884     */
5885    on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void;
5886
5887    /**
5888     * Listens for audio interrupt event, refer to {@link #audio.InterruptEvent}
5889     * @param { 'audioInterrupt' } type - Type of the playback event to listen for.
5890     * @param { function } callback - Callback used to listen for the playback event return audio interrupt info.
5891     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5892     * @since 9
5893     * @deprecated since 9
5894     * @useinstead ohos.multimedia.media/media.AVPlayer#event:audioInterrupt
5895     */
5896    on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;
5897
5898    /**
5899     * Listens for playback error events.
5900     * @param { 'error' } type - Type of the playback error event to listen for.
5901     * @param { ErrorCallback } callback - Callback used to listen for the playback error event.
5902     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5903     * @since 8
5904     * @deprecated since 9
5905     * @useinstead ohos.multimedia.media/media.AVPlayer#event:error
5906     */
5907    on(type: 'error', callback: ErrorCallback): void;
5908  }
5909
5910  /**
5911   * Enumerates video scale type.
5912   *
5913   * @enum { number }
5914   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5915   * @since 9
5916   */
5917  /**
5918   * Enumerates video scale type.
5919   *
5920   * @enum { number }
5921   * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5922   * @crossplatform
5923   * @atomicservice
5924   * @since 12
5925   */
5926  enum VideoScaleType {
5927    /**
5928     * The content is stretched to the fit the display surface rendering area. When
5929     * the aspect ratio of the content is not same as the display surface, the aspect
5930     * of the content is not maintained. This is the default scale type.
5931     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5932     * @since 9
5933     */
5934    /**
5935     * The content is stretched to the fit the display surface rendering area. When
5936     * the aspect ratio of the content is not same as the display surface, the aspect
5937     * of the content is not maintained. This is the default scale type.
5938     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5939     * @crossplatform
5940     * @atomicservice
5941     * @since 12
5942     */
5943    VIDEO_SCALE_TYPE_FIT = 0,
5944
5945    /**
5946     * The content is stretched to the fit the display surface rendering area. When
5947     * the aspect ratio of the content is not the same as the display surface, content's
5948     * aspect ratio is maintained and the content is cropped to fit the display surface.
5949     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5950     * @since 9
5951     */
5952    /**
5953     * The content is stretched to the fit the display surface rendering area. When
5954     * the aspect ratio of the content is not the same as the display surface, content's
5955     * aspect ratio is maintained and the content is cropped to fit the display surface.
5956     * @syscap SystemCapability.Multimedia.Media.VideoPlayer
5957     * @crossplatform
5958     * @atomicservice
5959     * @since 12
5960     */
5961    VIDEO_SCALE_TYPE_FIT_CROP = 1,
5962  }
5963
5964  /**
5965   * Enumerates container format type(The abbreviation for 'container format type' is CFT).
5966   *
5967   * @enum { number }
5968   * @syscap SystemCapability.Multimedia.Media.Core
5969   * @since 8
5970   */
5971  /**
5972   * Enumerates container format type(The abbreviation for 'container format type' is CFT).
5973   *
5974   * @enum { number }
5975   * @syscap SystemCapability.Multimedia.Media.Core
5976   * @crossplatform
5977   * @atomicservice
5978   * @since 12
5979   */
5980  enum ContainerFormatType {
5981    /**
5982     * A video container format type mp4.
5983     * @syscap SystemCapability.Multimedia.Media.Core
5984     * @since 8
5985     */
5986    /**
5987     * A video container format type mp4.
5988     * @syscap SystemCapability.Multimedia.Media.Core
5989     * @crossplatform
5990     * @since 12
5991     */
5992    CFT_MPEG_4 = 'mp4',
5993
5994    /**
5995     * A audio container format type m4a.
5996     * @syscap SystemCapability.Multimedia.Media.Core
5997     * @since 8
5998     */
5999    /**
6000     * A audio container format type m4a.
6001     * @syscap SystemCapability.Multimedia.Media.Core
6002     * @crossplatform
6003     * @atomicservice
6004     * @since 12
6005     */
6006    CFT_MPEG_4A = 'm4a',
6007
6008    /**
6009     * A audio container format type mp3.
6010     * @syscap SystemCapability.Multimedia.Media.Core
6011     * @since 12
6012     */
6013    CFT_MP3 = 'mp3',
6014    /**
6015     * A audio container format type wav.
6016     * @syscap SystemCapability.Multimedia.Media.Core
6017     * @since 12
6018     */
6019    CFT_WAV = 'wav',
6020  }
6021
6022  /**
6023   * Enumerates media data type.
6024   *
6025   * @enum { number }
6026   * @syscap SystemCapability.Multimedia.Media.Core
6027   * @since 8
6028   */
6029  /**
6030   * Enumerates media data type.
6031   *
6032   * @enum { number }
6033   * @syscap SystemCapability.Multimedia.Media.Core
6034   * @atomicservice
6035   * @since 11
6036   */
6037  /**
6038   * Enumerates media data type.
6039   *
6040   * @enum { number }
6041   * @syscap SystemCapability.Multimedia.Media.Core
6042   * @crossplatform
6043   * @atomicservice
6044   * @since 12
6045   */
6046  enum MediaType {
6047    /**
6048     * track is audio.
6049     * @syscap SystemCapability.Multimedia.Media.Core
6050     * @since 8
6051     */
6052    /**
6053     * track is audio.
6054     * @syscap SystemCapability.Multimedia.Media.Core
6055     * @atomicservice
6056     * @since 11
6057     */
6058    /**
6059     * track is audio.
6060     * @syscap SystemCapability.Multimedia.Media.Core
6061     * @crossplatform
6062     * @atomicservice
6063     * @since 12
6064     */
6065    MEDIA_TYPE_AUD = 0,
6066    /**
6067     * track is video.
6068     * @syscap SystemCapability.Multimedia.Media.Core
6069     * @since 8
6070     */
6071    /**
6072     * track is video.
6073     * @syscap SystemCapability.Multimedia.Media.Core
6074     * @atomicservice
6075     * @since 11
6076     */
6077    /**
6078     * track is video.
6079     * @syscap SystemCapability.Multimedia.Media.Core
6080     * @crossplatform
6081     * @atomicservice
6082     * @since 12
6083     */
6084    MEDIA_TYPE_VID = 1,
6085    /**
6086     * Track is subtitle.
6087     * @syscap SystemCapability.Multimedia.Media.Core
6088     * @atomicservice
6089     * @since 12
6090     */
6091    MEDIA_TYPE_SUBTITLE = 2,
6092  }
6093
6094  /**
6095   * Enumerates media description key.
6096   *
6097   * @enum { number }
6098   * @syscap SystemCapability.Multimedia.Media.Core
6099   * @since 8
6100   */
6101  /**
6102   * Enumerates media description key.
6103   *
6104   * @enum { number }
6105   * @syscap SystemCapability.Multimedia.Media.Core
6106   * @atomicservice
6107   * @since 11
6108   */
6109  /**
6110   * Enumerates media description key.
6111   *
6112   * @enum { number }
6113   * @syscap SystemCapability.Multimedia.Media.Core
6114   * @crossplatform
6115   * @atomicservice
6116   * @since 12
6117   */
6118  enum MediaDescriptionKey {
6119    /**
6120     * key for track index, value type is number.
6121     * @syscap SystemCapability.Multimedia.Media.Core
6122     * @since 8
6123     */
6124    /**
6125     * key for track index, value type is number.
6126     * @syscap SystemCapability.Multimedia.Media.Core
6127     * @atomicservice
6128     * @since 11
6129     */
6130    /**
6131     * key for track index, value type is number.
6132     * @syscap SystemCapability.Multimedia.Media.Core
6133     * @crossplatform
6134     * @atomicservice
6135     * @since 12
6136     */
6137    MD_KEY_TRACK_INDEX = 'track_index',
6138
6139    /**
6140     * key for track type, value type is number, see @MediaType.
6141     * @syscap SystemCapability.Multimedia.Media.Core
6142     * @since 8
6143     */
6144    /**
6145     * key for track type, value type is number, see @MediaType.
6146     * @syscap SystemCapability.Multimedia.Media.Core
6147     * @atomicservice
6148     * @since 11
6149     */
6150    /**
6151     * key for track type, value type is number, see @MediaType.
6152     * @syscap SystemCapability.Multimedia.Media.Core
6153     * @crossplatform
6154     * @atomicservice
6155     * @since 12
6156     */
6157    MD_KEY_TRACK_TYPE = 'track_type',
6158
6159    /**
6160     * key for codec mime type, value type is string.
6161     * @syscap SystemCapability.Multimedia.Media.Core
6162     * @since 8
6163     */
6164    /**
6165     * key for codec mime type, value type is string.
6166     * @syscap SystemCapability.Multimedia.Media.Core
6167     * @atomicservice
6168     * @since 11
6169     */
6170    /**
6171     * key for codec mime type, value type is string.
6172     * @syscap SystemCapability.Multimedia.Media.Core
6173     * @crossplatform
6174     * @atomicservice
6175     * @since 12
6176     */
6177    MD_KEY_CODEC_MIME = 'codec_mime',
6178
6179    /**
6180     * key for duration, value type is number.
6181     * @syscap SystemCapability.Multimedia.Media.Core
6182     * @since 8
6183     */
6184    /**
6185     * key for duration, value type is number.
6186     * @syscap SystemCapability.Multimedia.Media.Core
6187     * @atomicservice
6188     * @since 11
6189     */
6190    /**
6191     * key for duration, value type is number.
6192     * @syscap SystemCapability.Multimedia.Media.Core
6193     * @crossplatform
6194     * @atomicservice
6195     * @since 12
6196     */
6197    MD_KEY_DURATION = 'duration',
6198
6199    /**
6200     * key for bitrate, value type is number.
6201     * @syscap SystemCapability.Multimedia.Media.Core
6202     * @since 8
6203     */
6204    /**
6205     * key for bitrate, value type is number.
6206     * @syscap SystemCapability.Multimedia.Media.Core
6207     * @atomicservice
6208     * @since 11
6209     */
6210    /**
6211     * key for bitrate, value type is number.
6212     * @syscap SystemCapability.Multimedia.Media.Core
6213     * @crossplatform
6214     * @atomicservice
6215     * @since 12
6216     */
6217    MD_KEY_BITRATE = 'bitrate',
6218
6219    /**
6220     * key for video width, value type is number.
6221     * @syscap SystemCapability.Multimedia.Media.Core
6222     * @since 8
6223     */
6224    /**
6225     * key for video width, value type is number.
6226     * @syscap SystemCapability.Multimedia.Media.Core
6227     * @atomicservice
6228     * @since 11
6229     */
6230    /**
6231     * key for video width, value type is number.
6232     * @syscap SystemCapability.Multimedia.Media.Core
6233     * @crossplatform
6234     * @atomicservice
6235     * @since 12
6236     */
6237    MD_KEY_WIDTH = 'width',
6238
6239    /**
6240     * key for video height, value type is number.
6241     * @syscap SystemCapability.Multimedia.Media.Core
6242     * @since 8
6243     */
6244    /**
6245     * key for video height, value type is number.
6246     * @syscap SystemCapability.Multimedia.Media.Core
6247     * @atomicservice
6248     * @since 11
6249     */
6250    /**
6251     * key for video height, value type is number.
6252     * @syscap SystemCapability.Multimedia.Media.Core
6253     * @crossplatform
6254     * @atomicservice
6255     * @since 12
6256     */
6257    MD_KEY_HEIGHT = 'height',
6258
6259    /**
6260     * key for video frame rate, value type is number.
6261     * @syscap SystemCapability.Multimedia.Media.Core
6262     * @since 8
6263     */
6264    /**
6265     * key for video frame rate, value type is number.
6266     * @syscap SystemCapability.Multimedia.Media.Core
6267     * @atomicservice
6268     * @since 11
6269     */
6270    /**
6271     * key for video frame rate, value type is number.
6272     * @syscap SystemCapability.Multimedia.Media.Core
6273     * @crossplatform
6274     * @atomicservice
6275     * @since 12
6276     */
6277    MD_KEY_FRAME_RATE = 'frame_rate',
6278
6279    /**
6280     * key for audio channel count, value type is number
6281     * @syscap SystemCapability.Multimedia.Media.Core
6282     * @since 8
6283     */
6284    /**
6285     * key for audio channel count, value type is number
6286     * @syscap SystemCapability.Multimedia.Media.Core
6287     * @atomicservice
6288     * @since 11
6289     */
6290    /**
6291     * key for audio channel count, value type is number
6292     * @syscap SystemCapability.Multimedia.Media.Core
6293     * @crossplatform
6294     * @atomicservice
6295     * @since 12
6296     */
6297    MD_KEY_AUD_CHANNEL_COUNT = 'channel_count',
6298
6299    /**
6300     * key for audio sample rate, value type is number
6301     * @syscap SystemCapability.Multimedia.Media.Core
6302     * @since 8
6303     */
6304    /**
6305     * key for audio sample rate, value type is number
6306     * @syscap SystemCapability.Multimedia.Media.Core
6307     * @atomicservice
6308     * @since 11
6309     */
6310    /**
6311     * key for audio sample rate, value type is number
6312     * @syscap SystemCapability.Multimedia.Media.Core
6313     * @crossplatform
6314     * @atomicservice
6315     * @since 12
6316     */
6317    MD_KEY_AUD_SAMPLE_RATE = 'sample_rate',
6318
6319    /**
6320     * key for audio bit depth, value type is number
6321     * @syscap SystemCapability.Multimedia.Media.Core
6322     * @atomicservice
6323     * @since 12
6324     */
6325    MD_KEY_AUD_SAMPLE_DEPTH = 'sample_depth',
6326
6327    /**
6328     * Key for language.
6329     * @syscap SystemCapability.Multimedia.Media.Core
6330     * @atomicservice
6331     * @since 12
6332     */
6333    MD_KEY_LANGUAGE = 'language',
6334
6335    /**
6336     * Key for track name, value is string.
6337     * @syscap SystemCapability.Multimedia.Media.Core
6338     * @atomicservice
6339     * @since 12
6340     */
6341    MD_KEY_TRACK_NAME = 'track_name',
6342
6343    /**
6344     * Key for video hdr type, value type is number.
6345     * @syscap SystemCapability.Multimedia.Media.Core
6346     * @atomicservice
6347     * @since 12
6348     */
6349    MD_KEY_HDR_TYPE = 'hdr_type',
6350  }
6351
6352  /**
6353   * Provides the video recorder profile definitions.
6354   *
6355   * @typedef VideoRecorderProfile
6356   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6357   * @systemapi
6358   * @since 9
6359   */
6360  interface VideoRecorderProfile {
6361    /**
6362     * Indicates the audio bit rate.
6363     * @type { number }
6364     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6365     * @systemapi
6366     * @since 9
6367     */
6368    readonly audioBitrate: number;
6369
6370    /**
6371     * Indicates the number of audio channels.
6372     * @type { number }
6373     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6374     * @systemapi
6375     * @since 9
6376     */
6377    readonly audioChannels: number;
6378
6379    /**
6380     * Indicates the audio encoding format.
6381     * @type { CodecMimeType }
6382     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6383     * @systemapi
6384     * @since 9
6385     */
6386    readonly audioCodec: CodecMimeType;
6387
6388    /**
6389     * Indicates the audio sampling rate.
6390     * @type { number }
6391     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6392     * @systemapi
6393     * @since 9
6394     */
6395    readonly audioSampleRate: number;
6396
6397    /**
6398     * Indicates the output file format.
6399     * @type { ContainerFormatType }
6400     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6401     * @systemapi
6402     * @since 9
6403     */
6404    readonly fileFormat: ContainerFormatType;
6405
6406    /**
6407     * Indicates the video bit rate.
6408     * @type { number }
6409     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6410     * @systemapi
6411     * @since 9
6412     */
6413    readonly videoBitrate: number;
6414
6415    /**
6416     * Indicates the video encoding format.
6417     * @type { CodecMimeType }
6418     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6419     * @systemapi
6420     * @since 9
6421     */
6422    readonly videoCodec: CodecMimeType;
6423
6424    /**
6425     * Indicates the video width.
6426     * @type { number }
6427     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6428     * @systemapi
6429     * @since 9
6430     */
6431    readonly videoFrameWidth: number;
6432
6433    /**
6434     * Indicates the video height.
6435     * @type { number }
6436     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6437     * @systemapi
6438     * @since 9
6439     */
6440    readonly videoFrameHeight: number;
6441
6442    /**
6443     * Indicates the video frame rate.
6444     * @type { number }
6445     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6446     * @systemapi
6447     * @since 9
6448     */
6449    readonly videoFrameRate: number;
6450  }
6451
6452  /**
6453   * Enumerates audio source type for recorder.
6454   *
6455   * @enum { number }
6456   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6457   * @since 9
6458   */
6459  /**
6460   * Enumerates audio source type for recorder.
6461   *
6462   * @enum { number }
6463   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6464   * @crossplatform
6465   * @atomicservice
6466   * @since 12
6467   */
6468  enum AudioSourceType {
6469    /**
6470     * Default audio source type.
6471     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6472     * @since 9
6473     */
6474    /**
6475     * Default audio source type.
6476     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6477     * @crossplatform
6478     * @since 12
6479     */
6480    AUDIO_SOURCE_TYPE_DEFAULT = 0,
6481    /**
6482     * Source type mic.
6483     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6484     * @since 9
6485     */
6486    /**
6487     * Source type mic.
6488     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6489     * @crossplatform
6490     * @atomicservice
6491     * @since 12
6492     */
6493    AUDIO_SOURCE_TYPE_MIC = 1,
6494    /**
6495    * Source type Voice recognition.
6496    * @syscap SystemCapability.Multimedia.Media.AVRecorder
6497    * @since 12
6498    */
6499    AUDIO_SOURCE_TYPE_VOICE_RECOGNITION = 2,
6500
6501    /**
6502    * Source type Voice communication.
6503    * @syscap SystemCapability.Multimedia.Media.AVRecorder
6504    * @since 12
6505    */
6506    AUDIO_SOURCE_TYPE_VOICE_COMMUNICATION = 7,
6507    /**
6508    * Source type Voice message.
6509    * @syscap SystemCapability.Multimedia.Media.AVRecorder
6510    * @since 12
6511    */
6512    AUDIO_SOURCE_TYPE_VOICE_MESSAGE = 10,
6513    /**
6514    * Source type Camcorder.
6515    * @syscap SystemCapability.Multimedia.Media.AVRecorder
6516    * @since 12
6517    */
6518    AUDIO_SOURCE_TYPE_CAMCORDER = 13,
6519  }
6520
6521  /**
6522   * Enumerates video source type for recorder.
6523   *
6524   * @enum { number }
6525   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6526   * @since 9
6527   */
6528  /**
6529   * Enumerates video source type for recorder.
6530   *
6531   * @enum { number }
6532   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6533   * @crossplatform
6534   * @since 12
6535   */
6536  enum VideoSourceType {
6537    /**
6538     * Surface raw data.
6539     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6540     * @since 9
6541     */
6542    /**
6543     * Surface raw data.
6544     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6545     * @crossplatform
6546     * @since 12
6547     */
6548    VIDEO_SOURCE_TYPE_SURFACE_YUV = 0,
6549    /**
6550     * Surface ES data.
6551     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6552     * @since 9
6553     */
6554    /**
6555     * Surface ES data.
6556     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6557     * @crossplatform
6558     * @since 12
6559     */
6560    VIDEO_SOURCE_TYPE_SURFACE_ES = 1,
6561  }
6562
6563  /**
6564   * Enumerates meta source type for recorder.
6565   *
6566   * @enum { number }
6567   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6568   * @systemapi
6569   * @since 12
6570   */
6571  enum MetaSourceType {
6572    /**
6573     * Maker info for video.
6574     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6575     * @systemapi
6576     * @since 12
6577     */
6578    VIDEO_MAKER_INFO = 0,
6579  }
6580
6581  /**
6582   * Enumerates mode of creating recorder file
6583   *
6584   * @enum { number }
6585   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6586   * @since 12
6587   */
6588  enum FileGenerationMode {
6589    /**
6590     * file created by app
6591     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6592     * @since 12
6593     */
6594    APP_CREATE = 0,
6595    /**
6596     * file created by system, valid only in camera scene.
6597     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6598     * @since 12
6599     */
6600    AUTO_CREATE_CAMERA_SCENE = 1,
6601  }
6602
6603  /**
6604   * Provides the video recorder configuration definitions.
6605   *
6606   * @typedef VideoRecorderConfig
6607   * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6608   * @systemapi
6609   * @since 9
6610   */
6611  interface VideoRecorderConfig {
6612    /**
6613     * audio source type, details see @AudioSourceType .
6614     * @type { ?AudioSourceType }
6615     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6616     * @systemapi
6617     * @since 9
6618     */
6619    audioSourceType?: AudioSourceType;
6620    /**
6621     * video source type, details see @VideoSourceType .
6622     * @type { VideoSourceType }
6623     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6624     * @systemapi
6625     * @since 9
6626     */
6627    videoSourceType: VideoSourceType;
6628    /**
6629     * video recorder profile, can get by "getVideoRecorderProfile", details see @VideoRecorderProfile .=
6630     * @type { VideoRecorderProfile }
6631     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6632     * @systemapi
6633     * @since 9
6634     */
6635    profile: VideoRecorderProfile;
6636    /**
6637     * video output uri.support two kind of uri now.
6638     * format like: scheme + "://" + "context".
6639     * fd:    fd://fd
6640     * @type { string }
6641     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6642     * @systemapi
6643     * @since 9
6644     */
6645    url: string;
6646    /**
6647     * Sets the video rotation angle in output file, and for the file to playback. mp4 support.
6648     * the range of rotation angle should be {0, 90, 180, 270}, default is 0.
6649     * @type { ?number }
6650     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6651     * @systemapi
6652     * @since 9
6653     */
6654    rotation?: number;
6655    /**
6656     * geographical location information.
6657     * @type { ?Location }
6658     * @syscap SystemCapability.Multimedia.Media.VideoRecorder
6659     * @systemapi
6660     * @since 9
6661     */
6662    location?: Location;
6663  }
6664
6665  /**
6666   * Provides encoder info.
6667   *
6668   * @typedef EncoderInfo
6669   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6670   * @since 11
6671   */
6672  interface EncoderInfo {
6673    /**
6674     * encoder format MIME
6675     * @type { CodecMimeType }
6676     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6677     * @since 11
6678     */
6679    mimeType: CodecMimeType;
6680
6681    /**
6682     * encoder type, audio or video
6683     * @type { string }
6684     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6685     * @since 11
6686     */
6687    type: string;
6688
6689    /**
6690     * audio or video encoder bitRate range
6691     * @type { ?Range }
6692     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6693     * @since 11
6694     */
6695    bitRate?: Range;
6696
6697    /**
6698     * video encoder frame rate range
6699     * @type { ?Range }
6700     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6701     * @since 11
6702     */
6703    frameRate?: Range;
6704
6705    /**
6706     * video encoder width range
6707     * @type { ?Range }
6708     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6709     * @since 11
6710     */
6711    width?: Range;
6712
6713    /**
6714     * video encoder height range
6715     * @type { ?Range }
6716     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6717     * @since 11
6718     */
6719    height?: Range;
6720
6721    /**
6722     * audio encoder channel range
6723     * @type { ?Range }
6724     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6725     * @since 11
6726     */
6727    channels?: Range;
6728
6729    /**
6730     * audio encoder sample rate collection
6731     * @type { ?Array<number> }
6732     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6733     * @since 11
6734     */
6735    sampleRate?: Array<number>;
6736  }
6737
6738  /**
6739   * Provides Range with lower and upper limit.
6740   *
6741   * @typedef Range
6742   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6743   * @since 11
6744   */
6745  interface Range {
6746    /**
6747     * lower limit of the range
6748     * @type { number }
6749     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6750     * @since 11
6751     */
6752    min: number;
6753
6754    /**
6755     * upper limit of the range
6756     * @type { number }
6757     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6758     * @since 11
6759     */
6760    max: number;
6761  }
6762
6763  /**
6764   * Provides the media recorder profile definitions.
6765   *
6766   * @typedef AVRecorderProfile
6767   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6768   * @since 9
6769   */
6770  /**
6771   * Provides the media recorder profile definitions.
6772   *
6773   * @typedef AVRecorderProfile
6774   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6775   * @crossplatform
6776   * @atomicservice
6777   * @since 12
6778   */
6779  interface AVRecorderProfile {
6780    /**
6781     * Indicates the audio bitrate.
6782     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6783     * @since 9
6784     */
6785    /**
6786     * Indicates the audio bitrate.
6787     * @type { ?number }
6788     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6789     * @crossplatform
6790     * @atomicservice
6791     * @since 12
6792     */
6793    audioBitrate?: number;
6794
6795    /**
6796     * Indicates the number of audio channels.
6797     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6798     * @since 9
6799     */
6800    /**
6801     * Indicates the number of audio channels.
6802     * @type { ?number }
6803     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6804     * @crossplatform
6805     * @atomicservice
6806     * @since 12
6807     */
6808    audioChannels?: number;
6809
6810    /**
6811     * Indicates the audio encoding format.
6812     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6813     * @since 9
6814     */
6815    /**
6816     * Indicates the audio encoding format.
6817     * @type { ?CodecMimeType }
6818     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6819     * @crossplatform
6820     * @atomicservice
6821     * @since 12
6822     */
6823    audioCodec?: CodecMimeType;
6824
6825    /**
6826     * Indicates the audio sampling rate.
6827     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6828     * @since 9
6829     */
6830    /**
6831     * Indicates the audio sampling rate.
6832     * @type { ?number }
6833     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6834     * @crossplatform
6835     * @atomicservice
6836     * @since 12
6837     */
6838    audioSampleRate?: number;
6839
6840    /**
6841     * Indicates the output file format.
6842     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6843     * @since 9
6844     */
6845    /**
6846     * Indicates the output file format.
6847     * @type { ContainerFormatType }
6848     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6849     * @crossplatform
6850     * @atomicservice
6851     * @since 12
6852     */
6853    fileFormat: ContainerFormatType;
6854
6855    /**
6856     * Indicates the video bitrate.
6857     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6858     * @since 9
6859     */
6860    /**
6861     * Indicates the video bitrate.
6862     * @type { ?number }
6863     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6864     * @crossplatform
6865     * @since 12
6866     */
6867    videoBitrate?: number;
6868
6869    /**
6870     * Indicates the video encoding format.
6871     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6872     * @since 9
6873     */
6874    /**
6875     * Indicates the video encoding format.
6876     * @type { ?CodecMimeType }
6877     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6878     * @crossplatform
6879     * @since 12
6880     */
6881    videoCodec?: CodecMimeType;
6882
6883    /**
6884     * Indicates the video width.
6885     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6886     * @since 9
6887     */
6888    /**
6889     * Indicates the video width.
6890     * @type { ?number }
6891     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6892     * @crossplatform
6893     * @since 12
6894     */
6895    videoFrameWidth?: number;
6896
6897    /**
6898     * Indicates the video height.
6899     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6900     * @since 9
6901     */
6902    /**
6903     * Indicates the video height.
6904     * @type { ?number }
6905     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6906     * @crossplatform
6907     * @since 12
6908     */
6909    videoFrameHeight?: number;
6910
6911    /**
6912     * Indicates the video frame rate.
6913     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6914     * @since 9
6915     */
6916    /**
6917     * Indicates the video frame rate.
6918     * @type { ?number }
6919     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6920     * @crossplatform
6921     * @since 12
6922     */
6923    videoFrameRate?: number;
6924
6925    /**
6926     * Whether to record HDR video.
6927     * @type { ?boolean }
6928     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6929     * @since 11
6930     */
6931    /**
6932     * Whether to record HDR video.
6933     * @type { ?boolean }
6934     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6935     * @crossplatform
6936     * @since 12
6937     */
6938    isHdr?: boolean;
6939
6940    /**
6941     * Whether to encode the video in temporal scale mode.
6942     * @type { ?boolean }
6943     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6944     * @crossplatform
6945     * @since 12
6946     */
6947    enableTemporalScale?: boolean;
6948  }
6949
6950  /**
6951   * Provides the media recorder configuration definitions.
6952   *
6953   * @typedef AVRecorderConfig
6954   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6955   * @since 9
6956   */
6957  /**
6958   * Provides the media recorder configuration definitions.
6959   *
6960   * @typedef AVRecorderConfig
6961   * @syscap SystemCapability.Multimedia.Media.AVRecorder
6962   * @crossplatform
6963   * @atomicservice
6964   * @since 12
6965   */
6966  interface AVRecorderConfig {
6967    /**
6968     * Audio source type, details see @AudioSourceType .
6969     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6970     * @since 9
6971     */
6972    /**
6973     * Audio source type, details see @AudioSourceType .
6974     * @type { ?AudioSourceType }
6975     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6976     * @crossplatform
6977     * @atomicservice
6978     * @since 12
6979     */
6980    audioSourceType?: AudioSourceType;
6981    /**
6982     * Video source type, details see @VideoSourceType .
6983     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6984     * @since 9
6985     */
6986    /**
6987     * Video source type, details see @VideoSourceType .
6988     * @type { ?VideoSourceType }
6989     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6990     * @crossplatform
6991     * @since 12
6992     */
6993    videoSourceType?: VideoSourceType;
6994    /**
6995     * Meta source types, details see @MetaSourceType .
6996     * @type { ?Array<MetaSourceType> }
6997     * @syscap SystemCapability.Multimedia.Media.AVRecorder
6998     * @systemapi
6999     * @since 12
7000     */
7001    metaSourceTypes?: Array<MetaSourceType>;
7002    /**
7003     * Video recorder profile, details see @AVRecorderProfile .
7004     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7005     * @since 9
7006     */
7007    /**
7008     * Video recorder profile, details see @AVRecorderProfile .
7009     * @type { AVRecorderProfile }
7010     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7011     * @crossplatform
7012     * @atomicservice
7013     * @since 12
7014     */
7015    profile: AVRecorderProfile;
7016    /**
7017     * File output uri, support a kind of uri now.
7018     * format like: "fd://" + "context".
7019     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7020     * @since 9
7021     */
7022    /**
7023     * File output uri, support a kind of uri now.
7024     * format like: "fd://" + "context".
7025     * @type { string }
7026     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7027     * @crossplatform
7028     * @atomicservice
7029     * @since 12
7030     */
7031    url: string;
7032    /**
7033     * Mode of creating recorder file, details see @FileGenerationMode.
7034     * @type { ?FileGenerationMode }
7035     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7036     * @since 12
7037     */
7038    fileGenerationMode?: FileGenerationMode;
7039    /**
7040     * Sets the video rotation angle in output file, and for the file to playback, mp4 support
7041     * the range of rotation angle should be {0, 90, 180, 270}, default is 0.
7042     * @type { ?number }
7043     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7044     * @since 9
7045     * @deprecated since 12
7046     * @useinstead ohos.multimedia.media/media.AVMetadata#videoOrientation
7047     */
7048    rotation?: number;
7049    /**
7050     * Geographical location information.
7051     * @type { ?Location }
7052     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7053     * @since 9
7054     * @deprecated since 12
7055     * @useinstead ohos.multimedia.media/media.AVMetadata#location
7056     */
7057    location?: Location;
7058    /**
7059     * Set global metadata info. Details see @AVMetadata
7060     * @type { ?AVMetadata }
7061     * @syscap SystemCapability.Multimedia.Media.AVRecorder
7062     * @since 12
7063     */
7064    metadata?: AVMetadata;
7065  }
7066
7067  /**
7068   * Provides the container definition for media description key-value pairs.
7069   *
7070   * @typedef MediaDescription
7071   * @syscap SystemCapability.Multimedia.Media.Core
7072   * @since 8
7073   */
7074  /**
7075   * Provides the container definition for media description key-value pairs.
7076   *
7077   * @typedef MediaDescription
7078   * @syscap SystemCapability.Multimedia.Media.Core
7079   * @atomicservice
7080   * @since 11
7081   */
7082  /**
7083   * Provides the container definition for media description key-value pairs.
7084   *
7085   * @typedef MediaDescription
7086   * @syscap SystemCapability.Multimedia.Media.Core
7087   * @crossplatform
7088   * @atomicservice
7089   * @since 12
7090   */
7091  interface MediaDescription {
7092    /**
7093     * key:value pair, key see @MediaDescriptionKey .
7094     * @syscap SystemCapability.Multimedia.Media.Core
7095     * @since 8
7096     */
7097    /**
7098     * key:value pair, key see @MediaDescriptionKey .
7099     * @syscap SystemCapability.Multimedia.Media.Core
7100     * @atomicservice
7101     * @since 11
7102     */
7103    /**
7104     * key:value pair, key see @MediaDescriptionKey .
7105     * @syscap SystemCapability.Multimedia.Media.Core
7106     * @crossplatform
7107     * @atomicservice
7108     * @since 12
7109     */
7110    [key: string]: Object;
7111  }
7112
7113  /**
7114   * Enumerates seek mode.
7115   *
7116   * @enum { number }
7117   * @syscap SystemCapability.Multimedia.Media.Core
7118   * @since 8
7119   */
7120  /**
7121   * Enumerates seek mode.
7122   *
7123   * @enum { number }
7124   * @syscap SystemCapability.Multimedia.Media.Core
7125   * @atomicservice
7126   * @since 11
7127   */
7128  /**
7129   * Enumerates seek mode.
7130   *
7131   * @enum { number }
7132   * @syscap SystemCapability.Multimedia.Media.Core
7133   * @crossplatform
7134   * @atomicservice
7135   * @since 12
7136   */
7137  enum SeekMode {
7138    /**
7139     * seek to the next sync frame of the given timestamp
7140     * @syscap SystemCapability.Multimedia.Media.Core
7141     * @since 8
7142     */
7143    /**
7144     * seek to the next sync frame of the given timestamp
7145     * @syscap SystemCapability.Multimedia.Media.Core
7146     * @atomicservice
7147     * @since 11
7148     */
7149    /**
7150     * seek to the next sync frame of the given timestamp
7151     * @syscap SystemCapability.Multimedia.Media.Core
7152     * @crossplatform
7153     * @atomicservice
7154     * @since 12
7155     */
7156    SEEK_NEXT_SYNC = 0,
7157    /**
7158     * seek to the previous sync frame of the given timestamp
7159     * @syscap SystemCapability.Multimedia.Media.Core
7160     * @since 8
7161     */
7162    /**
7163     * seek to the previous sync frame of the given timestamp
7164     * @syscap SystemCapability.Multimedia.Media.Core
7165     * @atomicservice
7166     * @since 11
7167     */
7168    /**
7169     * seek to the previous sync frame of the given timestamp
7170     * @syscap SystemCapability.Multimedia.Media.Core
7171     * @crossplatform
7172     * @atomicservice
7173     * @since 12
7174     */
7175    SEEK_PREV_SYNC = 1,
7176    /**
7177     * Seek to the closest frame of the given timestamp.
7178     * @syscap SystemCapability.Multimedia.Media.Core
7179     * @atomicservice
7180     * @since 12
7181     */
7182    SEEK_CLOSEST = 2,
7183    /**
7184     * Seek in continuous mode.
7185     * @syscap SystemCapability.Multimedia.Media.Core
7186     * @systemapi
7187     * @since 13
7188     */
7189    SEEK_CONTINUOUS = 3,
7190  }
7191
7192  /**
7193   * Enumerates switch mode.
7194   *
7195   * @enum { number }
7196   * @syscap SystemCapability.Multimedia.Media.Core
7197   * @crossplatform
7198   * @atomicservice
7199   * @since 12
7200   */
7201  enum SwitchMode {
7202    /**
7203     * switch to the next sync frame of the given timestamp
7204     * @syscap SystemCapability.Multimedia.Media.Core
7205     * @crossplatform
7206     * @atomicservice
7207     * @since 12
7208     */
7209    SMOOTH = 0,
7210    /**
7211     * switch to the previous sync frame of the given timestamp
7212     * @syscap SystemCapability.Multimedia.Media.Core
7213     * @crossplatform
7214     * @atomicservice
7215     * @since 12
7216     */
7217    SEGMENT = 1,
7218    /**
7219     * switch to the closest frame of the given timestamp.
7220     * @syscap SystemCapability.Multimedia.Media.Core
7221     * @atomicservice
7222     * @since 12
7223     */
7224    CLOSEST = 2,
7225  }
7226
7227  /**
7228   * Enumerates Codec MIME types.
7229   *
7230   * @enum { string }
7231   * @syscap SystemCapability.Multimedia.Media.Core
7232   * @since 8
7233   */
7234  /**
7235   * Enumerates Codec MIME types.
7236   *
7237   * @enum { string }
7238   * @syscap SystemCapability.Multimedia.Media.Core
7239   * @crossplatform
7240   * @atomicservice
7241   * @since 12
7242   */
7243  enum CodecMimeType {
7244    /**
7245     * H.263 codec MIME type.
7246     * @syscap SystemCapability.Multimedia.Media.Core
7247     * @since 8
7248     */
7249    /**
7250     * H.263 codec MIME type.
7251     * @syscap SystemCapability.Multimedia.Media.Core
7252     * @crossplatform
7253     * @since 12
7254     */
7255    VIDEO_H263 = 'video/h263',
7256    /**
7257     * H.264 codec MIME type.
7258     * @syscap SystemCapability.Multimedia.Media.Core
7259     * @since 8
7260     */
7261    /**
7262     * H.264 codec MIME type.
7263     * @syscap SystemCapability.Multimedia.Media.Core
7264     * @crossplatform
7265     * @since 12
7266     */
7267    VIDEO_AVC = 'video/avc',
7268    /**
7269     * MPEG2 codec MIME type.
7270     * @syscap SystemCapability.Multimedia.Media.Core
7271     * @since 8
7272     */
7273    /**
7274     * MPEG2 codec MIME type.
7275     * @syscap SystemCapability.Multimedia.Media.Core
7276     * @crossplatform
7277     * @since 12
7278     */
7279    VIDEO_MPEG2 = 'video/mpeg2',
7280    /**
7281     * MPEG4 codec MIME type
7282     * @syscap SystemCapability.Multimedia.Media.Core
7283     * @since 8
7284     */
7285    /**
7286     * MPEG4 codec MIME type
7287     * @syscap SystemCapability.Multimedia.Media.Core
7288     * @crossplatform
7289     * @since 12
7290     */
7291    VIDEO_MPEG4 = 'video/mp4v-es',
7292
7293    /**
7294     * VP8 codec MIME type
7295     * @syscap SystemCapability.Multimedia.Media.Core
7296     * @since 8
7297     */
7298    /**
7299     * VP8 codec MIME type
7300     * @syscap SystemCapability.Multimedia.Media.Core
7301     * @crossplatform
7302     * @since 12
7303     */
7304    VIDEO_VP8 = 'video/x-vnd.on2.vp8',
7305
7306    /**
7307     * AAC codec MIME type.
7308     * @syscap SystemCapability.Multimedia.Media.Core
7309     * @since 8
7310     */
7311    /**
7312     * AAC codec MIME type.
7313     * @syscap SystemCapability.Multimedia.Media.Core
7314     * @crossplatform
7315     * @atomicservice
7316     * @since 12
7317     */
7318    AUDIO_AAC = 'audio/mp4a-latm',
7319
7320    /**
7321     * vorbis codec MIME type.
7322     * @syscap SystemCapability.Multimedia.Media.Core
7323     * @since 8
7324     */
7325    /**
7326     * vorbis codec MIME type.
7327     * @syscap SystemCapability.Multimedia.Media.Core
7328     * @crossplatform
7329     * @since 12
7330     */
7331    AUDIO_VORBIS = 'audio/vorbis',
7332
7333    /**
7334     * flac codec MIME type.
7335     * @syscap SystemCapability.Multimedia.Media.Core
7336     * @since 8
7337     */
7338    /**
7339     * flac codec MIME type.
7340     * @syscap SystemCapability.Multimedia.Media.Core
7341     * @crossplatform
7342     * @since 12
7343     */
7344    AUDIO_FLAC = 'audio/flac',
7345
7346    /**
7347     * H.265 codec MIME type.
7348     * @syscap SystemCapability.Multimedia.Media.Core
7349     * @since 11
7350     */
7351    /**
7352     * H.265 codec MIME type.
7353     * @syscap SystemCapability.Multimedia.Media.Core
7354     * @crossplatform
7355     * @since 12
7356     */
7357    VIDEO_HEVC = 'video/hevc',
7358    /**
7359     * mp3 codec MIME type.
7360     * @syscap SystemCapability.Multimedia.Media.Core
7361     * @since 12
7362     */
7363    AUDIO_MP3 = 'audio/mpeg',
7364    /**
7365     * G711-mulaw codec MIME type.
7366     * @syscap SystemCapability.Multimedia.Media.Core
7367     * @since 12
7368     */
7369    AUDIO_G711MU = 'audio/g711mu',
7370  }
7371
7372  /**
7373   *  Enumerates AVScreenCaptureRecord preset types.
7374   *
7375   * @enum { number }
7376   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7377   * @since 12
7378   */
7379  enum AVScreenCaptureRecordPreset {
7380    /**
7381     * Screen record normal type, h264/aac mp4
7382     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7383     * @since 12
7384     */
7385    SCREEN_RECORD_PRESET_H264_AAC_MP4 = 0,
7386    /**
7387     * Screen record high efficient type, h265/aac mp4
7388     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7389     * @since 12
7390     */
7391    SCREEN_RECORD_PRESET_H265_AAC_MP4 = 1,
7392  }
7393
7394  /**
7395   *  Enumerates AVScreenCapture callback state type.
7396   *
7397   * @enum { number }
7398   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7399   * @since 12
7400   */
7401  enum AVScreenCaptureStateCode {
7402    /**
7403     * Screen capture started
7404     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7405     * @since 12
7406     */
7407    SCREENCAPTURE_STATE_STARTED = 0,
7408    /**
7409     * Screen capture canceled
7410     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7411     * @since 12
7412     */
7413    SCREENCAPTURE_STATE_CANCELED = 1,
7414    /**
7415     * Screen capture stopped by user
7416     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7417     * @since 12
7418     */
7419    SCREENCAPTURE_STATE_STOPPED_BY_USER = 2,
7420    /**
7421     * Screen capture stopped by interrupt
7422     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7423     * @since 12
7424     */
7425    SCREENCAPTURE_STATE_INTERRUPTED_BY_OTHER = 3,
7426    /**
7427     * Screen capture stopped by phone call
7428     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7429     * @since 12
7430     */
7431    SCREENCAPTURE_STATE_STOPPED_BY_CALL = 4,
7432    /**
7433     * Screen capture microphone not available
7434     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7435     * @since 12
7436     */
7437    SCREENCAPTURE_STATE_MIC_UNAVAILABLE = 5,
7438    /**
7439     * Screen capture microphone is muted by user
7440     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7441     * @since 12
7442     */
7443    SCREENCAPTURE_STATE_MIC_MUTED_BY_USER = 6,
7444    /**
7445     * Screen capture microphone is unmuted by user
7446     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7447     * @since 12
7448     */
7449    SCREENCAPTURE_STATE_MIC_UNMUTED_BY_USER = 7,
7450    /**
7451     * Screen capture enter private scene
7452     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7453     * @since 12
7454     */
7455    SCREENCAPTURE_STATE_ENTER_PRIVATE_SCENE = 8,
7456    /**
7457     * Screen capture exit private scene
7458     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7459     * @since 12
7460     */
7461    SCREENCAPTURE_STATE_EXIT_PRIVATE_SCENE = 9,
7462    /**
7463     * Screen capture stopped by user switches
7464     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7465     * @since 12
7466     */
7467    SCREENCAPTURE_STATE_STOPPED_BY_USER_SWITCHES = 10,
7468  }
7469
7470  /**
7471   * Provides the media AVScreenCaptureRecord config definition.
7472   *
7473   * @typedef AVScreenCaptureRecordConfig
7474   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7475   * @since 12
7476   */
7477  interface AVScreenCaptureRecordConfig {
7478    /**
7479     * Indicates record file descriptor.
7480     * @type { number }
7481     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7482     * @since 12
7483     */
7484    fd: number;
7485    /**
7486     * Indicates video frame width.
7487     * @type { ?number }
7488     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7489     * @since 12
7490     */
7491    frameWidth?: number;
7492    /**
7493     * Indicates video frame height.
7494     * @type { ?number }
7495     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7496     * @since 12
7497     */
7498    frameHeight?: number;
7499    /**
7500     * Indicates video bitrate.
7501     * @type { ?number }
7502     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7503     * @since 12
7504     */
7505    videoBitrate?: number;
7506    /**
7507     * Indicates audio sample rate.
7508     * @type { ?number }
7509     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7510     * @since 12
7511     */
7512    audioSampleRate?: number;
7513    /**
7514     * Indicates audio channel count.
7515     * @type { ?number }
7516     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7517     * @since 12
7518     */
7519    audioChannelCount?: number;
7520    /**
7521     * Indicates audio bitrate.
7522     * @type { ?number }
7523     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7524     * @since 12
7525     */
7526    audioBitrate?: number;
7527    /**
7528     * Indicates AVScreenCaptureRecordPreset, details see @AVScreenCaptureRecordPreset
7529     * @type { ?AVScreenCaptureRecordPreset }
7530     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7531     * @since 12
7532     */
7533    preset?: AVScreenCaptureRecordPreset;
7534  }
7535
7536  /**
7537   * Provides screen capture record. Before calling an AVScreenCaptureRecorder method, you must use createAVScreenCaptureRecorder()
7538   * to create an AVScreenCaptureRecorder instance.
7539   *
7540   * @typedef AVScreenCaptureRecorder
7541   * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7542   * @since 12
7543   */
7544  interface AVScreenCaptureRecorder {
7545    /**
7546     * Init AVScreenCaptureRecorder.
7547     * @param { AVScreenCaptureRecordConfig } config - AVScreenCaptureRecorder config.
7548     * @returns { Promise<void> } A Promise instance used to return when init completed.
7549     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified.
7550     * <br>2. Incorrect parameter types. 3. Parameter verification failed. Return by promise.
7551     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7552     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7553     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7554     * @since 12
7555     */
7556    init(config: AVScreenCaptureRecordConfig): Promise<void>;
7557
7558    /**
7559     * Start screen capture recording.
7560     * @returns { Promise<void> } A Promise instance used to return when startRecording completed.
7561     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7562     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7563     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7564     * @since 12
7565     */
7566    startRecording(): Promise<void>;
7567
7568    /**
7569     * Stop screen capture recording.
7570     * @returns { Promise<void> } A Promise instance used to return when stopRecording completed.
7571     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7572     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7573     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7574     * @since 12
7575     */
7576    stopRecording(): Promise<void>;
7577
7578    /**
7579     * Skip some windows' privacy mode of current app during the screen recording.
7580     * @param { Array<number> } windowIDs - windowID list to be skipped privacy mode .
7581     * @returns { Promise<void> } A Promise instance used to return when skipPrivacyMode completed.
7582     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7583     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7584     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7585     * @since 12
7586     */
7587    skipPrivacyMode(windowIDs: Array<number>): Promise<void>;
7588
7589    /**
7590     * Set microphone enable or disable.
7591     * @param { boolean } enable - Set microphone enable or disable during recording.
7592     * @returns { Promise<void> } A Promise instance used to return when setMicEnabled completed.
7593     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7594     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7595     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7596     * @since 12
7597     */
7598    setMicEnabled(enable: boolean): Promise<void>;
7599
7600    /**
7601     * Release screen capture recording.
7602     * @returns { Promise<void> } A Promise instance used to return when release completed.
7603     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7604     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7605     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7606     * @since 12
7607     */
7608    release(): Promise<void>;
7609
7610    /**
7611     * Listens for AVScreenCaptureRecord info callback.
7612     * @param { 'stateChange' } type - Type of the AVScreenCaptureRecord event to listen for.
7613     * @param { Callback<AVScreenCaptureStateCode> } callback - Callback used to listen for the AVScreenCaptureRecord info return.
7614     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7615     * @since 12
7616     */
7617    on(type: 'stateChange', callback: Callback<AVScreenCaptureStateCode>): void;
7618
7619    /**
7620     * Listens for AVScreenCaptureRecord info callback.
7621     * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for.
7622     * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return.
7623     * @throws { BusinessError } 201 - permission denied.
7624     * @throws { BusinessError } 5400103 - IO error. Return by ErrorCallback.
7625     * @throws { BusinessError } 5400105 - Service died. Return by ErrorCallback.
7626     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7627     * @since 12
7628     */
7629    on(type: 'error', callback: ErrorCallback): void;
7630
7631    /**
7632     * Unregister listens for AVScreenCaptureRecord info callback.
7633     * @param { 'stateChange' } type - Type of the AVScreenCaptureRecord event to listen for.
7634     * @param { Callback<AVScreenCaptureStateCode> } callback - Callback used to listen for the AVScreenCaptureRecord info return.
7635     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7636     * @since 12
7637     */
7638    off(type: 'stateChange', callback?: Callback<AVScreenCaptureStateCode>): void;
7639
7640    /**
7641     * Unregister listens for AVScreenCaptureRecord error callback.
7642     * @param { 'error' } type - Type of the AVScreenCaptureRecord event to listen for.
7643     * @param { ErrorCallback } callback - Callback used to listen for the AVScreenCaptureRecord error return.
7644     * @syscap SystemCapability.Multimedia.Media.AVScreenCapture
7645     * @since 12
7646     */
7647    off(type: 'error', callback?: ErrorCallback): void;
7648  }
7649
7650  /**
7651   * Provides the video transcode configuration definitions
7652   *
7653   * @typedef AVTranscoderConfig
7654   * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7655   * @since 12
7656   */
7657  interface AVTranscoderConfig {
7658    /**
7659     * Indicates the audio bitrate.
7660     * @type { ?number }
7661     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7662     * @since 12
7663     */
7664    audioBitrate?: number;
7665
7666    /**
7667     * Indicates the audio encoding format.
7668     * @type { ?CodecMimeType }
7669     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7670     * @since 12
7671     */
7672    audioCodec?: CodecMimeType;
7673
7674    /**
7675     * Indicates the output file format.
7676     * @type { ContainerFormatType }
7677     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7678     * @since 12
7679     */
7680    fileFormat: ContainerFormatType;
7681
7682    /**
7683     * Indicates the video bitrate.
7684     * @type { ?number }
7685     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7686     * @since 12
7687     */
7688    videoBitrate?: number;
7689
7690    /**
7691     * Indicates the video encoding foramt.
7692     * @type { ?CodecMimeType }
7693     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7694     * @since 12
7695     */
7696    videoCodec?: CodecMimeType;
7697
7698    /**
7699     * Indicates the video width.
7700     * @type { ?number }
7701     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7702     * @since 12
7703     */
7704    videoFrameWidth?: number;
7705
7706    /**
7707     * Indicates the video height.
7708     * @type { ?number }
7709     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7710     * @since 12
7711     */
7712    videoFrameHeight?: number;
7713  }
7714
7715  /**
7716   * Transcode a source video file to a destination video file.
7717   * Before calling an AVTranscoder method, you must use @createAVTranscoder
7718   * to create an AVTranscoder instance.
7719   *
7720   * @typedef AVTranscoder
7721   * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7722   * @since 12
7723   */
7724  interface AVTranscoder {
7725    /**
7726     * Source media file descriptor. Mainstream media formats are supported.
7727     * @type { AVFileDescriptor }
7728     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7729     * @since 12
7730     */
7731    fdSrc: AVFileDescriptor;
7732
7733    /**
7734     * Destination media file descriptor. Mainstream media formats are supported.
7735     * @type { number }
7736     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7737     * @since 12
7738     */
7739    fdDst: number;
7740
7741    /**
7742     * Prepares for transcoding.
7743     * @param { AVTranscoderConfig } config : Recording parameters.
7744     * @returns { Promise<void> } A promise instance used to return when prepare completes.
7745     * @throws { BusinessError } 401 - The parameter check failed. Return by promise.
7746     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7747     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7748     * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise.
7749     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7750     * @since 12
7751     */
7752    prepare(config: AVTranscoderConfig): Promise<void>;
7753
7754    /**
7755     * Start AVTranscoder.
7756     * @returns { Promise<void> } A promise instance used to return when start completes.
7757     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7758     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7759     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7760     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7761     * @since 12
7762     */
7763    start(): Promise<void>;
7764
7765    /**
7766     * Pause AVTranscoder.
7767     * @returns { Promise<void> } A promise instance used to return when pause completes.
7768     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7769     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7770     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7771     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7772     * @since 12
7773     */
7774    pause(): Promise<void>;
7775
7776    /**
7777     * Resume AVTranscoder.
7778     * @returns { Promise<void> } A promise instance used to return when resume completes.
7779     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7780     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7781     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7782     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7783     * @since 12
7784     */
7785    resume(): Promise<void>;
7786
7787    /**
7788     * Cancel AVTranscoder.
7789     * @returns { Promise<void> } A promise instance used to return when cancel completes.
7790     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7791     * @throws { BusinessError } 5400103 - IO error. Return by promise.
7792     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7793     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7794     * @since 12
7795     */
7796    cancel(): Promise<void>;
7797
7798    /**
7799     * Release resources used for AVTranscoder.
7800     * @returns { Promise<void> } A promise instance used to return when cancel completes.
7801     * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise.
7802     * @throws { BusinessError } 5400105 - Service died. Return by promise.
7803     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7804     * @since 12
7805     */
7806    release(): Promise<void>;
7807
7808    /**
7809     * Register listener for trancoding complete event.
7810     * @param { 'complete' } type - Type of the event to listen for.
7811     * @param { Callback<void> } callback - Callback used to listen for the complete event.
7812     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7813     * @since 12
7814     */
7815    on(type:'complete', callback: Callback<void>):void;
7816
7817    /**
7818     * Register listener for trancoding error event.
7819     * @param { 'error' } type - Type of the event to listen for.
7820     * @param { ErrorCallback } callback - Callback used to listen for the error event.
7821     * @throws { BusinessError } 401 - The parameter check failed.
7822     * @throws { BusinessError } 801 - Capability not supported.
7823     * @throws { BusinessError } 5400101 - No memory.
7824     * @throws { BusinessError } 5400102 - Operation not allowed.
7825     * @throws { BusinessError } 5400103 - I/O error.
7826     * @throws { BusinessError } 5400104 - Time out.
7827     * @throws { BusinessError } 5400105 - Service died.
7828     * @throws { BusinessError } 5400106 - Unsupported format.
7829     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7830     * @since 12
7831     */
7832    on(type:'error', callback: ErrorCallback):void;
7833
7834    /**
7835     * Register listener for trancoding progressUpdate event.
7836     * @param { 'progressUpdate' } type - Type of the event to listen for.
7837     * @param { Callback<number> } callback - Callback used to listen for the progressUpdate event.
7838     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7839     * @since 12
7840     */
7841    on(type:'progressUpdate', callback: Callback<number>):void;
7842
7843    /**
7844     * Unregister listener for trancoding complete event.
7845     * @param { 'complete' } type - Type of the event to listen for.
7846     * @param { Callback<void> } [callback] - Callback used to listen for the complete event.
7847     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7848     * @since 12
7849     */
7850    off(type:'complete', callback?: Callback<void>):void;
7851
7852    /**
7853     * Unregister listener for trancoding error event.
7854     * @param { 'error' } type - Type of the event to listen for.
7855     * @param { ErrorCallback } [callback] - Callback used to listen for the error event.
7856     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7857     * @since 12
7858     */
7859    off(type:'error', callback?: ErrorCallback):void;
7860
7861    /**
7862     * Unregister listener for trancoding progressUpdate event.
7863     * @param { 'progressUpdate' } type - Type of the event to listen for.
7864     * @param { Callback<number> } [callback] - Callback used to listen for the progressUpdate event.
7865     * @syscap SystemCapability.Multimedia.Media.AVTranscoder
7866     * @since 12
7867     */
7868    off(type:'progressUpdate', callback?: Callback<number>):void;
7869  }
7870}
7871export default media;
7872