提交 78e77ed9 编写于 作者: G Gloria

Update docs against 18965+19099

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 78c09c04
......@@ -15,8 +15,8 @@
- Selecting and Saving User Files (FilePicker)
- [Selecting User Files](select-user-file.md)
- [Saving User Files](save-user-file.md)
- [Developing a FileManager Application (Available Only for System Applications)](dev-user-file-manager.md)
- [Managing External Storage Devices (Available Only for System Applications)](manage-external-storage.md)
- [Developing a FileManager Application (for System Applications Only)](dev-user-file-manager.md)
- [Managing External Storage Devices (for System Applications Only)](manage-external-storage.md)
- Distributed File System
- [Distributed File System Overview](distributed-fs-overview.md)
- [Setting the Security Level of a Distributed File](set-security-label.md)
......
# Developing a FileManager Application (Available Only for System Applications)
# Developing a FileManager Application (for System Applications Only)
OpenHarmony is prebuilt with the **FileManager** application. You can also develop your own **FileManager** as required.
......
# Managing External Storage Devices (Available Only for System Applications)
# Managing External Storage Devices (for System Applications Only)
External storage devices are pluggable. OpenHarmony provides the functions of listening for the device insertion and removal events and mounting/unmounting an external storage device.
......@@ -28,13 +28,13 @@ The following table describes the broadcast related parameters.
**Table 1** Broadcast parameters
| Broadcast| Parameter|
| Broadcast| Parameter|
| -------- | -------- |
| usual.event.data.VOLUME_REMOVED | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.|
| usual.event.data.VOLUME_UNMOUNTED | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.<br>**volumeState**: state of the volume.|
| usual.event.data.VOLUME_MOUNTED | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.<br>**volumeState**: state of the volume.<br>**fsUuid**: universally unique identifier (UUID) of the volume.<br>**path**: path where the volume is mounted.|
| usual.event.data.VOLUME_BAD_REMOVAL | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.|
| usual.event.data.VOLUME_EJECT | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.<br>**volumeState**: state of the volume.|
| usual.event.data.VOLUME_REMOVED | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.|
| usual.event.data.VOLUME_UNMOUNTED | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.<br>**volumeState**: state of the volume.|
| usual.event.data.VOLUME_MOUNTED | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.<br>**volumeState**: state of the volume.<br>**fsUuid**: universally unique identifier (UUID) of the volume.<br>**path**: path where the volume is mounted.|
| usual.event.data.VOLUME_BAD_REMOVAL | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.|
| usual.event.data.VOLUME_EJECT | **id**: ID of the volume.<br>**diskId**: ID of the disk to which the volume belongs.<br>**volumeState**: state of the volume.|
## How to Develop
......
......@@ -28,7 +28,7 @@
- [Developing Audio Call](audio-call-development.md)
- [Video Playback](video-playback.md)
- [Video Recording](video-recording.md)
- AVSession (for System Applications Only)
- AVSession
- [AVSession Overview](avsession-overview.md)
- Local AVSession
- [Local AVSession Overview](local-avsession-overview.md)
......@@ -37,7 +37,7 @@
- Distributed AVSession
- [Distributed AVSession Overview](distributed-avsession-overview.md)
- [Using Distributed AVSession](using-distributed-avsession.md)
- Camera (for System Applications Only)
- Camera
- [Camera Overview](camera-overview.md)
- Camera Development
- [Camera Development Preparations](camera-preparation.md)
......
......@@ -26,11 +26,7 @@ For details, see [AVSession Management](../reference/apis/js-apis-avsession.md).
| -------- | -------- |
| getAllSessionDescriptors(callback: AsyncCallback&lt;Array&lt;Readonly&lt;AVSessionDescriptor&gt;&gt;&gt;): void | Obtains the descriptors of all AVSessions in the system.|
| createController(sessionId: string, callback: AsyncCallback&lt;AVSessionController&gt;): void | Creates an AVSessionController.|
| getValidCommands(callback: AsyncCallback&lt;Array&lt;AVControlCommandType&gt;&gt;): void | Obtains valid commands supported by the AVSession.<br>Playback control commands listened by an audio and video application when it accesses the AVSession are considered as valid commands supported by the AVSession. For details, see [Provider of AVSession](using-avsession-developer.md).|
| getLaunchAbility(callback: AsyncCallback&lt;WantAgent&gt;): void | Obtains the UIAbility that is configured in the AVSession and can be started.<br>The UIAbility configured here is started when a user operates the UI of the controller, for example, clicking a widget in Media Controller.|
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | Sends a key event to an AVSession through the AVSessionController object.|
| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | Sends a key event to the top session.|
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | Sends a playback control command to an AVSession through the AVSessionController object.|
| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | Sends a playback control command to the top session.|
| getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback\<Array\<Readonly\<AVSessionDescriptor>>>): void<sup>10+<sup> | Obtains the descriptors of historical sessions.|
......@@ -38,15 +34,15 @@ For details, see [AVSession Management](../reference/apis/js-apis-avsession.md).
| API| Description|
| -------- | -------- |
| getAVPlaybackState(callback: AsyncCallback&lt;AVPlaybackState&gt;): void | Obtains the information related to the playback state.|
| getAVMetadata(callback: AsyncCallback&lt;AVMetadata&gt;): void | Obtains the session metadata.|
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void | Obtains the output device information.|
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | Sends a key event to the session corresponding to this controller.|
| getLaunchAbility(callback: AsyncCallback&lt;WantAgent&gt;): void | Obtains the **WantAgent** object saved by the application in the session.|
| isActive(callback: AsyncCallback&lt;boolean&gt;): void | Checks whether the session is activated.|
| destroy(callback: AsyncCallback&lt;void&gt;): void | Destroys this controller. A controller can no longer be used after being destroyed.|
| getValidCommands(callback: AsyncCallback&lt;Array&lt;AVControlCommandType&gt;&gt;): void | Obtains valid commands supported by the session.|
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | Sends a playback control command to the session through the controller.|
| getAVPlaybackState(callback: AsyncCallback&lt;AVPlaybackState&gt;): void<sup>10+<sup> | Obtains the information related to the playback state.|
| getAVMetadata(callback: AsyncCallback&lt;AVMetadata&gt;): void<sup>10+<sup> | Obtains the session metadata.|
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void<sup>10+<sup> | Obtains the output device information.|
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Sends a key event to the session corresponding to this controller.|
| getLaunchAbility(callback: AsyncCallback&lt;WantAgent&gt;): void<sup>10+<sup> | Obtains the **WantAgent** object saved by the application in the session.|
| isActive(callback: AsyncCallback&lt;boolean&gt;): void<sup>10+<sup> | Checks whether the session is activated.|
| destroy(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Destroys this controller. A controller can no longer be used after being destroyed.|
| getValidCommands(callback: AsyncCallback&lt;Array&lt;AVControlCommandType&gt;&gt;): void<sup>10+<sup> | Obtains valid commands supported by the session.|
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Sends a playback control command to the session through the controller.|
| sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Sends a custom playback control command to the session through the controller.|
| getAVQueueItems(callback: AsyncCallback&lt;Array&lt;AVQueueItem&gt;&gt;): void<sup>10+<sup> | Obtains the information related to the items in the playlist.|
| getAVQueueTitle(callback: AsyncCallback&lt;string&gt;): void<sup>10+<sup> | Obtains the name of the playlist.|
......
......@@ -16,15 +16,15 @@ For details, see [AVSession Management](../reference/apis/js-apis-avsession.md).
| API| Description|
| -------- | -------- |
| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback&lt;AVSession&gt;): void | Creates an AVSession.<br>Only one AVSession can be created for a UIAbility.|
| setAVMetadata(data: AVMetadata, callback: AsyncCallback&lt;void&gt;): void | Sets AVSession metadata.|
| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback&lt;void&gt;): void | Sets the AVSession playback state.|
| setLaunchAbility(ability: WantAgent, callback: AsyncCallback&lt;void&gt;): void | Starts a UIAbility.|
| getController(callback: AsyncCallback&lt;AVSessionController&gt;): void | Obtains the controller of the AVSession.|
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void | Obtains the output device information.|
| activate(callback: AsyncCallback&lt;void&gt;): void | Activates the AVSession.|
| deactivate(callback: AsyncCallback&lt;void&gt;): void | Deactivates this session.|
| destroy(callback: AsyncCallback&lt;void&gt;): void | Destroys the AVSession.|
| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback&lt;AVSession&gt;): void<sup>10+<sup> | Creates an AVSession.<br>Only one AVSession can be created for a UIAbility.|
| setAVMetadata(data: AVMetadata, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Sets AVSession metadata.|
| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Sets the AVSession playback state.|
| setLaunchAbility(ability: WantAgent, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Starts a UIAbility.|
| getController(callback: AsyncCallback&lt;AVSessionController&gt;): void<sup>10+<sup> | Obtains the controller of the AVSession.|
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void<sup>10+<sup> | Obtains the output device information.|
| activate(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Activates the AVSession.|
| deactivate(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Deactivates this session.|
| destroy(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Destroys the AVSession.|
| setAVQueueItems(items: Array&lt;AVQueueItem&gt;, callback: AsyncCallback&lt;void&gt;): void <sup>10+<sup> | Sets a playlist.|
| setAVQueueTitle(title: string, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Sets a name for the playlist.|
| dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | Dispatches a custom session event.|
......@@ -343,21 +343,20 @@ To enable an audio and video application to access the AVSession service as a pr
session.off('commonCommand');
}
```
The code snippet below is used for destroying the AVSession object:
```ts
```ts
async destroySession() {
// It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet in step 1.
let session: AVSessionManager.AVSession = ALREADY_CREATE_A_SESSION;
// Destroy the AVSession object.
session.destroy(function (err) {
if (err) {
console.error(`Failed to destroy session. Code: ${err.code}, message: ${err.message}`);
} else {
console.info(`Destroy : SUCCESS `);
}
});
// It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet in step 1.
let session: AVSessionManager.AVSession = ALREADY_CREATE_A_SESSION;
// Destroy the AVSession object.
session.destroy(function (err) {
if (err) {
console.error(`Failed to destroy session. Code: ${err.code}, message: ${err.message}`);
} else {
console.info(`Destroy : SUCCESS `);
}
});
}
```
\ No newline at end of file
```
......@@ -24,7 +24,7 @@
- [HAR](har-package.md)
- HSP
- [In-Application HSP Development](in-app-hsp.md)
- [Inter-Application HSP Development (for System Applications Only)](cross-app-hsp.md)
- [Inter-Application HSP Development](cross-app-hsp.md)
- Atomic Service
- [Atomic Service Development](atomicService.md)
- [Atomic Service Space Management (for System Applications Only)](atomicService-aging.md)
......
......@@ -3,6 +3,7 @@
- [Common Events of the Ability Subsystem](commonEvent-ability.md)
- [Common Events of the Bundle Management Subsystem](commonEvent-bundleManager.md)
- [Common Events of the Notification Service](commonEvent-ans.md)
- [Common Events of the Resource Scheduling Subsystem](commonEvent-resourceschedule.md)
- [Common Events of the Resource Scheduler Subsystem](commonEvent-resourceschedule.md)
- [Common Events of the Telephony Subsystem](commonEvent-telephony.md)
- [Common Events of the USB Subsystem](commonEvent-usb.md)
# Common Events of the Resource Scheduling Subsystem
This document lists the common system events provided by the resource scheduling subsystem to applications. Applications can use [APIs](../js-apis-commonEventManager.md) to subscribe to common system events.
# Common Events of the Resource Scheduler Subsystem
This document lists the common system events provided by the resource scheduler subsystem to applications. Applications can use [APIs](../js-apis-commonEventManager.md) to subscribe to common system events.
## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED
Indicates that the system idle mode has changed.
......
......@@ -4,14 +4,12 @@ The **avSession** module provides APIs for media playback control so that applic
This module provides the following typical features related to media sessions:
- [AVSession](#avsession): used to set session metadata, playback state information, and more.
- [AVSessionController](#avsessioncontroller): used to obtain session IDs, send commands and events to sessions, and obtain the session metadata and playback state information.
- [AVSession](#avsession10): used to set session metadata, playback state information, and more.
- [AVSessionController](#avsessioncontroller10): used to obtain session IDs, send commands and events to sessions, and obtain the session metadata and playback state information.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> All the APIs provided by this module are system APIs.
## Modules to Import
......@@ -19,7 +17,7 @@ This module provides the following typical features related to media sessions:
import avSession from '@ohos.multimedia.avsession';
```
## avSession.createAVSession
## avSession.createAVSession<sup>10+</sup>
createAVSession(context: Context, tag: string, type: AVSessionType): Promise\<AVSession>
......@@ -27,22 +25,19 @@ Creates a media session. This API uses a promise to return the result. An abilit
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------- | ---- | ------------------------------ |
| context| [Context](js-apis-inner-app-context.md) | Yes| Application context, which provides application environment information.|
| tag | string | Yes | Custom session name. |
| type | [AVSessionType](#avsessiontype) | Yes | Session type, which can be audio or video.|
| type | [AVSessionType](#avsessiontype10) | Yes | Session type, which can be audio or video.|
**Return value**
| Type | Description |
| --------------------------------- | ------------------------------------------------------------ |
| Promise<[AVSession](#avsession)\> | Promise used to return the media session obtained, which can be used to obtain the session ID, set the metadata and playback state information, and send key events.|
| Promise<[AVSession](#avsession10)\> | Promise used to return the media session obtained, which can be used to obtain the session ID, set the metadata and playback state information, and send key events.|
**Error codes**
......@@ -69,7 +64,7 @@ await avSession.createAVSession(context, tag, "audio").then((data) => {
});
```
## avSession.createAVSession
## avSession.createAVSession<sup>10+</sup>
createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback\<AVSession>): void
......@@ -77,16 +72,14 @@ Creates a media session. This API uses an asynchronous callback to return the re
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| context| [Context](js-apis-inner-app-context.md) | Yes| Application context, which provides application environment information. |
| tag | string | Yes | Custom session name. |
| type | [AVSessionType](#avsessiontype) | Yes | Session type, which can be audio or video. |
| callback | AsyncCallback<[AVSession](#avsession)\> | Yes | Callback used to return the media session obtained, which can be used to obtain the session ID, set the metadata and playback state information, and send key events.|
| type | [AVSessionType](#avsessiontype10) | Yes | Session type, which can be audio or video. |
| callback | AsyncCallback<[AVSession](#avsession10)\> | Yes | Callback used to return the media session obtained, which can be used to obtain the session ID, set the metadata and playback state information, and send key events.|
**Error codes**
......@@ -316,7 +309,7 @@ Creates a session controller based on the session ID. Multiple session controlle
| Type | Description |
| ----------------------------------------------------- | ------------------------------------------------------------ |
| Promise<[AVSessionController](#avsessioncontroller)\> | Promise used to return the session controller created, which can be used to obtain the session ID,<br>send commands and events to sessions, and obtain metadata and playback state information.|
| Promise<[AVSessionController](#avsessioncontroller10)\> | Promise used to return the session controller created, which can be used to obtain the session ID,<br>send commands and events to sessions, and obtain metadata and playback state information.|
**Error codes**
......@@ -369,7 +362,7 @@ Creates a session controller based on the session ID. Multiple session controlle
| Name | Type | Mandatory| Description |
| --------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| sessionId | string | Yes | Session ID. |
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | Yes | Callback used to return the session controller created, which can be used to obtain the session ID,<br>send commands and events to sessions, and obtain metadata and playback state information.|
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller10)\> | Yes | Callback used to return the session controller created, which can be used to obtain the session ID,<br>send commands and events to sessions, and obtain metadata and playback state information.|
**Error codes**
......@@ -777,7 +770,7 @@ Sends a system control command to the top session. This API uses a promise to re
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------- | ---- | ----------------------------------- |
| command | [AVControlCommand](#avcontrolcommand) | Yes | Command to send.|
| command | [AVControlCommand](#avcontrolcommand10) | Yes | Command to send.|
**Return value**
......@@ -837,7 +830,7 @@ Sends a system control command to the top session. This API uses an asynchronous
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| command | [AVControlCommand](#avcontrolcommand) | Yes | Command to send. |
| command | [AVControlCommand](#avcontrolcommand10) | Yes | Command to send. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the command is sent, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
......@@ -878,17 +871,14 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
});
```
## AVSession
## AVSession<sup>10+</sup>
An **AVSession** object is created by calling [avSession.createAVSession](#avsessioncreateavsession). The object enables you to obtain the session ID and set the metadata and playback state.
An **AVSession** object is created by calling [avSession.createAVSession](#avsessioncreateavsession10). The object enables you to obtain the session ID and set the metadata and playback state.
### Attributes
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| :-------- | :----- | :--- | :--- | :---------------------------- |
| sessionId | string | Yes | No | Unique session ID of the **AVSession** object.|
......@@ -899,7 +889,7 @@ An **AVSession** object is created by calling [avSession.createAVSession](#avses
let sessionId = session.sessionId;
```
### setAVMetadata
### setAVMetadata<sup>10+</sup>
setAVMetadata(data: AVMetadata): Promise\<void>
......@@ -907,13 +897,11 @@ Sets session metadata. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------- | ---- | ------------ |
| data | [AVMetadata](#avmetadata) | Yes | Session metadata.|
| data | [AVMetadata](#avmetadata10) | Yes | Session metadata.|
**Return value**
......@@ -956,7 +944,7 @@ session.setAVMetadata(metadata).then(() => {
});
```
### setAVMetadata
### setAVMetadata<sup>10+</sup>
setAVMetadata(data: AVMetadata, callback: AsyncCallback\<void>): void
......@@ -964,13 +952,11 @@ Sets session metadata. This API uses an asynchronous callback to return the resu
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------- |
| data | [AVMetadata](#avmetadata) | Yes | Session metadata. |
| data | [AVMetadata](#avmetadata10) | Yes | Session metadata. |
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.|
**Error codes**
......@@ -1010,7 +996,7 @@ session.setAVMetadata(metadata, function (err) {
});
```
### setAVPlaybackState
### setAVPlaybackState<sup>10+</sup>
setAVPlaybackState(state: AVPlaybackState): Promise\<void>
......@@ -1018,13 +1004,11 @@ Sets information related to the session playback state. This API uses a promise
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ----------------------------------- | ---- | ---------------------------------------------- |
| data | [AVPlaybackState](#avplaybackstate) | Yes | Information related to the session playback state.|
| data | [AVPlaybackState](#avplaybackstate10) | Yes | Information related to the session playback state.|
**Return value**
......@@ -1033,6 +1017,7 @@ Sets information related to the session playback state. This API uses a promise
| Promise\<void> | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.|
**Error codes**
For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md).
| ID| Error Message|
......@@ -1058,7 +1043,7 @@ session.setAVPlaybackState(playbackState).then(() => {
});
```
### setAVPlaybackState
### setAVPlaybackState<sup>10+</sup>
setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\<void>): void
......@@ -1066,13 +1051,11 @@ Sets information related to the session playback state. This API uses an asynchr
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | ---------------------------------------------- |
| data | [AVPlaybackState](#avplaybackstate) | Yes | Information related to the session playback state.|
| data | [AVPlaybackState](#avplaybackstate10) | Yes | Information related to the session playback state.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object. |
**Error codes**
......@@ -1112,8 +1095,6 @@ Sets a playlist. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1182,8 +1163,6 @@ Sets a playlist. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1249,8 +1228,6 @@ Sets a name for the playlist. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1291,8 +1268,6 @@ Sets a name for the playlist. This API uses an asynchronous callback to return t
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1322,7 +1297,7 @@ session.setAVQueueTitle(queueTitle, function (err) {
});
```
### setLaunchAbility
### setLaunchAbility<sup>10+</sup>
setLaunchAbility(ability: WantAgent): Promise\<void>
......@@ -1330,8 +1305,6 @@ Sets a launcher ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1395,7 +1368,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
});
```
### setLaunchAbility
### setLaunchAbility<sup>10+</sup>
setLaunchAbility(ability: WantAgent, callback: AsyncCallback\<void>): void
......@@ -1403,8 +1376,6 @@ Sets a launcher ability. This API uses an asynchronous callback to return the re
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1473,8 +1444,6 @@ Dispatches a custom event in the session, including the event name and event con
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1521,8 +1490,6 @@ Dispatches a custom event in the session, including the event name and event con
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1566,8 +1533,6 @@ Sets a custom media packet in the form of key-value pairs. This API uses a promi
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1645,7 +1610,7 @@ await session.setExtras(extras, (err) => {
})
```
### getController
### getController<sup>10+</sup>
getController(): Promise\<AVSessionController>
......@@ -1653,13 +1618,11 @@ Obtains the controller corresponding to this session. This API uses a promise to
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| ---------------------------------------------------- | ----------------------------- |
| Promise<[AVSessionController](#avsessioncontroller)> | Promise used to return the session controller.|
| Promise<[AVSessionController](#avsessioncontroller10)> | Promise used to return the session controller.|
**Error codes**
......@@ -1682,7 +1645,7 @@ session.getController().then((avcontroller) => {
});
```
### getController
### getController<sup>10+</sup>
getController(callback: AsyncCallback\<AVSessionController>): void
......@@ -1690,13 +1653,11 @@ Obtains the controller corresponding to this session. This API uses an asynchron
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | Yes | Callback used to return the session controller.|
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller10)\> | Yes | Callback used to return the session controller.|
**Error codes**
......@@ -1721,7 +1682,7 @@ session.getController(function (err, avcontroller) {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(): Promise\<OutputDeviceInfo>
......@@ -1729,13 +1690,11 @@ Obtains information about the output device for this session. This API uses a pr
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| ---------------------------------------------- | --------------------------------- |
| Promise<[OutputDeviceInfo](#outputdeviceinfo)> | Promise used to return the output device information.|
| Promise<[OutputDeviceInfo](#outputdeviceinfo10)> | Promise used to return the output device information.|
**Error codes**
......@@ -1756,7 +1715,7 @@ session.getOutputDevice().then((outputDeviceInfo) => {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void
......@@ -1764,13 +1723,11 @@ Obtains information about the output device for this session. This API uses an a
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | Yes | Callback used to return the information obtained.|
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo10)\> | Yes | Callback used to return the information obtained.|
**Error codes**
......@@ -1793,7 +1750,7 @@ session.getOutputDevice(function (err, outputDeviceInfo) {
});
```
### activate
### activate<sup>10+</sup>
activate(): Promise\<void>
......@@ -1801,8 +1758,6 @@ Activates this session. A session can be used only after being activated. This A
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -1828,7 +1783,7 @@ session.activate().then(() => {
});
```
### activate
### activate<sup>10+</sup>
activate(callback: AsyncCallback\<void>): void
......@@ -1836,8 +1791,6 @@ Activates this session. A session can be used only after being activated. This A
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1865,16 +1818,14 @@ session.activate(function (err) {
});
```
### deactivate
### deactivate<sup>10+</sup>
deactivate(): Promise\<void>
Deactivates this session. You can use [activate](#activate) to activate the session again. This API uses a promise to return the result.
Deactivates this session. You can use [activate](#activate10) to activate the session again. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -1900,18 +1851,16 @@ session.deactivate().then(() => {
});
```
### deactivate
### deactivate<sup>10+</sup>
deactivate(callback: AsyncCallback\<void>): void
Deactivates this session. This API uses an asynchronous callback to return the result.
Deactivates this session. You can use [activate](#activate) to activate the session again.
Deactivates this session. You can use [activate](#activate10) to activate the session again.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -1939,7 +1888,7 @@ session.deactivate(function (err) {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(): Promise\<void>
......@@ -1947,8 +1896,6 @@ Destroys this session. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -1974,7 +1921,7 @@ session.destroy().then(() => {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(callback: AsyncCallback\<void>): void
......@@ -1982,8 +1929,6 @@ Destroys this session. This API uses an asynchronous callback to return the resu
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2011,7 +1956,7 @@ session.destroy(function (err) {
});
```
### on('play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind')
### on('play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind')<sup>10+</sup>
on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind', callback: () => void): void
......@@ -2019,8 +1964,6 @@ Subscribes to playback command events.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2063,7 +2006,7 @@ session.on('rewind', () => {
});
```
### on('seek')
### on('seek')<sup>10+</sup>
on(type: 'seek', callback: (time: number) => void): void
......@@ -2071,8 +2014,6 @@ Subscribes to the seek event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2097,7 +2038,7 @@ session.on('seek', (time) => {
});
```
### on('setSpeed')
### on('setSpeed')<sup>10+</sup>
on(type: 'setSpeed', callback: (speed: number) => void): void
......@@ -2105,8 +2046,6 @@ Subscribes to the event for setting the playback speed.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2131,7 +2070,7 @@ session.on('setSpeed', (speed) => {
});
```
### on('setLoopMode')
### on('setLoopMode')<sup>10+</sup>
on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void
......@@ -2139,14 +2078,12 @@ Subscribes to the event for setting the loop mode.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | ---- |
| type | string | Yes | Event type. The event **'setLoopMode'** is reported when the command for setting the loop mode is sent to the session.|
| callback | (mode: [LoopMode](#loopmode)) => void | Yes | Callback used for subscription. The **mode** parameter in the callback indicates the loop mode. |
| callback | (mode: [LoopMode](#loopmode10)) => void | Yes | Callback used for subscription. The **mode** parameter in the callback indicates the loop mode. |
**Error codes**
......@@ -2165,7 +2102,7 @@ session.on('setLoopMode', (mode) => {
});
```
### on('toggleFavorite')
### on('toggleFavorite')<sup>10+</sup>
on(type: 'toggleFavorite', callback: (assetId: string) => void): void
......@@ -2173,8 +2110,6 @@ Subscribes to the event for favoriting a media asset.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2207,8 +2142,6 @@ Subscribes to the event that indicates an item in the playlist is selected. The
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2233,7 +2166,7 @@ session.on('skipToQueueItem', (itemId) => {
});
```
### on('handleKeyEvent')
### on('handleKeyEvent')<sup>10+</sup>
on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void
......@@ -2241,8 +2174,6 @@ Subscribes to the key event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2267,7 +2198,7 @@ session.on('handleKeyEvent', (event) => {
});
```
### on('outputDeviceChange')
### on('outputDeviceChange')<sup>10+</sup>
on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void
......@@ -2275,14 +2206,12 @@ Subscribes to output device changes.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The event **'outputDeviceChange'** is reported when the output device changes.|
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | Yes | Callback used for subscription. The **device** parameter in the callback indicates the output device information. |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | Yes | Callback used for subscription. The **device** parameter in the callback indicates the output device information. |
**Error codes**
......@@ -2309,8 +2238,6 @@ Subscribes to custom control command changes.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2335,7 +2262,7 @@ session.on('commonCommand', (commonCommand, args) => {
});
```
### off('play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind')
### off('play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind')<sup>10+</sup>
off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback?: () => void): void
......@@ -2343,8 +2270,6 @@ Unsubscribes from playback command events.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2373,7 +2298,7 @@ session.off('fastForward');
session.off('rewind');
```
### off('seek')
### off('seek')<sup>10+</sup>
off(type: 'seek', callback?: (time: number) => void): void
......@@ -2381,8 +2306,6 @@ Unsubscribes from the seek event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2405,7 +2328,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
session.off('seek');
```
### off('setSpeed')
### off('setSpeed')<sup>10+</sup>
off(type: 'setSpeed', callback?: (speed: number) => void): void
......@@ -2413,8 +2336,6 @@ Unsubscribes from the event for setting the playback speed.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2437,7 +2358,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
session.off('setSpeed');
```
### off('setLoopMode')
### off('setLoopMode')<sup>10+</sup>
off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void
......@@ -2445,14 +2366,12 @@ Unsubscribes from the event for setting loop mode.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | ----- |
| type | string | Yes | Event type. The value is fixed at **'setLoopMode'**.|
| callback | (mode: [LoopMode](#loopmode)) => void | No | Callback used for unsubscription. The **mode** parameter in the callback indicates the loop mode.<br>If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session.|
| callback | (mode: [LoopMode](#loopmode10)) => void | No | Callback used for unsubscription. The **mode** parameter in the callback indicates the loop mode.<br>If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session.|
**Error codes**
......@@ -2469,7 +2388,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
session.off('setLoopMode');
```
### off('toggleFavorite')
### off('toggleFavorite')<sup>10+</sup>
off(type: 'toggleFavorite', callback?: (assetId: string) => void): void
......@@ -2477,8 +2396,6 @@ Unsubscribes from the event for favoriting a media asset.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2509,8 +2426,6 @@ Unsubscribes from the event that indicates an item in the playlist is selected.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2533,7 +2448,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
session.off('skipToQueueItem');
```
### off('handleKeyEvent')
### off('handleKeyEvent')<sup>10+</sup>
off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void
......@@ -2541,8 +2456,6 @@ Unsubscribes from the key event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2565,7 +2478,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
session.off('handleKeyEvent');
```
### off('outputDeviceChange')
### off('outputDeviceChange')<sup>10+</sup>
off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void
......@@ -2573,14 +2486,12 @@ Unsubscribes from playback device changes.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------ |
| type | string | Yes | Event type. The value is fixed at **'outputDeviceChange'**. |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.<br>If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.<br>If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
**Error codes**
......@@ -2606,8 +2517,6 @@ Unsubscribes from custom control command changes.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2631,7 +2540,7 @@ session.off('commonCommand');
## AVSessionController
## AVSessionController<sup>10+</sup>
An AV session controller is created by calling [avSession.createController](#avsessioncreatecontroller). Through the AV session controller, you can query the session ID, send commands and events to a session, and obtain session metadata and playback state information.
......@@ -2639,9 +2548,6 @@ An AV session controller is created by calling [avSession.createController](#avs
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Readable| Writable| Description |
| :-------- | :----- | :--- | :--- | :-------------------------------------- |
| sessionId | string | Yes | No | Unique session ID of the **AVSessionController** object.|
......@@ -2657,7 +2563,7 @@ await avSession.createController(session.sessionId).then((controller) => {
});
```
### getAVPlaybackState
### getAVPlaybackState<sup>10+</sup>
getAVPlaybackState(): Promise\<AVPlaybackState>
......@@ -2665,13 +2571,11 @@ Obtains the information related to the playback state. This API uses a promise t
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| --------------------------------------------- | --------------------------- |
| Promise<[AVPlaybackState](#avplaybackstate)\> | Promise used to return the **AVPlaybackState** object.|
| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise used to return the **AVPlaybackState** object.|
**Error codes**
......@@ -2692,7 +2596,7 @@ controller.getAVPlaybackState().then((playbackState) => {
});
```
### getAVPlaybackState
### getAVPlaybackState<sup>10+</sup>
getAVPlaybackState(callback: AsyncCallback\<AVPlaybackState>): void
......@@ -2700,13 +2604,11 @@ Obtains the information related to the playback state. This API uses an asynchro
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback<[AVPlaybackState](#avplaybackstate)\> | Yes | Callback used to return the **AVPlaybackState** object.|
| callback | AsyncCallback<[AVPlaybackState](#avplaybackstate10)\> | Yes | Callback used to return the **AVPlaybackState** object.|
**Error codes**
......@@ -2737,8 +2639,6 @@ Obtains the information related to the items in the queue. This API uses a promi
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -2772,8 +2672,6 @@ Obtains the information related to the items in the playlist. This API uses an a
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2809,8 +2707,6 @@ Obtains the name of the playlist. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -2844,8 +2740,6 @@ Obtains the name of the playlist. This API uses an asynchronous callback to retu
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2881,8 +2775,6 @@ Sends the ID of an item in the playlist to the session for processing. The sessi
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2923,8 +2815,6 @@ Sends the ID of an item in the playlist to the session for processing. The sessi
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -2954,7 +2844,7 @@ controller.skipToQueueItem(queueItemId, function (err) {
});
```
### getAVMetadata
### getAVMetadata<sup>10+</sup>
getAVMetadata(): Promise\<AVMetadata>
......@@ -2962,13 +2852,11 @@ Obtains the session metadata. This API uses a promise to return the result.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| ----------------------------------- | ----------------------------- |
| Promise<[AVMetadata](#avmetadata)\> | Promise used to return the metadata obtained.|
| Promise<[AVMetadata](#avmetadata10)\> | Promise used to return the metadata obtained.|
**Error codes**
......@@ -2989,7 +2877,7 @@ controller.getAVMetadata().then((metadata) => {
});
```
### getAVMetadata
### getAVMetadata<sup>10+</sup>
getAVMetadata(callback: AsyncCallback\<AVMetadata>): void
......@@ -2997,13 +2885,11 @@ Obtains the session metadata. This API uses an asynchronous callback to return t
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback<[AVMetadata](#avmetadata)\> | Yes | Callback used to return the metadata obtained.|
| callback | AsyncCallback<[AVMetadata](#avmetadata10)\> | Yes | Callback used to return the metadata obtained.|
**Error codes**
......@@ -3026,7 +2912,7 @@ controller.getAVMetadata(function (err, metadata) {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(): Promise\<OutputDeviceInfo>
......@@ -3034,13 +2920,11 @@ Obtains the output device information. This API uses a promise to return the res
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| ----------------------------------------------- | --------------------------------- |
| Promise<[OutputDeviceInfo](#outputdeviceinfo)\> | Promise used to return the information obtained.|
| Promise<[OutputDeviceInfo](#outputdeviceinfo10)\> | Promise used to return the information obtained.|
**Error codes**
......@@ -3060,7 +2944,7 @@ controller.getOutputDevice().then((deviceInfo) => {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void
......@@ -3068,13 +2952,11 @@ Obtains the output device information. This API uses an asynchronous callback to
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | Yes | Callback used to return the information obtained.|
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo10)\> | Yes | Callback used to return the information obtained.|
**Error codes**
......@@ -3105,8 +2987,6 @@ Obtains the custom media packet set by the provider. This API uses a promise to
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -3138,8 +3018,6 @@ Obtains the custom media packet set by the provider. This API uses an asynchrono
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3183,7 +3061,7 @@ controller.getExtras(function (err, extras) {
});
```
### sendAVKeyEvent
### sendAVKeyEvent<sup>10+</sup>
sendAVKeyEvent(event: KeyEvent): Promise\<void>
......@@ -3191,8 +3069,6 @@ Sends a key event to the session corresponding to this controller. This API uses
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name| Type | Mandatory| Description |
......@@ -3230,7 +3106,7 @@ controller.sendAVKeyEvent(event).then(() => {
});
```
### sendAVKeyEvent
### sendAVKeyEvent<sup>10+</sup>
sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void
......@@ -3238,8 +3114,6 @@ Sends a key event to the session corresponding to this controller. This API uses
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3274,7 +3148,7 @@ controller.sendAVKeyEvent(event, function (err) {
});
```
### getLaunchAbility
### getLaunchAbility<sup>10+</sup>
getLaunchAbility(): Promise\<WantAgent>
......@@ -3282,13 +3156,11 @@ Obtains the **WantAgent** object saved by the application in the session. This A
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| Promise<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Promise used to return the object saved by calling [setLaunchAbility](#setlaunchability). The object includes the application attribute, such as the bundle name, ability name, and device ID.|
| Promise<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Promise used to return the object saved by calling [setLaunchAbility](#setlaunchability10). The object includes the application attribute, such as the bundle name, ability name, and device ID.|
**Error codes**
......@@ -3312,7 +3184,7 @@ controller.getLaunchAbility().then((agent) => {
});
```
### getLaunchAbility
### getLaunchAbility<sup>10+</sup>
getLaunchAbility(callback: AsyncCallback\<WantAgent>): void
......@@ -3320,13 +3192,11 @@ Obtains the **WantAgent** object saved by the application in the session. This A
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Yes | Callback used to return the object saved by calling [setLaunchAbility](#setlaunchability). The object includes the application attribute, such as the bundle name, ability name, and device ID.|
| callback | AsyncCallback<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Yes | Callback used to return the object saved by calling [setLaunchAbility](#setlaunchability10). The object includes the application attribute, such as the bundle name, ability name, and device ID.|
**Error codes**
......@@ -3352,7 +3222,7 @@ controller.getLaunchAbility(function (err, agent) {
});
```
### getRealPlaybackPositionSync
### getRealPlaybackPositionSync<sup>10+</sup>
getRealPlaybackPositionSync(): number
......@@ -3360,8 +3230,6 @@ Obtains the playback position.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -3383,7 +3251,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
let time = controller.getRealPlaybackPositionSync();
```
### isActive
### isActive<sup>10+</sup>
isActive(): Promise\<boolean>
......@@ -3391,8 +3259,6 @@ Checks whether the session is activated. This API uses a promise to return the r
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -3419,7 +3285,7 @@ controller.isActive().then((isActive) => {
});
```
### isActive
### isActive<sup>10+</sup>
isActive(callback: AsyncCallback\<boolean>): void
......@@ -3427,8 +3293,6 @@ Checks whether the session is activated. This API uses an asynchronous callback
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3457,7 +3321,7 @@ controller.isActive(function (err, isActive) {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(): Promise\<void>
......@@ -3465,8 +3329,6 @@ Destroys this controller. A controller can no longer be used after being destroy
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
......@@ -3492,7 +3354,7 @@ controller.destroy().then(() => {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(callback: AsyncCallback\<void>): void
......@@ -3500,8 +3362,6 @@ Destroys this controller. A controller can no longer be used after being destroy
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3529,7 +3389,7 @@ controller.destroy(function (err) {
});
```
### getValidCommands
### getValidCommands<sup>10+</sup>
getValidCommands(): Promise\<Array\<AVControlCommandType>>
......@@ -3537,13 +3397,11 @@ Obtains valid commands supported by the session. This API uses a promise to retu
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Return value**
| Type | Description |
| ------------------------------------------------------------ | --------------------------------- |
| Promise<Array<[AVControlCommandType](#avcontrolcommandtype)\>\> | Promise used to return a set of valid commands.|
| Promise<Array<[AVControlCommandType](#avcontrolcommandtype10)\>\> | Promise used to return a set of valid commands.|
**Error codes**
......@@ -3565,7 +3423,7 @@ controller.getValidCommands.then((validCommands) => {
});
```
### getValidCommands
### getValidCommands<sup>10+</sup>
getValidCommands(callback: AsyncCallback\<Array\<AVControlCommandType>>): void
......@@ -3573,13 +3431,11 @@ Obtains valid commands supported by the session. This API uses an asynchronous c
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
| callback | AsyncCallback\<Array\<[AVControlCommandType](#avcontrolcommandtype)\>\> | Yes | Callback used to return a set of valid commands.|
| callback | AsyncCallback\<Array\<[AVControlCommandType](#avcontrolcommandtype10)\>\> | Yes | Callback used to return a set of valid commands.|
**Error codes**
......@@ -3603,7 +3459,7 @@ controller.getValidCommands(function (err, validCommands) {
});
```
### sendControlCommand
### sendControlCommand<sup>10+</sup>
sendControlCommand(command: AVControlCommand): Promise\<void>
......@@ -3611,17 +3467,15 @@ Sends a control command to the session through the controller. This API uses a p
> **NOTE**
>
> Before using **sendControlCommand**, the controller must ensure that the AVSession has registered with the corresponding listener. For details about how to register the listener, see [Registering AVSession Listeners](#onplaypausestopplaynextplaypreviousfastforwardrewind).
> Before using **sendControlCommand**, the controller must ensure that the AVSession has registered with the corresponding listener. For details about how to register the listener, see [Registering AVSession Listeners](#onplaypausestopplaynextplaypreviousfastforwardrewind10).
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------- | ---- | ------------------------------ |
| command | [AVControlCommand](#avcontrolcommand) | Yes | Command to send.|
| command | [AVControlCommand](#avcontrolcommand10) | Yes | Command to send.|
**Return value**
......@@ -3663,7 +3517,7 @@ controller.sendControlCommand(avCommand).then(() => {
});
```
### sendControlCommand
### sendControlCommand<sup>10+</sup>
sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): void
......@@ -3671,17 +3525,15 @@ Sends a control command to the session through the controller. This API uses an
> **NOTE**
>
> Before using **sendControlCommand**, the controller must ensure that the AVSession has registered with the corresponding listener. For details about how to register the listener, see [Registering AVSession Listeners](#onplaypausestopplaynextplaypreviousfastforwardrewind).
> Before using **sendControlCommand**, the controller must ensure that the AVSession has registered with the corresponding listener. For details about how to register the listener, see [Registering AVSession Listeners](#onplaypausestopplaynextplaypreviousfastforwardrewind10).
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------- | ---- | ------------------------------ |
| command | [AVControlCommand](#avcontrolcommand) | Yes | Command to send.|
| command | [AVControlCommand](#avcontrolcommand10) | Yes | Command to send.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the command is sent, **err** is **undefined**; otherwise, **err** is an error object. |
**Error codes**
......@@ -3728,8 +3580,6 @@ Sends a custom control command to the session through the controller. This API u
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3780,8 +3630,6 @@ Sends a custom control command to the session through the controller. This API u
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3795,6 +3643,7 @@ Sends a custom control command to the session through the controller. This API u
> The **args** parameter supports the following data types: string, number, Boolean, object, array, and file descriptor. For details, see [@ohos.app.ability.Want(Want)](./js-apis-app-ability-want.md).
**Error codes**
For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md).
| ID| Error Message|
......@@ -3820,7 +3669,7 @@ controller.sendCommonCommand(commandName, args, (err) => {
})
```
### on('metadataChange')
### on('metadataChange')<sup>10+</sup>
on(type: 'metadataChange', filter: Array\<keyof AVMetadata> | 'all', callback: (data: AVMetadata) => void)
......@@ -3828,15 +3677,13 @@ Subscribes to the metadata change event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The event **'metadataChange'** is reported when the session metadata changes.|
| filter | Array\<keyof&nbsp;[AVMetadata](#avmetadata)\>&nbsp;&#124;&nbsp;'all' | Yes | The value **'all'** indicates that any metadata field change will trigger the event, and **Array<keyof [AVMetadata](#avmetadata)\>** indicates that only changes to the listed metadata field will trigger the event.|
| callback | (data: [AVMetadata](#avmetadata)) => void | Yes | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata. |
| filter | Array\<keyof&nbsp;[AVMetadata](#avmetadata10)\>&nbsp;&#124;&nbsp;'all' | Yes | The value **'all'** indicates that any metadata field change will trigger the event, and **Array<keyof&nbsp;[AVMetadata](#avmetadata10)\>** indicates that only changes to the listed metadata field will trigger the event.|
| callback | (data: [AVMetadata](#avmetadata10)) => void | Yes | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata. |
**Error codes**
......@@ -3860,7 +3707,7 @@ controller.on('metadataChange', metaFilter, (metadata) => {
});
```
### on('playbackStateChange')
### on('playbackStateChange')<sup>10+</sup>
on(type: 'playbackStateChange', filter: Array\<keyof AVPlaybackState> | 'all', callback: (state: AVPlaybackState) => void)
......@@ -3868,15 +3715,13 @@ Subscribes to the playback state change event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The event **'playbackStateChange'** is reported when the playback state changes.|
| filter | Array\<keyof&nbsp;[AVPlaybackState](#avplaybackstate)\>&nbsp;&#124;&nbsp;'all' | Yes | The value **'all'** indicates that any playback state field change will trigger the event, and **Array<keyof [AVPlaybackState](#avplaybackstate)\>** indicates that only changes to the listed playback state field will trigger the event.|
| callback | (state: [AVPlaybackState](#avplaybackstate)) => void | Yes | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state. |
| filter | Array\<keyof&nbsp;[AVPlaybackState](#avplaybackstate10)\>&nbsp;&#124;&nbsp;'all' | Yes | The value **'all'** indicates that any playback state field change will trigger the event, and **Array<keyof&nbsp;[AVPlaybackState](#avplaybackstate10)\>** indicates that only changes to the listed playback state field will trigger the event.|
| callback | (state: [AVPlaybackState](#avplaybackstate10)) => void | Yes | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state. |
**Error codes**
......@@ -3908,8 +3753,6 @@ Subscribes to session event changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3942,8 +3785,6 @@ Subscribes to playlist item changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -3976,8 +3817,6 @@ Subscribes to playlist name changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4010,8 +3849,6 @@ Subscribes to custom media packet changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4037,7 +3874,7 @@ controller.on('extrasChange', (extras) => {
});
```
### on('sessionDestroy')
### on('sessionDestroy')<sup>10+</sup>
on(type: 'sessionDestroy', callback: () => void)
......@@ -4045,8 +3882,6 @@ Subscribes to the session destruction event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4071,7 +3906,7 @@ controller.on('sessionDestroy', () => {
});
```
### on('activeStateChange')
### on('activeStateChange')<sup>10+</sup>
on(type: 'activeStateChange', callback: (isActive: boolean) => void)
......@@ -4079,8 +3914,6 @@ Subscribes to the session activation state change event.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4105,7 +3938,7 @@ controller.on('activeStateChange', (isActive) => {
});
```
### on('validCommandChange')
### on('validCommandChange')<sup>10+</sup>
on(type: 'validCommandChange', callback: (commands: Array\<AVControlCommandType>) => void)
......@@ -4113,14 +3946,12 @@ Subscribes to valid command changes.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The event **'validCommandChange'** is reported when the valid commands supported by the session changes.|
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | Yes | Callback used for subscription. The **commands** parameter in the callback is a set of valid commands. |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype10)\>) => void | Yes | Callback used for subscription. The **commands** parameter in the callback is a set of valid commands. |
**Error codes**
......@@ -4140,7 +3971,7 @@ controller.on('validCommandChange', (validCommands) => {
});
```
### on('outputDeviceChange')
### on('outputDeviceChange')<sup>10+</sup>
on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void
......@@ -4148,14 +3979,12 @@ Subscribes to output device changes.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Event type. The event **'outputDeviceChange'** is reported when the output device changes.|
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | Yes | Callback used for subscription. The **device** parameter in the callback indicates the output device information. |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | Yes | Callback used for subscription. The **device** parameter in the callback indicates the output device information. |
**Error codes**
......@@ -4174,7 +4003,7 @@ controller.on('outputDeviceChange', (device) => {
});
```
### off('metadataChange')
### off('metadataChange')<sup>10+</sup>
off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
......@@ -4182,14 +4011,12 @@ Unsubscribes from metadata changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ------------------------------------------------------ |
| type | string | Yes | Event type. The event **'metadataChange'** is reported when the session metadata changes. |
| callback | (data: [AVMetadata](#avmetadata)) => void | No | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
| callback | (data: [AVMetadata](#avmetadata10)) => void | No | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
**Error codes**
......@@ -4205,7 +4032,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
controller.off('metadataChange');
```
### off('playbackStateChange')
### off('playbackStateChange')<sup>10+</sup>
off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void)
......@@ -4213,14 +4040,12 @@ Unsubscribes from playback state changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- |
| type | string | Yes | Event type. The event **'playbackStateChange'** is reported when the playback state changes. |
| callback | (state: [AVPlaybackState](#avplaybackstate)) => void | No | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
| callback | (state: [AVPlaybackState](#avplaybackstate10)) => void | No | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
**Error codes**
......@@ -4244,8 +4069,6 @@ Unsubscribes from session event changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4275,8 +4098,6 @@ Unsubscribes from playback item changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4306,8 +4127,6 @@ Unsubscribes from playlist name changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4337,8 +4156,6 @@ Unsubscribes from custom media packet changes. This API is called by the control
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4362,7 +4179,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
controller.off('extrasChange');
```
### off('sessionDestroy')
### off('sessionDestroy')<sup>10+</sup>
off(type: 'sessionDestroy', callback?: () => void)
......@@ -4370,8 +4187,6 @@ Unsubscribes from the session destruction event. This API is called by the contr
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4393,7 +4208,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
controller.off('sessionDestroy');
```
### off('activeStateChange')
### off('activeStateChange')<sup>10+</sup>
off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
......@@ -4401,8 +4216,6 @@ Unsubscribes from session activation state changes. This API is called by the co
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
......@@ -4424,7 +4237,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
controller.off('activeStateChange');
```
### off('validCommandChange')
### off('validCommandChange')<sup>10+</sup>
off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void)
......@@ -4432,14 +4245,12 @@ Unsubscribes from valid command changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------------------- |
| type | string | Yes | Event type. The event **'validCommandChange'** is reported when the supported commands change. |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | No | Callback used for unsubscription. The **commands** parameter in the callback is a set of valid commands.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype10)\>) => void | No | Callback used for unsubscription. The **commands** parameter in the callback is a set of valid commands.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
**Error codes**
......@@ -4455,7 +4266,7 @@ For details about the error codes, see [AVSession Management Error Codes](../err
controller.off('validCommandChange');
```
### off('outputDeviceChange')
### off('outputDeviceChange')<sup>10+</sup>
off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void
......@@ -4463,14 +4274,12 @@ Unsubscribes from output device changes. This API is called by the controller.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------ |
| type | string | Yes | Event type. The event **'outputDeviceChange'** is reported when the output device changes. |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.<br>The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. |
**Error codes**
......@@ -4502,13 +4311,11 @@ Describes the information about a session token.
| pid | number | Yes | Process ID of the session.|
| uid | number | Yes | User ID. |
## AVSessionType
## AVSessionType<sup>10+<sup>
Enumerates the session types supported by the session.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Description|
| ----- | ------ | ---- |
| audio | string | Audio session.|
......@@ -4525,21 +4332,19 @@ Declares the session descriptor.
| Name | Type | Readable| Writable| Description |
| ------------ | ------------------------------------------------------------ | ---- | --------------------------------------------------- | --------------------------------------------------- |
| sessionId | string | Yes | No| Session ID. |
| type | [AVSessionType](#avsessiontype) | Yes | No | Session type. |
| type | [AVSessionType](#avsessiontype10) | Yes | No | Session type. |
| sessionTag | string | Yes | No | Custom session name. |
| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Information about the application to which the session belongs, including the bundle name and ability name.|
| isActive | boolean | Yes | No | Whether the session is activated. |
| isTopSession | boolean | Yes | No | Whether the session is the top session. |
| outputDevice | [OutputDeviceInfo](#outputdeviceinfo) | Yes | No | Information about the output device. |
| outputDevice | [OutputDeviceInfo](#outputdeviceinfo10) | Yes | No | Information about the output device. |
## AVControlCommandType
## AVControlCommandType<sup>10+</sup>
Enumerates the commands that can be sent to a session.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Description |
| -------------- | ------ | ------------ |
| play | string | Play the media. |
......@@ -4554,27 +4359,23 @@ Enumerates the commands that can be sent to a session.
| setLoopMode | string | Set the loop mode.|
| toggleFavorite | string | Favorite the media asset. |
## AVControlCommand
## AVControlCommand<sup>10+</sup>
Describes the command that can be sent to the session.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Mandatory| Description |
| --------- | ------------------------------------------------- | ---- | -------------- |
| command | [AVControlCommandType](#avcontrolcommandtype) | Yes | Command. |
| parameter | [LoopMode](#loopmode) &#124; string &#124; number | No | Parameters carried in the command.|
| command | [AVControlCommandType](#avcontrolcommandtype10) | Yes | Command. |
| parameter | [LoopMode](#loopmode10) &#124; string &#124; number | No | Parameters carried in the command.|
## AVMetadata
## AVMetadata<sup>10+</sup>
Describes the media metadata.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Mandatory| Description |
| --------------- |-------------------------| ---- |---------------------------------------------------------------------|
| assetId | string | Yes | Media ID. |
......@@ -4621,60 +4422,52 @@ Describes the attributes of an item in the playlist.
| itemId | number | Yes | ID of an item in the playlist. |
| description | [AVMediaDescription](#avmediadescription10) | Yes | Media metadata of the item in the playlist. |
## AVPlaybackState
## AVPlaybackState<sup>10+</sup>
Describes the information related to the media playback state.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Mandatory| Description |
| ------------ | ------------------------------------- | ---- | ------- |
| state | [PlaybackState](#playbackstate) | No | Playback state.|
| speed | number | No | Playback speed.|
| position | [PlaybackPosition](#playbackposition) | No | Playback position.|
| bufferedTime | number | No | Buffered time.|
| loopMode | [LoopMode](#loopmode) | No | Loop mode.|
| loopMode | [LoopMode](#loopmode10) | No | Loop mode.|
| isFavorite | boolean | No | Whether the media asset is favorited.|
| activeItemId<sup>10+</sup> | number | No | ID of the item that is being played.|
| extras<sup>10+</sup> | {[key: string]: Object} | No | Custom media data.|
## PlaybackPosition
## PlaybackPosition<sup>10+</sup>
Describes the information related to the playback position.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------ |
| elapsedTime | number | Yes | Elapsed time, in ms.|
| updateTime | number | Yes | Updated time, in ms.|
## OutputDeviceInfo
## OutputDeviceInfo<sup>10+</sup>
Describes the information related to the output device.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Type | Mandatory| Description |
| ---------- | -------------- | ---- | ---------------------- |
| isRemote | boolean | Yes | Whether the device is connected. |
| audioDeviceId | Array<number\> | Yes | IDs of output devices. |
| deviceName | Array<string\> | Yes | Names of output devices. |
## PlaybackState
## PlaybackState<sup>10+</sup>
Enumerates the media playback states.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Value | Description |
| --------------------------- | ---- | ----------- |
| PLAYBACK_STATE_INITIAL | 0 | Initial. |
......@@ -4686,14 +4479,12 @@ Enumerates the media playback states.
| PLAYBACK_STATE_STOP | 6 | Stopped. |
## LoopMode
## LoopMode<sup>10+</sup>
Enumerates the loop modes of media playback.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Value | Description |
| ------------------ | ---- | -------- |
| LOOP_MODE_SEQUENCE | 0 | Sequential playback.|
......@@ -4701,14 +4492,12 @@ Enumerates the loop modes of media playback.
| LOOP_MODE_LIST | 2 | Playlist loop.|
| LOOP_MODE_SHUFFLE | 3 | Shuffle.|
## AVSessionErrorCode
## AVSessionErrorCode<sup>10+</sup>
Enumerates the error codes used in the media session.
**System capability**: SystemCapability.Multimedia.AVSession.Core
**System API**: This is a system API.
| Name | Value | Description |
| ------------------------------ | ------- | ------------------------------- |
| ERR_CODE_SERVICE_EXCEPTION | 6600101 | Session service exception. |
......@@ -4719,4 +4508,4 @@ Enumerates the error codes used in the media session.
| ERR_CODE_SESSION_INACTIVE | 6600106 | The session is not activated. |
| ERR_CODE_MESSAGE_OVERLOAD | 6600107 | Too many commands or events. |
<!--no_check-->
\ No newline at end of file
<!--no_check-->
......@@ -26,7 +26,7 @@
- [HAR](quick-start/har-package.md)
- HSP
- [In-Application HSP Development](quick-start/in-app-hsp.md)
- [Inter-Application HSP Development (for System Applications Only)](quick-start/cross-app-hsp.md)
- [Inter-Application HSP Development](quick-start/cross-app-hsp.md)
- Quick Fix
- [Quick Fix Overview](quick-start/quickfix-principles.md)
- [CLI-based Quick Fix Development](quick-start/quickfix-debug.md)
......@@ -98,7 +98,7 @@
- [AccessibilityExtensionAbility](application-models/accessibilityextensionability.md)
- [EnterpriseAdminExtensionAbility](application-models/enterprise-extensionAbility.md)
- [InputMethodExtensionAbility](application-models/inputmethodextentionability.md)
- [WindowExtensionAbility](application-models/windowextensionability.md)
- [WindowExtensionAbility (for System Applications Only)](application-models/windowextensionability.md)
- Service Widget Development in Stage Model
- [Service Widget Overview](application-models/service-widget-overview.md)
- Developing an ArkTS Widget
......@@ -150,7 +150,7 @@
- [Subscribing to Common Events in Static Mode (for System Applications Only)](application-models/common-event-static-subscription.md)
- [Unsubscribing from Common Events](application-models/common-event-unsubscription.md)
- [Publishing Common Events](application-models/common-event-publish.md)
- [Removing Sticky Common Events](application-models/common-event-remove-sticky.md)
- [Removing Sticky Common Events (for System Applications Only)](application-models/common-event-remove-sticky.md)
- [Background Services](application-models/background-services.md)
- Thread Model
- [Thread Model Overview](application-models/thread-model-stage.md)
......@@ -434,7 +434,7 @@
- [Developing Audio Call](media/audio-call-development.md)
- [Video Playback](media/video-playback.md)
- [Video Recording](media/video-recording.md)
- AVSession (for System Applications Only)
- AVSession
- [AVSession Overview](media/avsession-overview.md)
- Local AVSession
- [Local AVSession Overview](media/local-avsession-overview.md)
......@@ -443,7 +443,7 @@
- Distributed AVSession
- [Distributed AVSession Overview](media/distributed-avsession-overview.md)
- [Using Distributed AVSession](media/using-distributed-avsession.md)
- Camera (for System Applications Only)
- Camera
- [Camera Overview](media/camera-overview.md)
- Camera Development
- [Camera Development Preparations](media/camera-preparation.md)
......@@ -542,8 +542,8 @@
- Selecting and Saving User Files (FilePicker)
- [Selecting User Files](file-management/select-user-file.md)
- [Saving User Files](file-management/save-user-file.md)
- [Developing a FileManager Application (Available Only for System Applications)](file-management/dev-user-file-manager.md)
- [Managing External Storage Devices (Available Only for System Applications)](file-management/manage-external-storage.md)
- [Developing a FileManager Application (for System Applications Only)](file-management/dev-user-file-manager.md)
- [Managing External Storage Devices (for System Applications Only)](file-management/manage-external-storage.md)
- Distributed File System
- [Distributed File System Overview](file-management/distributed-fs-overview.md)
- [Setting the Security Level of a Distributed File](file-management/set-security-label.md)
......@@ -603,7 +603,6 @@
- [wukong User Guide](application-test/wukong-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
- Native APIs
- [Introduction to Native APIs](napi/introduction.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md)
- [Drawing Development](napi/drawing-guidelines.md)
- [Raw File Development](napi/rawfile-guidelines.md)
......@@ -669,12 +668,8 @@
- [Touch Target](reference/arkui-ts/ts-universal-attributes-touch-target.md)
- [Polymorphic Style](reference/arkui-ts/ts-universal-attributes-polymorphic-style.md)
- [Hit Test Control](reference/arkui-ts/ts-universal-attributes-hit-test-behavior.md)
- [Background Blur](reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md)
- [restoreId](reference/arkui-ts/ts-universal-attributes-restoreId.md)
- [Foreground Color](reference/arkui-ts/ts-universal-attributes-foreground-color.md)
- [Spherical Effect](reference/arkui-ts/ts-universal-attributes-sphericalEffect.md)
- [Light Up Effect](reference/arkui-ts/ts-universal-attributes-lightUpEffect.md)
- [Pixel Stretch Effect](reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md)
- [Text Style](reference/arkui-ts/ts-universal-attributes-text-style.md)
- Gesture Processing
- [Gesture Binding Methods](reference/arkui-ts/ts-gesture-settings.md)
......@@ -780,7 +775,6 @@
- [ImageData](reference/arkui-ts/ts-components-canvas-imagedata.md)
- [OffscreenCanvasRenderingConxt2D](reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md)
- [Path2D](reference/arkui-ts/ts-components-canvas-path2d.md)
- [Lottie](reference/arkui-ts/ts-components-canvas-lottie.md)
- Animation
- [AnimatorProperty](reference/arkui-ts/ts-animatorproperty.md)
- [Explicit Animation](reference/arkui-ts/ts-explicit-animation.md)
......@@ -1123,9 +1117,12 @@
- [NotificationTemplate](reference/apis/js-apis-inner-notification-notificationTemplate.md)
- [NotificationUserInput](reference/apis/js-apis-inner-notification-notificationUserInput.md)
- Common Events
- [Common Events of the Ability Subsystem](reference/apis/common_event/commonEvent-ability.md)
- [Common Events of the Bundle Management Subsystem](reference/apis/common_event/commonEvent-bundleManager.md)
- [Common Events of the Notification Service](reference/apis/common_event/commonEvent-ans.md)
- [Common Events of the Resource Scheduler Subsystem](reference/apis/common_event/commonEvent-resourceschedule.md)
- [Common Events of the Telephony Subsystem](reference/apis/common_event/commonEvent-telephony.md)
- [Common Events of the USB Subsystem](reference/apis/common_event/commonEvent-usb.md)
- Bundle Management
- [@ohos.bundle.appControl(appControl)](reference/apis/js-apis-appControl.md)
- [@ohos.bundle.bundleManager (bundleManager)](reference/apis/js-apis-bundleManager.md)
......@@ -1212,6 +1209,7 @@
- security
- [PermissionRequestResult](reference/apis/js-apis-permissionrequestresult.md)
- Data Management
- [@ohos.data.cloudData (Device-Cloud Synergy)](reference/apis/js-apis-data-cloudData.md)
- [@ohos.data.dataAbility (DataAbility Predicates)](reference/apis/js-apis-data-ability.md)
- [@ohos.data.dataShare (DataShare)](reference/apis/js-apis-data-dataShare.md)
- [@ohos.data.dataSharePredicates (DataShare Predicates)](reference/apis/js-apis-data-dataSharePredicates.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册