From 01203f3bc2eca59fc7be1f644648ff2b1b3ee566 Mon Sep 17 00:00:00 2001 From: zuotao Date: Tue, 5 Aug 2025 20:49:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?media.d.ts=20sdk=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zuotao --- api/@ohos.multimedia.media.d.ts | 158 ++++++++++++++++++++++++++++++-- 1 file changed, 151 insertions(+), 7 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index f5ec05467e..8d79d37cf4 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -2096,7 +2096,17 @@ declare namespace media { * @since 12 */ play(callback: AsyncCallback): void; - + /** + * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. + * @param { AsyncCallback } callback used to return the result when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + overload{ playWithCallback, playReturnsPromise }; + playWithCallback(callback: AsyncCallback): void; /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @returns { Promise } A Promise instance used to return the operation result. @@ -2122,7 +2132,16 @@ declare namespace media { * @since 12 */ play(): Promise; - + /** + * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + playReturnsPromise(): Promise; /** * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. * @param { AsyncCallback } callback used to return the result when pause completed. @@ -2148,7 +2167,17 @@ declare namespace media { * @since 12 */ pause(callback: AsyncCallback): void; - + overload{ pauseCallback, pauseReturnsPromise }; + /** + * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. + * @param { AsyncCallback } callback used to return the result when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + pauseCallback(callback: AsyncCallback): void; /** * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. * @returns { Promise } A Promise instance used to return the operation result. @@ -2174,7 +2203,16 @@ declare namespace media { * @since 12 */ pause(): Promise; - + /** + * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + pauseReturnsPromise(): Promise; /** * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared, * playing, paused or completed state. @@ -5633,7 +5671,30 @@ declare namespace media { * }); */ pause(callback: AsyncCallback): void; - + /** + * Pauses recording. This API uses an asynchronous callback to return the result. + * + * This API can be called only after the start() API is called. You can call resume() to resume recording. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.pause((err: BusinessError) => { + * if (err) { + * console.error('Failed to pause AVRecorder and error is ' + err.message); + * } else { + * console.info('Succeeded in pausing'); + * } + * }); + */ + pauseWithCallback(callback: AsyncCallback): void; /** * Start AVRecorder, it will to paused state. * @returns { Promise } A Promise instance used to return when pause completed. @@ -5665,7 +5726,50 @@ declare namespace media { * }); */ pause(): Promise; - + /** + * Pauses recording. This API uses a promise to return the result. + * + * This API can be called only after the start()API is called. You can call resume() to resume recording. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.pause().then(() => { + * console.info('Succeeded in pausing'); + * }).catch((err: BusinessError) => { + * console.error('Failed to pause AVRecorder and catch error is ' + err.message); + * }); + */ + pauseReturnsPromise(): Promise; + /** + * Pauses recording. This API uses a promise to return the result. + * + * This API can be called only after the start()API is called. You can call resume() to resume recording. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.pause().then(() => { + * console.info('Succeeded in pausing'); + * }).catch((err: BusinessError) => { + * console.error('Failed to pause AVRecorder and catch error is ' + err.message); + * }); + */ + pauseReturnsPromise(): Promise; /** * Resume AVRecorder, it will to started state. * @param { AsyncCallback } callback - A callback instance used to return when resume completed. @@ -7285,6 +7389,15 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#play */ play(callback: AsyncCallback): void; + /** + * Starts video playback. + * @param { AsyncCallback } callback - A callback instance used to return when start completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + playWithCallback(callback: AsyncCallback): void; /** * Starts video playback. * @returns { Promise } A Promise instance used to return when start completed. @@ -7294,6 +7407,15 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#play */ play(): Promise; + /** + * Starts video playback. + * @returns { Promise } A Promise instance used to return when start completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + playReturnsPromise(): Promise; /** * Pauses video playback. * @param { AsyncCallback } callback - A callback instance used to return when pause completed. @@ -7303,6 +7425,15 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#pause */ pause(callback: AsyncCallback): void; + /** + * Pauses video playback. + * @param { AsyncCallback } callback - A callback instance used to return when pause completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pauseWithCallback(callback: AsyncCallback): void; /** * Pauses video playback. * @returns { Promise } A Promise instance used to return when pause completed. @@ -7312,6 +7443,7 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#pause */ pause(): Promise; + pauseReturnPromise(): Promise; /** * Stops video playback. * @param { AsyncCallback } callback - A callback instance used to return when stop completed. @@ -9863,7 +9995,19 @@ declare namespace media { * @since 12 */ pause(): Promise; - + /** + * Pauses transcoding. This API uses a promise to return the result. + * + * This API can be called only after the [start()]{@link AVTranscoder.start} API is called. + * You can call [resume()]{@link AVTranscoder.resume} to resume transcoding. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + pauseReturnsPromise(): Promise; /** * Resumes transcoding. This API uses a promise to return the result. * -- Gitee From 17aae9a4ce7b90e8d67bee6383324511c805e575 Mon Sep 17 00:00:00 2001 From: zuotao Date: Tue, 5 Aug 2025 20:52:22 +0800 Subject: [PATCH 2/3] =?UTF-8?q?media.d.ts=20sdk=E6=94=B9=E9=80=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zuotao --- api/@ohos.multimedia.media.d.ts | 557 ++++++++++++++++++++++++++++---- 1 file changed, 488 insertions(+), 69 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index 8d79d37cf4..c364c071e0 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -842,6 +842,28 @@ declare namespace media { * @since 12 */ release(): Promise; + + overload { releaseWithCallback,releaseReturnsPromise }; + /** + * Releases this **AVMetadataExtractor** instance. This API uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 12 + */ + releaseWithCallback(callback: AsyncCallback): void; + + /** + * Releases this **AVMetadataExtractor** instance. This API uses a promise to return the result. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVMetadataExtractor + * @crossplatform + * @since 12 + */ + releaseReturnsPromise(): Promise; } /** @@ -1324,6 +1346,25 @@ declare namespace media { * @since 12 */ release(): Promise; + overload { releaseWithCallback,releaseReturnsPromise }; + /** + * Releases this **AVImageGenerator** instance. This API uses an asynchronous callback to return the result. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by callback. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + releaseWithCallback(callback: AsyncCallback): void; + + /** + * Releases this **AVImageGenerator** instance. This API uses a promise to return the result. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operation not allowed. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVImageGenerator + * @since 12 + */ + releaseReturnsPromise(): Promise; } /** @@ -2070,32 +2111,58 @@ declare namespace media { * @since 12 */ prepare(): Promise; - + overload { prepareWithCallback,prepareReturnsPromise }; /** - * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. - * @param { AsyncCallback } callback used to return the result when play completed. + * Prepare audio/video playback, it will request resource for playing. This API can be called only + * when the AVPlayer is in the initialized state. + * + *

If your application frequently switches between short videos, you can create multiple AVPlayer + * objects to prepare the next video in advance, thereby improving the switching performance. + * For details, see [Smooth Switchover Between Online Short Videos]{@link + * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.

+ * + * @param { AsyncCallback } callback used to return the result when prepare completed. * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @since 9 + * @crossplatform + * @atomicservice + * @since 12 */ + prepareWithCallback(callback: AsyncCallback): void; + /** + * Prepare audio/video playback, it will request resource for playing. This API can be called + * only when the AVPlayer is in the initialized state. + * + *

If your application frequently switches between short videos, you can create multiple AVPlayer + * objects to prepare the next video in advance, thereby improving the switching performance. + * For details, see [Smooth Switchover Between Online Short Videos]{@link + * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.

+ * + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + prepareReturnsPromise(): Promise; /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @param { AsyncCallback } callback used to return the result when play completed. * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @atomicservice - * @since 11 + * @since 9 */ /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @param { AsyncCallback } callback used to return the result when play completed. * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform * @atomicservice - * @since 12 + * @since 11 */ - play(callback: AsyncCallback): void; /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @param { AsyncCallback } callback used to return the result when play completed. @@ -2105,8 +2172,7 @@ declare namespace media { * @atomicservice * @since 12 */ - overload{ playWithCallback, playReturnsPromise }; - playWithCallback(callback: AsyncCallback): void; + play(callback: AsyncCallback): void; /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @returns { Promise } A Promise instance used to return the operation result. @@ -2132,7 +2198,18 @@ declare namespace media { * @since 12 */ play(): Promise; - /** + overload { playWithCallback, playReturnsPromise}; + /** + * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. + * @param { AsyncCallback } callback used to return the result when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + playWithCallback(callback: AsyncCallback): void; + /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @returns { Promise } A Promise instance used to return the operation result. * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. @@ -2167,17 +2244,6 @@ declare namespace media { * @since 12 */ pause(callback: AsyncCallback): void; - overload{ pauseCallback, pauseReturnsPromise }; - /** - * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. - * @param { AsyncCallback } callback used to return the result when pause completed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - pauseCallback(callback: AsyncCallback): void; /** * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. * @returns { Promise } A Promise instance used to return the operation result. @@ -2203,6 +2269,18 @@ declare namespace media { * @since 12 */ pause(): Promise; + + overload { pauseWithCallback, pauseReturnsPromise } + /** + * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. + * @param { AsyncCallback } callback used to return the result when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + pauseWithCallback(callback: AsyncCallback): void; /** * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. * @returns { Promise } A Promise instance used to return the operation result. @@ -2380,7 +2458,29 @@ declare namespace media { * @since 12 */ release(): Promise; + + overload { releaseWithCallback, releaseReturnsPromise}; + /** + * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released. + * @param { AsyncCallback } callback used to return the result when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + releaseWithCallback(callback: AsyncCallback): void; + /** + * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released. + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + releaseReturnsPromise(): Promise; /** * Jumps to the specified playback position. This API can be called only when the AVPlayer is in the prepared, * playing, paused, or completed state. @@ -5338,6 +5438,115 @@ declare namespace media { */ prepare(config: AVRecorderConfig): Promise; + overload { prepareWithConfigCallback,prepareWithConfigReturnsPromise }; + /** + * Sets audio and video recording parameters. This API uses an asynchronous callback to return the result. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Audio and video recording parameters to set. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 201 - Permission denied. Return by callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * // Configure the parameters based on those supported by the hardware device. + * let avRecorderProfile: media.AVRecorderProfile = { + * audioBitrate : 48000, + * audioChannels : 2, + * audioCodec : media.CodecMimeType.AUDIO_AAC, + * audioSampleRate : 48000, + * fileFormat : media.ContainerFormatType.CFT_MPEG_4, + * videoBitrate : 2000000, + * videoCodec : media.CodecMimeType.VIDEO_AVC, + * videoFrameWidth : 640, + * videoFrameHeight : 480, + * videoFrameRate : 30 + * } + * let avRecorderConfig: media.AVRecorderConfig = { + * audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + * videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + * profile : avRecorderProfile, + * url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45. + * rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. + * location : { latitude : 30, longitude : 130 } + * } + * + * avRecorder.prepare(avRecorderConfig, (err: BusinessError) => { + * if (err) { + * console.error('Failed to prepare and error is ' + err.message); + * } else { + * console.info('Succeeded in preparing'); + * } + * }) + */ + prepareWithConfigCallback(config: AVRecorderConfig, callback: AsyncCallback): void; + + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - The parameter check failed. Return by promise. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Sets audio and video recording parameters. This API uses a promise to return the result. + * This permission is required only if audio recording is involved. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * // Configure the parameters based on those supported by the hardware device. + * let avRecorderProfile: media.AVRecorderProfile = { + * audioBitrate : 48000, + * audioChannels : 2, + * audioCodec : media.CodecMimeType.AUDIO_AAC, + * audioSampleRate : 48000, + * fileFormat : media.ContainerFormatType.CFT_MPEG_4, + * videoBitrate : 2000000, + * videoCodec : media.CodecMimeType.VIDEO_AVC, + * videoFrameWidth : 640, + * videoFrameHeight : 480, + * videoFrameRate : 30 + * } + * let avRecorderConfig: media.AVRecorderConfig = { + * audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + * videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + * profile : avRecorderProfile, + * url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45. + * rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. + * location : { latitude : 30, longitude : 130 } + * } + * + * avRecorder.prepare(avRecorderConfig).then(() => { + * console.info('Succeeded in preparing'); + * }).catch((err: BusinessError) => { + * console.error('Failed to prepare and catch error is ' + err.message); + * }); + */ + prepareWithConfigReturnsPromise(config: AVRecorderConfig): Promise; /** * Obtains the real-time configuration of this AVRecorder. * This API uses an asynchronous callback to return the result. @@ -5671,30 +5880,6 @@ declare namespace media { * }); */ pause(callback: AsyncCallback): void; - /** - * Pauses recording. This API uses an asynchronous callback to return the result. - * - * This API can be called only after the start() API is called. You can call resume() to resume recording. - * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, - * **err** is **undefined**; otherwise, **err** is an error object. - * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. - * @throws { BusinessError } 5400103 - IO error. Return by callback. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @since 12 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * avRecorder.pause((err: BusinessError) => { - * if (err) { - * console.error('Failed to pause AVRecorder and error is ' + err.message); - * } else { - * console.info('Succeeded in pausing'); - * } - * }); - */ - pauseWithCallback(callback: AsyncCallback): void; /** * Start AVRecorder, it will to paused state. * @returns { Promise } A Promise instance used to return when pause completed. @@ -5726,28 +5911,40 @@ declare namespace media { * }); */ pause(): Promise; + overload { pauseWithCallback,pauseReturnsPromise }; /** - * Pauses recording. This API uses a promise to return the result. + * Pauses recording. This API uses an asynchronous callback to return the result. * - * This API can be called only after the start()API is called. You can call resume() to resume recording. - * @returns { Promise } Promise that returns no value. - * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. - * @throws { BusinessError } 5400103 - IO error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. + * This API can be called only after the start() API is called. You can call resume() to resume recording. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder * @crossplatform - * @atomicservice * @since 12 * @example * import { BusinessError } from '@kit.BasicServicesKit'; * - * avRecorder.pause().then(() => { - * console.info('Succeeded in pausing'); - * }).catch((err: BusinessError) => { - * console.error('Failed to pause AVRecorder and catch error is ' + err.message); + * avRecorder.pause((err: BusinessError) => { + * if (err) { + * console.error('Failed to pause AVRecorder and error is ' + err.message); + * } else { + * console.info('Succeeded in pausing'); + * } * }); */ - pauseReturnsPromise(): Promise; + pauseWithCallback(callback: AsyncCallback): void; + /** + * Start AVRecorder, it will to paused state. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ /** * Pauses recording. This API uses a promise to return the result. * @@ -6031,7 +6228,50 @@ declare namespace media { * }); */ release(): Promise; + overload { releaseWithCallback,releaseReturnsPromise }; + /** + * Releases the audio and video recording resources. This API uses an asynchronous callback to return the result. + * + * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.release((err: BusinessError) => { + * if (err) { + * console.error('Failed to release AVRecorder and error is ' + err.message); + * } else { + * console.info('Succeeded in releasing AVRecorder'); + * } + * }); + */ + releaseWithCallback(callback: AsyncCallback): void; + /** + * Releases the audio and video recording resources. This API uses a promise to return the result. + * + * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.release().then(() => { + * console.info('Succeeded in releasing AVRecorder'); + * }).catch((err: BusinessError) => { + * console.error('Failed to release AVRecorder and catch error is ' + err.message); + * }); + */ + releaseReturnsPromise(): Promise; /** * Obtains the information about the current audio capturer. * This API uses an asynchronous callback to return the result. @@ -6701,7 +6941,27 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVRecorder#prepare */ prepare(config: AudioRecorderConfig): void; - + overload { prepareWithConfig }; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AudioRecorderConfig } config - Recording parameters. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#prepare + */ + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AudioRecorderConfig } config - Recording parameters. + * @throws { BusinessError } 201 - permission denied. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 12 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#prepare + */ + prepareWithConfig(config: AudioRecorderConfig): void; /** * Starts audio recording. * @syscap SystemCapability.Multimedia.Media.AudioRecorder @@ -6863,6 +7123,39 @@ declare namespace media { * @since 12 */ prepare(config: VideoRecorderConfig): Promise; + overload { prepareWithConfigCallback, prepareWithConfigReturnsPromise}; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { VideoRecorderConfig } config - Recording parameters. + * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by callback. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + prepareWithConfigCallback(config: VideoRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { VideoRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + prepareWithConfigReturnsPromise(config: VideoRecorderConfig): Promise; /** * get input surface.it must be called between prepare completed and start. * @param { AsyncCallback } callback - Callback used to return the input surface id in string. @@ -6995,6 +7288,41 @@ declare namespace media { * @since 12 */ pause(): Promise; + overload { pauseWithCallback,pauseReturnsPromise }; + /** + * Pauses video recording. + * @param { AsyncCallback } callback - A callback instance used to return when pause completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400103 - I/O error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + pauseWithCallback(callback: AsyncCallback): void; + /** + * Pauses video recording. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - I/O error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 9 + */ + /** + * Pauses video recording. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - I/O error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + pauseReturnsPromise(): Promise; /** * Resumes video recording. * @param { AsyncCallback } callback - A callback instance used to return when resume completed. @@ -7119,6 +7447,28 @@ declare namespace media { * @since 12 */ release(): Promise; + + overload { releaseWithCallback, releaseReturnsPromise}; + /** + * Releases resources used for video recording. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + releaseWithCallback(callback: AsyncCallback): void; + /** + * Releases resources used for video recording. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + releaseReturnsPromise(): Promise; /** * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, @@ -7380,6 +7730,26 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#prepare */ prepare(): Promise; + + overload { prepareWithCallback, prepareReturnsPromise}; + /** + * Prepare video playback, it will request resource for playing. + * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#prepare + */ + prepareWithCallback(callback: AsyncCallback): void; + /** + * Prepare video playback, it will request resource for playing. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#prepare + */ + prepareReturnsPromise(): Promise; /** * Starts video playback. * @param { AsyncCallback } callback - A callback instance used to return when start completed. @@ -7391,23 +7761,24 @@ declare namespace media { play(callback: AsyncCallback): void; /** * Starts video playback. - * @param { AsyncCallback } callback - A callback instance used to return when start completed. + * @returns { Promise } A Promise instance used to return when start completed. * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @since 8 * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVPlayer#play */ - playWithCallback(callback: AsyncCallback): void; + play(): Promise; + overload { playWithCallback,playReturnsPromise} /** * Starts video playback. - * @returns { Promise } A Promise instance used to return when start completed. + * @param { AsyncCallback } callback - A callback instance used to return when start completed. * @syscap SystemCapability.Multimedia.Media.VideoPlayer * @since 8 * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVPlayer#play */ - play(): Promise; - /** + playWithCallback(callback: AsyncCallback): void; + /** * Starts video playback. * @returns { Promise } A Promise instance used to return when start completed. * @syscap SystemCapability.Multimedia.Media.VideoPlayer @@ -7425,6 +7796,17 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#pause */ pause(callback: AsyncCallback): void; + /** + * Pauses video playback. + * @returns { Promise } A Promise instance used to return when pause completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pause(): Promise; + + overload { pauseWithCallback,pauseReturnsPromise }; /** * Pauses video playback. * @param { AsyncCallback } callback - A callback instance used to return when pause completed. @@ -7433,7 +7815,7 @@ declare namespace media { * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVPlayer#pause */ - pauseWithCallback(callback: AsyncCallback): void; + pauseWithCallback(callback: AsyncCallback): void; /** * Pauses video playback. * @returns { Promise } A Promise instance used to return when pause completed. @@ -7442,8 +7824,7 @@ declare namespace media { * @deprecated since 9 * @useinstead ohos.multimedia.media/media.AVPlayer#pause */ - pause(): Promise; - pauseReturnPromise(): Promise; + pauseReturnsPromise(): Promise; /** * Stops video playback. * @param { AsyncCallback } callback - A callback instance used to return when stop completed. @@ -7554,6 +7935,17 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#release */ release(): Promise; + + overload { releaseWithCallback }; + /** + * Releases resources used for video playback. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#release + */ + releaseWithCallback(callback: AsyncCallback): void; /** * Get all track infos in MediaDescription, should be called after data loaded callback. * @param { AsyncCallback> } callback - async callback return track info in MediaDescription. @@ -9770,7 +10162,18 @@ declare namespace media { * }) */ release(): Promise; - + overload { releaseReturnsPromise }; + /** + * Releases the video transcoding resources. This API uses a promise to return the result. + * + * After the resources are released, you can no longer perform any operation on the **AVTranscoder** instance. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + releaseReturnsPromise(): Promise; /** * Subscribes to screen capture state changes. An application can subscribe to only one screen capture * state change event. When the application initiates multiple subscriptions to this event, @@ -9969,6 +10372,20 @@ declare namespace media { */ prepare(config: AVTranscoderConfig): Promise; + overload { prepareWithConfigReturnsPromise }; + /** + * Sets video transcoding parameters. This API uses a promise to return the result. + * @param { AVTranscoderConfig } config - Video transcoding parameters to set. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - The parameter check failed. Return by promise. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + prepareWithConfigReturnsPromise(config: AVTranscoderConfig): Promise; /** * Starts transcoding. This API uses a promise to return the result. * @@ -9995,6 +10412,8 @@ declare namespace media { * @since 12 */ pause(): Promise; + + overload{ pauseReturnsPromise }; /** * Pauses transcoding. This API uses a promise to return the result. * -- Gitee From 884f6c9472850d8be5088bc9a28f1206a0adc303 Mon Sep 17 00:00:00 2001 From: zuotao Date: Wed, 6 Aug 2025 17:28:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix=20fuzz=E7=94=A8=E4=BE=8B=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zuotao --- api/@ohos.multimedia.media.d.ts | 1190 ++++++++++++++++--------------- 1 file changed, 604 insertions(+), 586 deletions(-) diff --git a/api/@ohos.multimedia.media.d.ts b/api/@ohos.multimedia.media.d.ts index c364c071e0..d7a15026af 100755 --- a/api/@ohos.multimedia.media.d.ts +++ b/api/@ohos.multimedia.media.d.ts @@ -843,7 +843,7 @@ declare namespace media { */ release(): Promise; - overload { releaseWithCallback,releaseReturnsPromise }; + overload release { releaseWithCallback,releaseReturnsPromise }; /** * Releases this **AVMetadataExtractor** instance. This API uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, @@ -1346,7 +1346,8 @@ declare namespace media { * @since 12 */ release(): Promise; - overload { releaseWithCallback,releaseReturnsPromise }; + + overload release { releaseWithCallback,releaseReturnsPromise }; /** * Releases this **AVImageGenerator** instance. This API uses an asynchronous callback to return the result. * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, @@ -2111,43 +2112,6 @@ declare namespace media { * @since 12 */ prepare(): Promise; - overload { prepareWithCallback,prepareReturnsPromise }; - /** - * Prepare audio/video playback, it will request resource for playing. This API can be called only - * when the AVPlayer is in the initialized state. - * - *

If your application frequently switches between short videos, you can create multiple AVPlayer - * objects to prepare the next video in advance, thereby improving the switching performance. - * For details, see [Smooth Switchover Between Online Short Videos]{@link - * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.

- * - * @param { AsyncCallback } callback used to return the result when prepare completed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @throws { BusinessError } 5400106 - Unsupported format. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - prepareWithCallback(callback: AsyncCallback): void; - /** - * Prepare audio/video playback, it will request resource for playing. This API can be called - * only when the AVPlayer is in the initialized state. - * - *

If your application frequently switches between short videos, you can create multiple AVPlayer - * objects to prepare the next video in advance, thereby improving the switching performance. - * For details, see [Smooth Switchover Between Online Short Videos]{@link - * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.

- * - * @returns { Promise } A Promise instance used to return the operation result. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400106 - Unsupported format. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - prepareReturnsPromise(): Promise; /** * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. * @param { AsyncCallback } callback used to return the result when play completed. @@ -2198,27 +2162,6 @@ declare namespace media { * @since 12 */ play(): Promise; - overload { playWithCallback, playReturnsPromise}; - /** - * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. - * @param { AsyncCallback } callback used to return the result when play completed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - playWithCallback(callback: AsyncCallback): void; - /** - * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. - * @returns { Promise } A Promise instance used to return the operation result. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - playReturnsPromise(): Promise; /** * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. * @param { AsyncCallback } callback used to return the result when pause completed. @@ -2270,27 +2213,6 @@ declare namespace media { */ pause(): Promise; - overload { pauseWithCallback, pauseReturnsPromise } - /** - * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. - * @param { AsyncCallback } callback used to return the result when pause completed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - pauseWithCallback(callback: AsyncCallback): void; - /** - * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. - * @returns { Promise } A Promise instance used to return the operation result. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - pauseReturnsPromise(): Promise; /** * Stop audio/video playback. This API can be called only when the AVPlayer is in the prepared, * playing, paused or completed state. @@ -2459,28 +2381,6 @@ declare namespace media { */ release(): Promise; - overload { releaseWithCallback, releaseReturnsPromise}; - /** - * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released. - * @param { AsyncCallback } callback used to return the result when release completed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - releaseWithCallback(callback: AsyncCallback): void; - - /** - * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released. - * @returns { Promise } A Promise instance used to return the operation result. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVPlayer - * @crossplatform - * @atomicservice - * @since 12 - */ - releaseReturnsPromise(): Promise; /** * Jumps to the specified playback position. This API can be called only when the AVPlayer is in the prepared, * playing, paused, or completed state. @@ -4119,7 +4019,111 @@ declare namespace media { * @atomicservice * @since 18 */ - off(type:'superResolutionChanged', callback?: OnSuperResolutionChanged): void; + off(type:'superResolutionChanged', callback?: OnSuperResolutionChanged): void; + overload prepare { prepareWithCallback,prepareReturnsPromise }; + /** + * Prepare audio/video playback, it will request resource for playing. This API can be called only + * when the AVPlayer is in the initialized state. + * + *

If your application frequently switches between short videos, you can create multiple AVPlayer + * objects to prepare the next video in advance, thereby improving the switching performance. + * For details, see [Smooth Switchover Between Online Short Videos]{@link + * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.

+ * + * @param { AsyncCallback } callback used to return the result when prepare completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400106 - Unsupported format. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + prepareWithCallback(callback: AsyncCallback): void; + /** + * Prepare audio/video playback, it will request resource for playing. This API can be called + * only when the AVPlayer is in the initialized state. + * + *

If your application frequently switches between short videos, you can create multiple AVPlayer + * objects to prepare the next video in advance, thereby improving the switching performance. + * For details, see [Smooth Switchover Between Online Short Videos]{@link + * https://developer.huawei.com/consumer/en/doc/best-practices/bpta-smooth-switching}.

+ * + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + prepareReturnsPromise(): Promise; + + overload play { playWithCallback, playReturnsPromise}; + /** + * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. + * @param { AsyncCallback } callback used to return the result when play completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + playWithCallback(callback: AsyncCallback): void; + /** + * Play audio/video playback. This API can be called only when the AVPlayer is in the prepared, paused or completed state. + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + playReturnsPromise(): Promise; + + overload pause { pauseWithCallback, pauseReturnsPromise } + /** + * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. + * @param { AsyncCallback } callback used to return the result when pause completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + pauseWithCallback(callback: AsyncCallback): void; + /** + * Pause audio/video playback. This API can be called only when the AVPlayer is in the playing state. + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + pauseReturnsPromise(): Promise; + + overload release { releaseWithCallback, releaseReturnsPromise}; + /** + * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released. + * @param { AsyncCallback } callback used to return the result when release completed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + releaseWithCallback(callback: AsyncCallback): void; + + /** + * Releases resources used for AVPlayer. This API can be called when the AVPlayer is in any state except released. + * @returns { Promise } A Promise instance used to return the operation result. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVPlayer + * @crossplatform + * @atomicservice + * @since 12 + */ + releaseReturnsPromise(): Promise; } /** @@ -5438,142 +5442,33 @@ declare namespace media { */ prepare(config: AVRecorderConfig): Promise; - overload { prepareWithConfigCallback,prepareWithConfigReturnsPromise }; /** - * Sets audio and video recording parameters. This API uses an asynchronous callback to return the result. - * @permission ohos.permission.MICROPHONE - * @param { AVRecorderConfig } config - Audio and video recording parameters to set. - * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, - * **err** is **undefined**; otherwise, **err** is an error object. - * @throws { BusinessError } 201 - Permission denied. Return by callback. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3.Parameter verification failed. + * Obtains the real-time configuration of this AVRecorder. + * This API uses an asynchronous callback to return the result. + * This API can be called only after prepare() is called. + * @param { AsyncCallback } callback - Callback used to return the result. + * If the operation is successful, **err** is **undefined** and **data** is the real-time configuration obtained; + * otherwise, **err** is an error object. * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @since 12 + * @since 11 * @example * import { BusinessError } from '@kit.BasicServicesKit'; * - * // Configure the parameters based on those supported by the hardware device. - * let avRecorderProfile: media.AVRecorderProfile = { - * audioBitrate : 48000, - * audioChannels : 2, - * audioCodec : media.CodecMimeType.AUDIO_AAC, - * audioSampleRate : 48000, - * fileFormat : media.ContainerFormatType.CFT_MPEG_4, - * videoBitrate : 2000000, - * videoCodec : media.CodecMimeType.VIDEO_AVC, - * videoFrameWidth : 640, - * videoFrameHeight : 480, - * videoFrameRate : 30 - * } - * let avRecorderConfig: media.AVRecorderConfig = { - * audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, - * videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, - * profile : avRecorderProfile, - * url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45. - * rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. - * location : { latitude : 30, longitude : 130 } - * } + * let avConfig: media.AVRecorderConfig; * - * avRecorder.prepare(avRecorderConfig, (err: BusinessError) => { + * avRecorder.getAVRecorderConfig((err: BusinessError, config: media.AVRecorderConfig) => { * if (err) { - * console.error('Failed to prepare and error is ' + err.message); + * console.error('Failed to get avConfig and error is ' + err.message); * } else { - * console.info('Succeeded in preparing'); + * console.info('Succeeded in getting AVRecorderConfig'); + * avConfig = config; * } - * }) + * }); */ - prepareWithConfigCallback(config: AVRecorderConfig, callback: AsyncCallback): void; - - /** - * Prepares for recording. - * @permission ohos.permission.MICROPHONE - * @param { AVRecorderConfig } config - Recording parameters. - * @returns { Promise } A Promise instance used to return when prepare completed. - * @throws { BusinessError } 201 - Permission denied. Return by promise. - * @throws { BusinessError } 401 - The parameter check failed. Return by promise. - * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 9 - */ - /** - * Sets audio and video recording parameters. This API uses a promise to return the result. - * This permission is required only if audio recording is involved. - * @permission ohos.permission.MICROPHONE - * @param { AVRecorderConfig } config - Recording parameters. - * @returns { Promise } A Promise instance used to return when prepare completed. - * @throws { BusinessError } 201 - Permission denied. Return by promise. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3.Parameter verification failed. - * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @atomicservice - * @since 12 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * // Configure the parameters based on those supported by the hardware device. - * let avRecorderProfile: media.AVRecorderProfile = { - * audioBitrate : 48000, - * audioChannels : 2, - * audioCodec : media.CodecMimeType.AUDIO_AAC, - * audioSampleRate : 48000, - * fileFormat : media.ContainerFormatType.CFT_MPEG_4, - * videoBitrate : 2000000, - * videoCodec : media.CodecMimeType.VIDEO_AVC, - * videoFrameWidth : 640, - * videoFrameHeight : 480, - * videoFrameRate : 30 - * } - * let avRecorderConfig: media.AVRecorderConfig = { - * audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, - * videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, - * profile : avRecorderProfile, - * url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45. - * rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. - * location : { latitude : 30, longitude : 130 } - * } - * - * avRecorder.prepare(avRecorderConfig).then(() => { - * console.info('Succeeded in preparing'); - * }).catch((err: BusinessError) => { - * console.error('Failed to prepare and catch error is ' + err.message); - * }); - */ - prepareWithConfigReturnsPromise(config: AVRecorderConfig): Promise; - /** - * Obtains the real-time configuration of this AVRecorder. - * This API uses an asynchronous callback to return the result. - * This API can be called only after prepare() is called. - * @param { AsyncCallback } callback - Callback used to return the result. - * If the operation is successful, **err** is **undefined** and **data** is the real-time configuration obtained; - * otherwise, **err** is an error object. - * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. - * @throws { BusinessError } 5400103 - IO error. Return by callback. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 11 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * let avConfig: media.AVRecorderConfig; - * - * avRecorder.getAVRecorderConfig((err: BusinessError, config: media.AVRecorderConfig) => { - * if (err) { - * console.error('Failed to get avConfig and error is ' + err.message); - * } else { - * console.info('Succeeded in getting AVRecorderConfig'); - * avConfig = config; - * } - * }); - */ - getAVRecorderConfig(callback: AsyncCallback): void; + getAVRecorderConfig(callback: AsyncCallback): void; /** * Obtains the real-time configuration of this AVRecorder. This API uses a promise to return the result. @@ -5911,62 +5806,7 @@ declare namespace media { * }); */ pause(): Promise; - overload { pauseWithCallback,pauseReturnsPromise }; - /** - * Pauses recording. This API uses an asynchronous callback to return the result. - * - * This API can be called only after the start() API is called. You can call resume() to resume recording. - * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, - * **err** is **undefined**; otherwise, **err** is an error object. - * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. - * @throws { BusinessError } 5400103 - IO error. Return by callback. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @since 12 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * avRecorder.pause((err: BusinessError) => { - * if (err) { - * console.error('Failed to pause AVRecorder and error is ' + err.message); - * } else { - * console.info('Succeeded in pausing'); - * } - * }); - */ - pauseWithCallback(callback: AsyncCallback): void; - /** - * Start AVRecorder, it will to paused state. - * @returns { Promise } A Promise instance used to return when pause completed. - * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. - * @throws { BusinessError } 5400103 - IO error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @since 9 - */ - /** - * Pauses recording. This API uses a promise to return the result. - * - * This API can be called only after the start()API is called. You can call resume() to resume recording. - * @returns { Promise } Promise that returns no value. - * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. - * @throws { BusinessError } 5400103 - IO error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @atomicservice - * @since 12 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * avRecorder.pause().then(() => { - * console.info('Succeeded in pausing'); - * }).catch((err: BusinessError) => { - * console.error('Failed to pause AVRecorder and catch error is ' + err.message); - * }); - */ - pauseReturnsPromise(): Promise; + /** * Resume AVRecorder, it will to started state. * @param { AsyncCallback } callback - A callback instance used to return when resume completed. @@ -6228,50 +6068,6 @@ declare namespace media { * }); */ release(): Promise; - overload { releaseWithCallback,releaseReturnsPromise }; - /** - * Releases the audio and video recording resources. This API uses an asynchronous callback to return the result. - * - * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance. - * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, - * **err** is **undefined**; otherwise, **err** is an error object. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @since 12 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * avRecorder.release((err: BusinessError) => { - * if (err) { - * console.error('Failed to release AVRecorder and error is ' + err.message); - * } else { - * console.info('Succeeded in releasing AVRecorder'); - * } - * }); - */ - releaseWithCallback(callback: AsyncCallback): void; - - /** - * Releases the audio and video recording resources. This API uses a promise to return the result. - * - * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance. - * @returns { Promise } Promise that returns no value. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.AVRecorder - * @crossplatform - * @atomicservice - * @since 12 - * @example - * import { BusinessError } from '@kit.BasicServicesKit'; - * - * avRecorder.release().then(() => { - * console.info('Succeeded in releasing AVRecorder'); - * }).catch((err: BusinessError) => { - * console.error('Failed to release AVRecorder and catch error is ' + err.message); - * }); - */ - releaseReturnsPromise(): Promise; /** * Obtains the information about the current audio capturer. * This API uses an asynchronous callback to return the result. @@ -6622,34 +6418,246 @@ declare namespace media { * @since 12 */ off(type: 'photoAssetAvailable', callback?: Callback): void; - } - /** - * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace. - * - * @enum { number } - * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @since 6 - * @deprecated since 8 - * @useinstead ohos.multimedia.media/media.CodecMimeType - */ - enum AudioEncoder { + overload prepare { prepareWithConfigCallback,prepareWithConfigReturnsPromise }; /** - * Default audio encoding format, which is AMR-NB. - * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @since 6 - * @deprecated since 8 + * Sets audio and video recording parameters. This API uses an asynchronous callback to return the result. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Audio and video recording parameters to set. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 201 - Permission denied. Return by callback. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * // Configure the parameters based on those supported by the hardware device. + * let avRecorderProfile: media.AVRecorderProfile = { + * audioBitrate : 48000, + * audioChannels : 2, + * audioCodec : media.CodecMimeType.AUDIO_AAC, + * audioSampleRate : 48000, + * fileFormat : media.ContainerFormatType.CFT_MPEG_4, + * videoBitrate : 2000000, + * videoCodec : media.CodecMimeType.VIDEO_AVC, + * videoFrameWidth : 640, + * videoFrameHeight : 480, + * videoFrameRate : 30 + * } + * let avRecorderConfig: media.AVRecorderConfig = { + * audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + * videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + * profile : avRecorderProfile, + * url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45. + * rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. + * location : { latitude : 30, longitude : 130 } + * } + * + * avRecorder.prepare(avRecorderConfig, (err: BusinessError) => { + * if (err) { + * console.error('Failed to prepare and error is ' + err.message); + * } else { + * console.info('Succeeded in preparing'); + * } + * }) */ - DEFAULT = 0, + prepareWithConfigCallback(config: AVRecorderConfig, callback: AsyncCallback): void; /** - * Indicates the AMR-NB audio encoding format. - * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @since 6 - * @deprecated since 8 - * @useinstead ohos.multimedia.media/media.CodecMimeType#AUDIO_AMR_NB + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - The parameter check failed. Return by promise. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 */ - AMR_NB = 1, + /** + * Sets audio and video recording parameters. This API uses a promise to return the result. + * This permission is required only if audio recording is involved. + * @permission ohos.permission.MICROPHONE + * @param { AVRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * // Configure the parameters based on those supported by the hardware device. + * let avRecorderProfile: media.AVRecorderProfile = { + * audioBitrate : 48000, + * audioChannels : 2, + * audioCodec : media.CodecMimeType.AUDIO_AAC, + * audioSampleRate : 48000, + * fileFormat : media.ContainerFormatType.CFT_MPEG_4, + * videoBitrate : 2000000, + * videoCodec : media.CodecMimeType.VIDEO_AVC, + * videoFrameWidth : 640, + * videoFrameHeight : 480, + * videoFrameRate : 30 + * } + * let avRecorderConfig: media.AVRecorderConfig = { + * audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + * videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + * profile : avRecorderProfile, + * url : 'fd://', // Before passing in an FD to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: fd://45. + * rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. + * location : { latitude : 30, longitude : 130 } + * } + * + * avRecorder.prepare(avRecorderConfig).then(() => { + * console.info('Succeeded in preparing'); + * }).catch((err: BusinessError) => { + * console.error('Failed to prepare and catch error is ' + err.message); + * }); + */ + prepareWithConfigReturnsPromise(config: AVRecorderConfig): Promise; + + overload pause { pauseWithCallback,pauseReturnsPromise }; + /** + * Pauses recording. This API uses an asynchronous callback to return the result. + * + * This API can be called only after the start() API is called. You can call resume() to resume recording. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400102 - Operate not permit. Return by callback. + * @throws { BusinessError } 5400103 - IO error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.pause((err: BusinessError) => { + * if (err) { + * console.error('Failed to pause AVRecorder and error is ' + err.message); + * } else { + * console.info('Succeeded in pausing'); + * } + * }); + */ + pauseWithCallback(callback: AsyncCallback): void; + /** + * Start AVRecorder, it will to paused state. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @since 9 + */ + /** + * Pauses recording. This API uses a promise to return the result. + * + * This API can be called only after the start()API is called. You can call resume() to resume recording. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operate not permit. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.pause().then(() => { + * console.info('Succeeded in pausing'); + * }).catch((err: BusinessError) => { + * console.error('Failed to pause AVRecorder and catch error is ' + err.message); + * }); + */ + pauseReturnsPromise(): Promise; + + overload release { releaseWithCallback,releaseReturnsPromise }; + /** + * Releases the audio and video recording resources. This API uses an asynchronous callback to return the result. + * + * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance. + * @param { AsyncCallback } callback - Callback used to return the result. If the operation is successful, + * **err** is **undefined**; otherwise, **err** is an error object. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.release((err: BusinessError) => { + * if (err) { + * console.error('Failed to release AVRecorder and error is ' + err.message); + * } else { + * console.info('Succeeded in releasing AVRecorder'); + * } + * }); + */ + releaseWithCallback(callback: AsyncCallback): void; + + /** + * Releases the audio and video recording resources. This API uses a promise to return the result. + * + * After the resources are released, you can no longer perform any operation on the **AVRecorder** instance. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.AVRecorder + * @crossplatform + * @atomicservice + * @since 12 + * @example + * import { BusinessError } from '@kit.BasicServicesKit'; + * + * avRecorder.release().then(() => { + * console.info('Succeeded in releasing AVRecorder'); + * }).catch((err: BusinessError) => { + * console.error('Failed to release AVRecorder and catch error is ' + err.message); + * }); + */ + releaseReturnsPromise(): Promise; + } + + /** + * Enumerates audio encoding formats, it will be deprecated after API8, use @CodecMimeType to replace. + * + * @enum { number } + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.CodecMimeType + */ + enum AudioEncoder { + /** + * Default audio encoding format, which is AMR-NB. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + */ + DEFAULT = 0, + + /** + * Indicates the AMR-NB audio encoding format. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 8 + * @useinstead ohos.multimedia.media/media.CodecMimeType#AUDIO_AMR_NB + */ + AMR_NB = 1, /** * Indicates the AMR-WB audio encoding format. @@ -6941,27 +6949,6 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVRecorder#prepare */ prepare(config: AudioRecorderConfig): void; - overload { prepareWithConfig }; - /** - * Prepares for recording. - * @permission ohos.permission.MICROPHONE - * @param { AudioRecorderConfig } config - Recording parameters. - * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @since 6 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVRecorder#prepare - */ - /** - * Prepares for recording. - * @permission ohos.permission.MICROPHONE - * @param { AudioRecorderConfig } config - Recording parameters. - * @throws { BusinessError } 201 - permission denied. - * @syscap SystemCapability.Multimedia.Media.AudioRecorder - * @since 12 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVRecorder#prepare - */ - prepareWithConfig(config: AudioRecorderConfig): void; /** * Starts audio recording. * @syscap SystemCapability.Multimedia.Media.AudioRecorder @@ -7039,6 +7026,27 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVRecorder#on */ on(type: 'error', callback: ErrorCallback): void; + overload prepare { prepareWithConfig }; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AudioRecorderConfig } config - Recording parameters. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 6 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#prepare + */ + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { AudioRecorderConfig } config - Recording parameters. + * @throws { BusinessError } 201 - permission denied. + * @syscap SystemCapability.Multimedia.Media.AudioRecorder + * @since 12 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVRecorder#prepare + */ + prepareWithConfig(config: AudioRecorderConfig): void; } /** @@ -7123,39 +7131,6 @@ declare namespace media { * @since 12 */ prepare(config: VideoRecorderConfig): Promise; - overload { prepareWithConfigCallback, prepareWithConfigReturnsPromise}; - /** - * Prepares for recording. - * @permission ohos.permission.MICROPHONE - * @param { VideoRecorderConfig } config - Recording parameters. - * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. - * @throws { BusinessError } 201 - Permission denied. Return by callback. - * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3.Parameter verification failed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 12 - */ - prepareWithConfigCallback(config: VideoRecorderConfig, callback: AsyncCallback): void; - /** - * Prepares for recording. - * @permission ohos.permission.MICROPHONE - * @param { VideoRecorderConfig } config - Recording parameters. - * @returns { Promise } A Promise instance used to return when prepare completed. - * @throws { BusinessError } 201 - Permission denied. Return by promise. - * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. - *
2. Incorrect parameter types. 3.Parameter verification failed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 12 - */ - prepareWithConfigReturnsPromise(config: VideoRecorderConfig): Promise; /** * get input surface.it must be called between prepare completed and start. * @param { AsyncCallback } callback - Callback used to return the input surface id in string. @@ -7288,41 +7263,6 @@ declare namespace media { * @since 12 */ pause(): Promise; - overload { pauseWithCallback,pauseReturnsPromise }; - /** - * Pauses video recording. - * @param { AsyncCallback } callback - A callback instance used to return when pause completed. - * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. - * @throws { BusinessError } 5400103 - I/O error. Return by callback. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 12 - */ - pauseWithCallback(callback: AsyncCallback): void; - /** - * Pauses video recording. - * @returns { Promise } A Promise instance used to return when pause completed. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400103 - I/O error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 9 - */ - /** - * Pauses video recording. - * @returns { Promise } A Promise instance used to return when pause completed. - * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400103 - I/O error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 12 - */ - pauseReturnsPromise(): Promise; /** * Resumes video recording. * @param { AsyncCallback } callback - A callback instance used to return when resume completed. @@ -7448,27 +7388,6 @@ declare namespace media { */ release(): Promise; - overload { releaseWithCallback, releaseReturnsPromise}; - /** - * Releases resources used for video recording. - * @param { AsyncCallback } callback - A callback instance used to return when release completed. - * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 12 - */ - releaseWithCallback(callback: AsyncCallback): void; - /** - * Releases resources used for video recording. - * @returns { Promise } A Promise instance used to return when release completed. - * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 5400105 - Service died. Return by callback. - * @syscap SystemCapability.Multimedia.Media.VideoRecorder - * @systemapi - * @since 12 - */ - releaseReturnsPromise(): Promise; /** * Resets video recording. * Before resetting video recording, you must call stop() to stop recording. After video recording is reset, @@ -7516,40 +7435,121 @@ declare namespace media { * @systemapi * @since 12 */ - reset(): Promise; + reset(): Promise; + /** + * Listens for video recording error events. + * @param { 'error' } type - Type of the video recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the video recording error event. + * @throws { BusinessError } 5400103 - I/O error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 9 + */ + /** + * Listens for video recording error events. + * @param { 'error' } type - Type of the video recording error event to listen for. + * @param { ErrorCallback } callback - Callback used to listen for the video recording error event. + * @throws { BusinessError } 201 - permission denied. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400103 - I/O error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + on(type: 'error', callback: ErrorCallback): void; + + /** + * video recorder state. + * @type { VideoRecordState } + * @readonly + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 9 + */ + readonly state: VideoRecordState; + overload prepare { prepareWithConfigCallback, prepareWithConfigReturnsPromise}; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { VideoRecorderConfig } config - Recording parameters. + * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by callback. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + prepareWithConfigCallback(config: VideoRecorderConfig, callback: AsyncCallback): void; + /** + * Prepares for recording. + * @permission ohos.permission.MICROPHONE + * @param { VideoRecorderConfig } config - Recording parameters. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @throws { BusinessError } 201 - Permission denied. Return by promise. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. + *
2. Incorrect parameter types. 3.Parameter verification failed. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + prepareWithConfigReturnsPromise(config: VideoRecorderConfig): Promise; + + overload pause { pauseWithCallback,pauseReturnsPromise }; + /** + * Pauses video recording. + * @param { AsyncCallback } callback - A callback instance used to return when pause completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by callback. + * @throws { BusinessError } 5400103 - I/O error. Return by callback. + * @throws { BusinessError } 5400105 - Service died. Return by callback. + * @syscap SystemCapability.Multimedia.Media.VideoRecorder + * @systemapi + * @since 12 + */ + pauseWithCallback(callback: AsyncCallback): void; /** - * Listens for video recording error events. - * @param { 'error' } type - Type of the video recording error event to listen for. - * @param { ErrorCallback } callback - Callback used to listen for the video recording error event. - * @throws { BusinessError } 5400103 - I/O error. Return by callback. - * @throws { BusinessError } 5400105 - Service died. Return by callback. + * Pauses video recording. + * @returns { Promise } A Promise instance used to return when pause completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - I/O error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since 9 + * @since 12 */ + pauseReturnsPromise(): Promise; + + overload release { releaseWithCallback, releaseReturnsPromise}; /** - * Listens for video recording error events. - * @param { 'error' } type - Type of the video recording error event to listen for. - * @param { ErrorCallback } callback - Callback used to listen for the video recording error event. - * @throws { BusinessError } 201 - permission denied. + * Releases resources used for video recording. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. * @throws { BusinessError } 202 - Not System App. - * @throws { BusinessError } 5400103 - I/O error. Return by callback. * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi * @since 12 */ - on(type: 'error', callback: ErrorCallback): void; - + releaseWithCallback(callback: AsyncCallback): void; /** - * video recorder state. - * @type { VideoRecordState } - * @readonly + * Releases resources used for video recording. + * @returns { Promise } A Promise instance used to return when release completed. + * @throws { BusinessError } 202 - Not System App. + * @throws { BusinessError } 5400105 - Service died. Return by callback. * @syscap SystemCapability.Multimedia.Media.VideoRecorder * @systemapi - * @since 9 + * @since 12 */ - readonly state: VideoRecordState; + releaseReturnsPromise(): Promise; } /** @@ -7731,25 +7731,7 @@ declare namespace media { */ prepare(): Promise; - overload { prepareWithCallback, prepareReturnsPromise}; - /** - * Prepare video playback, it will request resource for playing. - * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#prepare - */ - prepareWithCallback(callback: AsyncCallback): void; - /** - * Prepare video playback, it will request resource for playing. - * @returns { Promise } A Promise instance used to return when prepare completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#prepare - */ - prepareReturnsPromise(): Promise; + /** * Starts video playback. * @param { AsyncCallback } callback - A callback instance used to return when start completed. @@ -7768,25 +7750,6 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#play */ play(): Promise; - overload { playWithCallback,playReturnsPromise} - /** - * Starts video playback. - * @param { AsyncCallback } callback - A callback instance used to return when start completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#play - */ - playWithCallback(callback: AsyncCallback): void; - /** - * Starts video playback. - * @returns { Promise } A Promise instance used to return when start completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#play - */ - playReturnsPromise(): Promise; /** * Pauses video playback. * @param { AsyncCallback } callback - A callback instance used to return when pause completed. @@ -7806,25 +7769,6 @@ declare namespace media { */ pause(): Promise; - overload { pauseWithCallback,pauseReturnsPromise }; - /** - * Pauses video playback. - * @param { AsyncCallback } callback - A callback instance used to return when pause completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#pause - */ - pauseWithCallback(callback: AsyncCallback): void; - /** - * Pauses video playback. - * @returns { Promise } A Promise instance used to return when pause completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#pause - */ - pauseReturnsPromise(): Promise; /** * Stops video playback. * @param { AsyncCallback } callback - A callback instance used to return when stop completed. @@ -7936,16 +7880,6 @@ declare namespace media { */ release(): Promise; - overload { releaseWithCallback }; - /** - * Releases resources used for video playback. - * @param { AsyncCallback } callback - A callback instance used to return when release completed. - * @syscap SystemCapability.Multimedia.Media.VideoPlayer - * @since 8 - * @deprecated since 9 - * @useinstead ohos.multimedia.media/media.AVPlayer#release - */ - releaseWithCallback(callback: AsyncCallback): void; /** * Get all track infos in MediaDescription, should be called after data loaded callback. * @param { AsyncCallback> } callback - async callback return track info in MediaDescription. @@ -8157,6 +8091,87 @@ declare namespace media { * @useinstead ohos.multimedia.media/media.AVPlayer#event:error */ on(type: 'error', callback: ErrorCallback): void; + + overload prepare { prepareWithCallback, prepareReturnsPromise}; + /** + * Prepare video playback, it will request resource for playing. + * @param { AsyncCallback } callback - A callback instance used to return when prepare completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#prepare + */ + prepareWithCallback(callback: AsyncCallback): void; + /** + * Prepare video playback, it will request resource for playing. + * @returns { Promise } A Promise instance used to return when prepare completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#prepare + */ + prepareReturnsPromise(): Promise; + + overload release { releaseWithCallback, releaseReturnsPromise }; + /** + * Releases resources used for video playback. + * @param { AsyncCallback } callback - A callback instance used to return when release completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#release + */ + releaseWithCallback(callback: AsyncCallback): void; + + /** + * Releases resources used for video playback. + * @returns { Promise } A Promise instance used to return when release completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#release + */ + releaseReturnsPromise(): Promise; + + overload pause { pauseWithCallback,pauseReturnsPromise }; + /** + * Pauses video playback. + * @param { AsyncCallback } callback - A callback instance used to return when pause completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pauseWithCallback(callback: AsyncCallback): void; + /** + * Pauses video playback. + * @returns { Promise } A Promise instance used to return when pause completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#pause + */ + pauseReturnsPromise(): Promise; + + overload play { playWithCallback,playReturnsPromise} + /** + * Starts video playback. + * @param { AsyncCallback } callback - A callback instance used to return when start completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + playWithCallback(callback: AsyncCallback): void; + /** + * Starts video playback. + * @returns { Promise } A Promise instance used to return when start completed. + * @syscap SystemCapability.Multimedia.Media.VideoPlayer + * @since 8 + * @deprecated since 9 + * @useinstead ohos.multimedia.media/media.AVPlayer#play + */ + playReturnsPromise(): Promise; } /** @@ -10162,18 +10177,6 @@ declare namespace media { * }) */ release(): Promise; - overload { releaseReturnsPromise }; - /** - * Releases the video transcoding resources. This API uses a promise to return the result. - * - * After the resources are released, you can no longer perform any operation on the **AVTranscoder** instance. - * @returns { Promise } Promise that returns no value. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 - */ - releaseReturnsPromise(): Promise; /** * Subscribes to screen capture state changes. An application can subscribe to only one screen capture * state change event. When the application initiates multiple subscriptions to this event, @@ -10233,6 +10236,19 @@ declare namespace media { * avScreenCaptureRecorder.off('error'); */ off(type: 'error', callback?: ErrorCallback): void; + + overload release { releaseReturnsPromise }; + /** + * Releases the video transcoding resources. This API uses a promise to return the result. + * + * After the resources are released, you can no longer perform any operation on the **AVTranscoder** instance. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + releaseReturnsPromise(): Promise; } /** @@ -10372,20 +10388,6 @@ declare namespace media { */ prepare(config: AVTranscoderConfig): Promise; - overload { prepareWithConfigReturnsPromise }; - /** - * Sets video transcoding parameters. This API uses a promise to return the result. - * @param { AVTranscoderConfig } config - Video transcoding parameters to set. - * @returns { Promise } Promise that returns no value. - * @throws { BusinessError } 401 - The parameter check failed. Return by promise. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400103 - IO error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. - * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 - */ - prepareWithConfigReturnsPromise(config: AVTranscoderConfig): Promise; /** * Starts transcoding. This API uses a promise to return the result. * @@ -10413,20 +10415,6 @@ declare namespace media { */ pause(): Promise; - overload{ pauseReturnsPromise }; - /** - * Pauses transcoding. This API uses a promise to return the result. - * - * This API can be called only after the [start()]{@link AVTranscoder.start} API is called. - * You can call [resume()]{@link AVTranscoder.resume} to resume transcoding. - * @returns { Promise } Promise that returns no value. - * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. - * @throws { BusinessError } 5400103 - IO error. Return by promise. - * @throws { BusinessError } 5400105 - Service died. Return by promise. - * @syscap SystemCapability.Multimedia.Media.AVTranscoder - * @since 12 - */ - pauseReturnsPromise(): Promise; /** * Resumes transcoding. This API uses a promise to return the result. * @@ -10550,6 +10538,36 @@ declare namespace media { * @since 12 */ off(type:'progressUpdate', callback?: Callback):void; + + overload prepare { prepareWithConfigReturnsPromise }; + /** + * Sets video transcoding parameters. This API uses a promise to return the result. + * @param { AVTranscoderConfig } config - Video transcoding parameters to set. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 401 - The parameter check failed. Return by promise. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @throws { BusinessError } 5400106 - Unsupported format. Returned by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + prepareWithConfigReturnsPromise(config: AVTranscoderConfig): Promise; + + overload pause { pauseReturnsPromise }; + /** + * Pauses transcoding. This API uses a promise to return the result. + * + * This API can be called only after the [start()]{@link AVTranscoder.start} API is called. + * You can call [resume()]{@link AVTranscoder.resume} to resume transcoding. + * @returns { Promise } Promise that returns no value. + * @throws { BusinessError } 5400102 - Operation not allowed. Return by promise. + * @throws { BusinessError } 5400103 - IO error. Return by promise. + * @throws { BusinessError } 5400105 - Service died. Return by promise. + * @syscap SystemCapability.Multimedia.Media.AVTranscoder + * @since 12 + */ + pauseReturnsPromise(): Promise; } /** -- Gitee