From cf7d1225687e871ee1fc071ca1044db9e4082132 Mon Sep 17 00:00:00 2001 From: magekkkk Date: Wed, 16 Apr 2025 12:56:06 +0000 Subject: [PATCH 1/2] add perf doc in core apis Signed-off-by: magekkkk --- api/@ohos.multimedia.audio.d.ts | 46 +++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 53098402a8..32f92893e0 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -213,7 +213,21 @@ declare namespace audio { * @since 8 */ /** - * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. + * Obtains an {@link AudioRenderer} instance. + * This method uses an asynchronous callback to return the renderer instance. + * + * The AudioRenderer instance is used to play streaming audio data. + * When using AudioRenderer apis, there are many instructions for application + * to achieve better performance and lower power consumption: + * In music or audiobook background playback situation, you can have low power + * consumption by following this best practices document [Low-Power Rules in Music Playback Scenarios]{@link xxx}. + * And for navigation situation, you can follow [Low-Power Rules in Navigation and Positioning Scenarios]{@link xxx}. + * + * Application developer should also be careful when app goes to background, please check if your audio playback + * is still needed, see [Audio Resources]{@link xxx}. + * And avoiding to send silence audio data continuously to waste system resources, otherwise system will take + * control measures when this behavior is detected, see [Audio Playback]{@link xxx}. + * * @param { AudioRendererOptions } options - Renderer configurations. * @param { AsyncCallback } callback - Callback used to return the audio renderer instance. * @syscap SystemCapability.Multimedia.Audio.Renderer @@ -230,7 +244,21 @@ declare namespace audio { * @since 8 */ /** - * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. + * Obtains an {@link AudioRenderer} instance. + * This method uses a promise to return the renderer instance. + * + * The AudioRenderer instance is used to play streaming audio data. + * When using AudioRenderer apis, there are many instructions for application + * to achieve better performance and lower power consumption: + * In music or audiobook background playback situation, you can have low power + * consumption by following this best practices document [Low-Power Rules in Music Playback Scenarios]{@link xxx}. + * And for navigation situation, you can follow [Low-Power Rules in Navigation and Positioning Scenarios]{@link xxx}. + * + * Application developer should also be careful when app goes to background, please check if your audio playback + * is still needed, see [Audio Resources]{@link xxx}. + * And avoiding to send silence audio data continuously to waste system resources, otherwise system will take + * control measures when this behavior is detected, see [Audio Playback]{@link xxx}. + * * @param { AudioRendererOptions } options - Renderer configurations. * @returns { Promise } Promise used to return the audio renderer instance. * @syscap SystemCapability.Multimedia.Audio.Renderer @@ -7079,6 +7107,20 @@ declare namespace audio { */ type AudioRendererWriteDataCallback = (data: ArrayBuffer) => AudioDataCallbackResult | void; + /** + * Type definition of callback function for audio renderer write data. + * + * @typedef { function } AudioRendererWriteDataCallback + * @param { ArrayBuffer } data - audio data array buffer. + * @returns { AudioDataCallbackResult | void } result of callback or void. If void or AudioDataCallbackResult.VALID is + * returned, it indicates the data is valid and will be played. If AudioDataCallbackResult.INVALID is returned, it + * indicates the data is will not be played. + * @syscap SystemCapability.Multimedia.Audio.Renderer + * @crossplatform + * @since 20 1.2 + */ + type AudioRendererWriteDataCallback = (data: ArrayBuffer) => AudioDataCallbackResult | undefined; + /** * Audio timestamp info. -- Gitee From cdbc9d4d9bc8dece2c24203a96f98fdfecd5d3b5 Mon Sep 17 00:00:00 2001 From: magekkkk Date: Wed, 16 Apr 2025 13:12:40 +0000 Subject: [PATCH 2/2] add arkts ver Signed-off-by: magekkkk --- api/@ohos.multimedia.audio.d.ts | 35 ++++----------------------------- 1 file changed, 4 insertions(+), 31 deletions(-) diff --git a/api/@ohos.multimedia.audio.d.ts b/api/@ohos.multimedia.audio.d.ts index 32f92893e0..614476155e 100644 --- a/api/@ohos.multimedia.audio.d.ts +++ b/api/@ohos.multimedia.audio.d.ts @@ -213,21 +213,7 @@ declare namespace audio { * @since 8 */ /** - * Obtains an {@link AudioRenderer} instance. - * This method uses an asynchronous callback to return the renderer instance. - * - * The AudioRenderer instance is used to play streaming audio data. - * When using AudioRenderer apis, there are many instructions for application - * to achieve better performance and lower power consumption: - * In music or audiobook background playback situation, you can have low power - * consumption by following this best practices document [Low-Power Rules in Music Playback Scenarios]{@link xxx}. - * And for navigation situation, you can follow [Low-Power Rules in Navigation and Positioning Scenarios]{@link xxx}. - * - * Application developer should also be careful when app goes to background, please check if your audio playback - * is still needed, see [Audio Resources]{@link xxx}. - * And avoiding to send silence audio data continuously to waste system resources, otherwise system will take - * control measures when this behavior is detected, see [Audio Playback]{@link xxx}. - * + * Obtains an {@link AudioRenderer} instance. This method uses an asynchronous callback to return the renderer instance. * @param { AudioRendererOptions } options - Renderer configurations. * @param { AsyncCallback } callback - Callback used to return the audio renderer instance. * @syscap SystemCapability.Multimedia.Audio.Renderer @@ -244,21 +230,7 @@ declare namespace audio { * @since 8 */ /** - * Obtains an {@link AudioRenderer} instance. - * This method uses a promise to return the renderer instance. - * - * The AudioRenderer instance is used to play streaming audio data. - * When using AudioRenderer apis, there are many instructions for application - * to achieve better performance and lower power consumption: - * In music or audiobook background playback situation, you can have low power - * consumption by following this best practices document [Low-Power Rules in Music Playback Scenarios]{@link xxx}. - * And for navigation situation, you can follow [Low-Power Rules in Navigation and Positioning Scenarios]{@link xxx}. - * - * Application developer should also be careful when app goes to background, please check if your audio playback - * is still needed, see [Audio Resources]{@link xxx}. - * And avoiding to send silence audio data continuously to waste system resources, otherwise system will take - * control measures when this behavior is detected, see [Audio Playback]{@link xxx}. - * + * Obtains an {@link AudioRenderer} instance. This method uses a promise to return the renderer instance. * @param { AudioRendererOptions } options - Renderer configurations. * @returns { Promise } Promise used to return the audio renderer instance. * @syscap SystemCapability.Multimedia.Audio.Renderer @@ -7117,7 +7089,8 @@ declare namespace audio { * indicates the data is will not be played. * @syscap SystemCapability.Multimedia.Audio.Renderer * @crossplatform - * @since 20 1.2 + * @since 20 + * @arkts 1.2 */ type AudioRendererWriteDataCallback = (data: ArrayBuffer) => AudioDataCallbackResult | undefined; -- Gitee