未验证 提交 e6d2cfb1 编写于 作者: O openharmony_ci 提交者: Gitee

!5682 翻译完成:5370 文档规范修改

Merge pull request !5682 from wusongqing/TR5370
......@@ -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<Caller>|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\<Caller>|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<void>|Sends agreed sequenceable data to the callee.|
|callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>|Sends agreed sequenceable data to the callee and returns the agreed sequenceable data.|
|call(method: string, data: rpc.Sequenceable): Promise\<void>|Sends agreed sequenceable data to the callee.|
|callWithResult(method: string, data: rpc.Sequenceable): Promise\<rpc.MessageParcel>|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.|
......
# 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<string> | Yes | No | Capabilities required for module running.|
| deviceTypes | Array<string> | Yes | No | Device types supported by the module.|
| abilityInfo | Array<AbilityInfo> | Yes | No | Ability information. |
| reqCapabilities | Array\<string> | Yes | No | Capabilities required for module running.|
| deviceTypes | Array\<string> | Yes | No | Device types supported by the module.|
| abilityInfo | Array\<AbilityInfo> | 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. |
......
......@@ -246,6 +246,17 @@ Enumerates the audio stream types.
| VOICE_ASSISTANT<sup>8+</sup> | 9 | Audio stream for voice assistant.|
## InterruptMode<sup>9+</sup>
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.|
## VolumeEvent<sup>8+</sup>
......@@ -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&lt;void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
......@@ -2477,7 +2488,55 @@ audioRenderer.getRenderRate().then((renderRate) => {
console.log('ERROR: '+err.message);
});
```
### setInterruptMode<sup>9+</sup>
setInterruptMode(interruptMode: InterruptMode): Promise&lt;void&gt;
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&lt;void&gt; | 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.');
});
```
### setInterruptMode<sup>9+</sup>
setInterruptMode(interruptMode: InterruptMode, callback: Callback\<void>): 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\<void> | 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')<sup>9+</sup>
on(type: 'interrupt', callback: Callback\<InterruptEvent>): void
......
# DataAbilityHelper Module (JavaScript SDK APIs)
# DataAbilityHelper
> **NOTE**<br>
> 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<PacMap>
call(uri: string, method: string, arg: string, extras: PacMap): Promise\<PacMap>
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<PacMap>): void
call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCallback\<PacMap>): 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**
......
# 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>): 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\<void>
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<void> | Promise used to return the result.|
| Type | Description |
| -------------- | ------------------------------ |
| Promise\<void> | Promise used to return the result.|
**Example**
......
# 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<ActionMenuSuccessResponse>
showActionMenu(options: ActionMenuOptions): Promise\<ActionMenuSuccessResponse>
Shows an action menu. This API uses a promise to return the result synchronously.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册