From 236076a76f24dfe58a3fff1cd06d9140407420c5 Mon Sep 17 00:00:00 2001 From: wusongqing Date: Tue, 21 Jun 2022 19:42:40 +0800 Subject: [PATCH] updated docs against 5370 Signed-off-by: wusongqing --- en/application-dev/ability/stage-call.md | 6 +- .../reference/apis/js-apis-Context.md | 8 +-- .../reference/apis/js-apis-audio.md | 63 ++++++++++++++++++- .../apis/js-apis-dataAbilityHelper.md | 16 ++--- .../reference/apis/js-apis-media.md | 11 ++-- .../reference/apis/js-apis-prompt.md | 4 +- 6 files changed, 86 insertions(+), 22 deletions(-) diff --git a/en/application-dev/ability/stage-call.md b/en/application-dev/ability/stage-call.md index 663cce30ee..e402454ddf 100644 --- a/en/application-dev/ability/stage-call.md +++ b/en/application-dev/ability/stage-call.md @@ -18,11 +18,11 @@ The table below describes the ability call APIs. For details, see [Ability](../r **Table 1** Ability call APIs |API|Description| |:------|:------| -|startAbilityByCall(want: Want): Promise|Obtains the caller interface of the specified ability and, if the specified ability is not running, starts the ability in the background.| +|startAbilityByCall(want: Want): Promise\|Obtains the caller interface of the specified ability and, if the specified ability is not running, starts the ability in the background.| |on(method: string, callback: CaleeCallBack): void|Callback invoked when the callee registers a method.| |off(method: string): void|Callback invoked when the callee deregisters a method.| -|call(method: string, data: rpc.Sequenceable): Promise|Sends agreed sequenceable data to the callee.| -|callWithResult(method: string, data: rpc.Sequenceable): Promise|Sends agreed sequenceable data to the callee and returns the agreed sequenceable data.| +|call(method: string, data: rpc.Sequenceable): Promise\|Sends agreed sequenceable data to the callee.| +|callWithResult(method: string, data: rpc.Sequenceable): Promise\|Sends agreed sequenceable data to the callee and returns the agreed sequenceable data.| |release(): void|Releases the caller interface.| |onRelease(callback: OnReleaseCallBack): void|Registers a callback that is invoked when the caller is disconnected.| diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md index efc0435996..8b2851b629 100644 --- a/en/application-dev/reference/apis/js-apis-Context.md +++ b/en/application-dev/reference/apis/js-apis-Context.md @@ -1,4 +1,4 @@ -# Context Module +# Context > **NOTE** > @@ -931,9 +931,9 @@ Describes the HAP module information. | iconId | number | Yes | No | Module icon ID. | | backgroundImg | string | Yes | No | Module background image. | | supportedModes | number | Yes | No | Running modes supported by the module. | -| reqCapabilities | Array | Yes | No | Capabilities required for module running.| -| deviceTypes | Array | Yes | No | Device types supported by the module.| -| abilityInfo | Array | Yes | No | Ability information. | +| reqCapabilities | Array\ | Yes | No | Capabilities required for module running.| +| deviceTypes | Array\ | Yes | No | Device types supported by the module.| +| abilityInfo | Array\ | Yes | No | Ability information. | | moduleName | string | Yes | No | Module name. | | mainAbilityName | string | Yes | No | Name of the main ability. | | installationFree | boolean | Yes | No | Whether installation-free is supported. | diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index eb07b107ed..87d07aa36f 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -246,6 +246,17 @@ Enumerates the audio stream types. | VOICE_ASSISTANT8+ | 9 | Audio stream for voice assistant.| +## InterruptMode9+ + +Enumerates the audio interruption modes. + +**System capability**: SystemCapability.Multimedia.Audio.InterruptMode + +| Name | Default Value| Description | +| ---------------------------- | ------ | ---------- | +| SHARE_MODE | 0 | Share mode.| +| INDEPENDENT_MODE| 1 | Independent mode. | + ## DeviceFlag Enumerates the audio device flags. @@ -542,7 +553,7 @@ Describes the callback invoked for audio interruption or focus gain events. | ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ | | actionType | [InterruptActionType](#interruptactiontype) | Yes | Returned event type. The value **TYPE_ACTIVATED** means the focus gain event, and **TYPE_INTERRUPT** means the audio interruption event.| | type | [InterruptType](#interrupttype) | No | Type of the audio interruption event. | -| hint | [InterruptHint](interrupthint) | No | Hint provided along with the audio interruption event. | +| hint | [InterruptHint](#interrupthint) | No | Hint provided along with the audio interruption event. | | activated | boolean | No | Whether the focus is gained or released. The value **true** means that the focus is gained or released, and **false** means that the focus fails to be gained or released.| ## VolumeEvent8+ @@ -646,7 +657,7 @@ Sets the volume for a stream. This API uses an asynchronous callback to return t | ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | | volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. | | volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**.| -| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -2477,7 +2488,55 @@ audioRenderer.getRenderRate().then((renderRate) => { console.log('ERROR: '+err.message); }); ``` +### setInterruptMode9+ + +setInterruptMode(interruptMode: InterruptMode): Promise<void> + +Sets the audio interruption mode for the application. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Renderer + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | +| interruptMode | [InterruptMode](#InterruptMode) | Yes | Audio interruption mode. | + +**Return value** + +| Type | Description | +| ------------------- | ----------------------------- | +| Promise<void> | Promise used to return the result. If the operation is successful, **undefined** is returned. Otherwise, **error** is returned.| + +**Example** + +``` +audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE).then(() => { + console.log('Promise returned to indicate a successful volume setting.'); +}); +``` +### setInterruptMode9+ + +setInterruptMode(interruptMode: InterruptMode, callback: Callback\): void + +Sets the audio interruption mode for the application. This API uses a callback to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Renderer + +**Parameters** + +| Name| Type| Mandatory| Description | +| ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | +|interruptMode | [InterruptMode](#InterruptMode) | Yes | Audio interruption mode.| +|callback | Callback\ | Yes |Callback used to return the result.| +**Example** + +``` +audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE,()=>{ + console.log('Callback returned to indicate a successful volume setting.'); +}); +``` ### on('interrupt')9+ on(type: 'interrupt', callback: Callback\): void diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md index 1ce0a05d1e..029e169fd2 100644 --- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md @@ -1,7 +1,9 @@ -# DataAbilityHelper Module (JavaScript SDK APIs) +# DataAbilityHelper -> **NOTE**
-> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the FA model. ## Modules to Import @@ -870,7 +872,7 @@ DAHelper.query( ## DataAbilityHelper.call -call(uri: string, method: string, arg: string, extras: PacMap): Promise +call(uri: string, method: string, arg: string, extras: PacMap): Promise\ Calls the extended API of the Data ability. This API uses a promise to return the result. @@ -889,7 +891,7 @@ Calls the extended API of the Data ability. This API uses a promise to return th | Type| Description| |------ | ------- | -|Promise<[PacMap](#pacmap)> | Promise used to return the result.| +|Promise\<[PacMap](#pacmap)> | Promise used to return the result.| **Example** @@ -906,7 +908,7 @@ dataAbilityHelper.call("dataability:///com.example.jsapidemo.UserDataAbility", " ## DataAbilityHelper.call -call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback): void +call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\): void Calls the extended API of the Data ability. This API uses an asynchronous callback to return the result. @@ -920,7 +922,7 @@ Calls the extended API of the Data ability. This API uses an asynchronous callba | method | string | Yes | Name of the API to call. | | arg | string | Yes |Parameter to pass. | | extras | [PacMap](#pacmap) | Yes | Key-value pair parameter. | -| callback | AsyncCallback<[PacMap](#pacmap)> | Yes| Callback used to return the result. | +| callback | AsyncCallback\<[PacMap](#pacmap)> | Yes| Callback used to return the result. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md index 248e344bf2..2b0504a51b 100644 --- a/en/application-dev/reference/apis/js-apis-media.md +++ b/en/application-dev/reference/apis/js-apis-media.md @@ -1,7 +1,6 @@ # Media > **NOTE** -> > The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. The multimedia subsystem provides a set of simple and easy-to-use APIs for you to access the system and use media resources. @@ -680,6 +679,8 @@ setDisplaySurface(surfaceId: string, callback: AsyncCallback\): void Sets **SurfaceId**. This API uses a callback to return the result. +*Note: **SetDisplaySurface** must be called between the URL setting and the calling of **prepare**. A surface must be set for video streams without audio. Otherwise, the calling of **prepare** fails. + **System capability**: SystemCapability.Multimedia.Media.VideoPlayer **Parameters** @@ -707,6 +708,8 @@ setDisplaySurface(surfaceId: string): Promise\ Sets **SurfaceId**. This API uses a promise to return the result. +*Note: **SetDisplaySurface** must be called between the URL setting and the calling of **prepare**. A surface must be set for video streams without audio. Otherwise, the calling of **prepare** fails. + **System capability**: SystemCapability.Multimedia.Media.VideoPlayer **Parameters** @@ -717,9 +720,9 @@ Sets **SurfaceId**. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------- | ------------------------------ | -| Promise | Promise used to return the result.| +| Type | Description | +| -------------- | ------------------------------ | +| Promise\ | Promise used to return the result.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-prompt.md b/en/application-dev/reference/apis/js-apis-prompt.md index 3b4523f4f2..3facc0146e 100644 --- a/en/application-dev/reference/apis/js-apis-prompt.md +++ b/en/application-dev/reference/apis/js-apis-prompt.md @@ -1,6 +1,6 @@ # Prompt -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -208,7 +208,7 @@ Shows an action menu. This API uses a callback to return the result asynchronous ## prompt.showActionMenu -showActionMenu(options: ActionMenuOptions): Promise +showActionMenu(options: ActionMenuOptions): Promise\ Shows an action menu. This API uses a promise to return the result synchronously. -- GitLab