“2c4fb585dbe4b5cdd06ed5b77b62dd455fc24e7d”上不存在“python/git@gitcode.net:s920243400/PaddleDetection.git”
提交 730637f4 编写于 作者: L liyuhang 提交者: Li Yuhang

fixed 401bf794 from https://gitee.com/imyuhang/docs/pulls/18965

Sync docs
Signed-off-by: Nliyuhang <liyuhang24@huawei.com>
Change-Id: I6b5b44a62c7f27e7e8206ecfddf16b6d3a46b353
Signed-off-by: Nliyuhang <liyuhang24@huawei.com>
上级 01b35acb
......@@ -28,7 +28,7 @@
- [开发音频通话功能](audio-call-development.md)
- [视频播放](video-playback.md)
- [视频录制](video-recording.md)
- 媒体会话(仅对系统应用开放)
- 媒体会话
- [媒体会话概述](avsession-overview.md)
- 本地媒体会话
- [本地媒体会话概述](local-avsession-overview.md)
......
......@@ -26,11 +26,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
| -------- | -------- |
| getAllSessionDescriptors(callback: AsyncCallback&lt;Array&lt;Readonly&lt;AVSessionDescriptor&gt;&gt;&gt;): void | 获取系统中所有媒体会话的描述符。 |
| createController(sessionId: string, callback: AsyncCallback&lt;AVSessionController&gt;): void | 创建媒体会话控制器。 |
| getValidCommands(callback: AsyncCallback&lt;Array&lt;AVControlCommandType&gt;&gt;): void | 获取媒体会话支持的有效命令。<br/>音视频应用在接入媒体会话时监听的播控命令,即为媒体会话支持的有效命令,相关信息请参见[媒体会话提供方监听播控命令事件](using-avsession-developer.md)。 |
| getLaunchAbility(callback: AsyncCallback&lt;WantAgent&gt;): void | 获取媒体会话中配置的可被拉起的UIAbility。<br/>当用户在媒体会话控制方应用进行界面操作,例如点击了播控中心卡片后,可以拉起对应的应用。 |
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | 通过会话对应的AVSessionController向会话发送按键命令。 |
| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | 向置顶会话发送按键命令。 |
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | 通过会话对应的AVSessionController向会话发送播控命令。 |
| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | 向置顶会话发送按键命令。 |
| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | 向置顶会话发送播控命令。 |
| getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback\<Array\<Readonly\<AVSessionDescriptor>>>): void<sup>10+<sup> | 获取历史会话的描述符。 |
......@@ -38,15 +34,15 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
| 接口名 | 说明 |
| -------- | -------- |
| getAVPlaybackState(callback: AsyncCallback&lt;AVPlaybackState&gt;): void | 获取当前会话播放状态相关信息。 |
| getAVMetadata(callback: AsyncCallback&lt;AVMetadata&gt;): void | 获取会话元数据。 |
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void | 获取播放设备信息。 |
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | 发送按键事件到会话。|
| getLaunchAbility(callback: AsyncCallback&lt;WantAgent&gt;): void | 获取应用在会话中保存的WantAgent对象。 |
| isActive(callback: AsyncCallback&lt;boolean&gt;): void | 判断会话是否被激活。 |
| destroy(callback: AsyncCallback&lt;void&gt;): void | 销毁当前控制器,销毁后当前控制器不再可用。 |
| getValidCommands(callback: AsyncCallback&lt;Array&lt;AVControlCommandType&gt;&gt;): void | 获取会话支持的有效命令。 |
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | 通过会话控制器发送命令到其对应的会话。 |
| getAVPlaybackState(callback: AsyncCallback&lt;AVPlaybackState&gt;): void<sup>10+<sup> | 获取当前会话播放状态相关信息。 |
| getAVMetadata(callback: AsyncCallback&lt;AVMetadata&gt;): void<sup>10+<sup> | 获取会话元数据。 |
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void<sup>10+<sup> | 获取播放设备信息。 |
| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 发送按键事件到会话。|
| getLaunchAbility(callback: AsyncCallback&lt;WantAgent&gt;): void<sup>10+<sup> | 获取应用在会话中保存的WantAgent对象。 |
| isActive(callback: AsyncCallback&lt;boolean&gt;): void<sup>10+<sup> | 判断会话是否被激活。 |
| destroy(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 销毁当前控制器,销毁后当前控制器不再可用。 |
| getValidCommands(callback: AsyncCallback&lt;Array&lt;AVControlCommandType&gt;&gt;): void<sup>10+<sup> | 获取会话支持的有效命令。 |
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 通过会话控制器发送命令到其对应的会话。 |
| sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 通过会话控制器发送自定义命令到其对应的会话。 |
| getAVQueueItems(callback: AsyncCallback&lt;Array&lt;AVQueueItem&gt;&gt;): void<sup>10+<sup> | 获取当前播放列表相关信息。 |
| getAVQueueTitle(callback: AsyncCallback&lt;string&gt;): void<sup>10+<sup> | 获取当前播放列表的名称。 |
......
......@@ -16,15 +16,15 @@
| 接口名 | 说明 |
| -------- | -------- |
| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback&lt;AVSession&gt;): void | 创建媒体会话。<br/>一个UIAbility只能存在一个媒体会话,重复创建会失败。 |
| setAVMetadata(data: AVMetadata, callback: AsyncCallback&lt;void&gt;): void | 设置媒体会话元数据。 |
| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback&lt;void&gt;): void | 设置媒体会话播放状态。 |
| setLaunchAbility(ability: WantAgent, callback: AsyncCallback&lt;void&gt;): void | 设置启动UIAbility。 |
| getController(callback: AsyncCallback&lt;AVSessionController&gt;): void | 获取当前会话自身控制器。 |
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void | 获取播放设备相关信息。 |
| activate(callback: AsyncCallback&lt;void&gt;): void | 激活媒体会话。 |
| deactivate(callback: AsyncCallback&lt;void&gt;): void | 禁用当前会话。 |
| destroy(callback: AsyncCallback&lt;void&gt;): void | 销毁媒体会话。 |
| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback&lt;AVSession&gt;): void<sup>10+<sup> | 创建媒体会话。<br/>一个UIAbility只能存在一个媒体会话,重复创建会失败。 |
| setAVMetadata(data: AVMetadata, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 设置媒体会话元数据。 |
| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 设置媒体会话播放状态。 |
| setLaunchAbility(ability: WantAgent, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 设置启动UIAbility。 |
| getController(callback: AsyncCallback&lt;AVSessionController&gt;): void<sup>10+<sup> | 获取当前会话自身控制器。 |
| getOutputDevice(callback: AsyncCallback&lt;OutputDeviceInfo&gt;): void<sup>10+<sup> | 获取播放设备相关信息。 |
| activate(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 激活媒体会话。 |
| deactivate(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 禁用当前会话。 |
| destroy(callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 销毁媒体会话。 |
| setAVQueueItems(items: Array&lt;AVQueueItem&gt;, callback: AsyncCallback&lt;void&gt;): void <sup>10+<sup> | 设置媒体播放列表。 |
| setAVQueueTitle(title: string, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 设置媒体播放列表名称。 |
| dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback&lt;void&gt;): void<sup>10+<sup> | 设置会话内自定义事件。 |
......
......@@ -4,22 +4,20 @@
该模块提供以下媒体会话相关的常用功能:
- [AVSession](#avsession) : 会话,可用于设置元数据、播放状态信息等操作。
- [AVSessionController](#avsessioncontroller): 会话控制器,可用于查看会话ID,完成对会话发送命令及事件,获取会话元数据、播放状态信息等操作。
- [AVSession](#avsession10) : 会话,可用于设置元数据、播放状态信息等操作。
- [AVSessionController](#avsessioncontroller10): 会话控制器,可用于查看会话ID,完成对会话发送命令及事件,获取会话元数据、播放状态信息等操作。
> **说明:**
>
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> 本模块的所有接口均为系统接口。
## 导入模块
```js
import avSession from '@ohos.multimedia.avsession';
```
## avSession.createAVSession
## avSession.createAVSession<sup>10+</sup>
createAVSession(context: Context, tag: string, type: AVSessionType): Promise\<AVSession>
......@@ -27,21 +25,19 @@ createAVSession(context: Context, tag: string, type: AVSessionType): Promise\<AV
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------------- | ---- | ------------------------------ |
| context| [Context](js-apis-inner-app-context.md) | 是| 应用上下文,提供获取应用程序环境信息的能力。 |
| tag | string | 是 | 会话的自定义名称。 |
| type | [AVSessionType](#avsessiontype) | 是 | 会话类型,当前支持音频和视频。 |
| type | [AVSessionType](#avsessiontype10) | 是 | 会话类型,当前支持音频和视频。 |
**返回值:**
| 类型 | 说明 |
| --------------------------------- | ------------------------------------------------------------ |
| Promise<[AVSession](#avsession)\> | Promise对象。回调返回会话实例对象,可用于获取会话ID,以及设置元数据、播放状态,发送按键事件等操作。|
| Promise<[AVSession](#avsession10)\> | Promise对象。回调返回会话实例对象,可用于获取会话ID,以及设置元数据、播放状态,发送按键事件等操作。|
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -67,7 +63,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
......@@ -75,16 +71,14 @@ createAVSession(context: Context, tag: string, type: AVSessionType, callback: As
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| context| [Context](js-apis-inner-app-context.md) | 是| 应用上下文,提供获取应用程序环境信息的能力。 |
| tag | string | 是 | 会话的自定义名称。 |
| type | [AVSessionType](#avsessiontype) | 是 | 会话类型,当前支持音频和视频。 |
| callback | AsyncCallback<[AVSession](#avsession)\> | 是 | 回调函数。回调返回会话实例对象,可用于获取会话ID,以及设置元数据、播放状态,发送按键事件等操作。 |
| type | [AVSessionType](#avsessiontype10) | 是 | 会话类型,当前支持音频和视频。 |
| callback | AsyncCallback<[AVSession](#avsession10)\> | 是 | 回调函数。回调返回会话实例对象,可用于获取会话ID,以及设置元数据、播放状态,发送按键事件等操作。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -309,7 +303,7 @@ createController(sessionId: string): Promise\<AVSessionController>
| 类型 | 说明 |
| ----------------------------------------------------- | ------------------------------------------------------------ |
| Promise<[AVSessionController](#avsessioncontroller)\> | Promise对象。返回会话控制器实例,可查看会话ID,<br>并完成对会话发送命令及事件,获取元数据、播放状态信息等操作。|
| Promise<[AVSessionController](#avsessioncontroller10)\> | Promise对象。返回会话控制器实例,可查看会话ID,<br>并完成对会话发送命令及事件,获取元数据、播放状态信息等操作。|
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -361,7 +355,7 @@ createController(sessionId: string, callback: AsyncCallback\<AVSessionController
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| sessionId | string | 是 | 会话ID。 |
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | 是 | 回调函数。返回会话控制器实例,可查看会话ID,<br>并完成对会话发送命令及事件,获取元数据、播放状态信息等操作。 |
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller10)\> | 是 | 回调函数。返回会话控制器实例,可查看会话ID,<br>并完成对会话发送命令及事件,获取元数据、播放状态信息等操作。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -760,7 +754,7 @@ sendSystemControlCommand(command: AVControlCommand): Promise\<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------- | ---- | ----------------------------------- |
| command | [AVControlCommand](#avcontrolcommand) | 是 | AVSession的相关命令和命令相关参数。 |
| command | [AVControlCommand](#avcontrolcommand10) | 是 | AVSession的相关命令和命令相关参数。 |
**返回值:**
......@@ -819,7 +813,7 @@ sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback\<voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------------- |
| command | [AVControlCommand](#avcontrolcommand) | 是 | AVSession的相关命令和命令相关参数。 |
| command | [AVControlCommand](#avcontrolcommand10) | 是 | AVSession的相关命令和命令相关参数。 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
**错误码:**
......@@ -859,17 +853,14 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
});
```
## AVSession
## AVSession<sup>10+</sup>
调用[avSession.createAVSession](#avsessioncreateavsession)后,返回会话的实例,可以获得会话ID,完成设置元数据,播放状态信息等操作。
调用[avSession.createAVSession](#avsessioncreateavsession10)后,返回会话的实例,可以获得会话ID,完成设置元数据,播放状态信息等操作。
### 属性
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 可读 | 可写 | 说明 |
| :-------- | :----- | :--- | :--- | :---------------------------- |
| sessionId | string | 是 | 否 | AVSession对象唯一的会话标识。 |
......@@ -880,7 +871,7 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
let sessionId = session.sessionId;
```
### setAVMetadata
### setAVMetadata<sup>10+</sup>
setAVMetadata(data: AVMetadata): Promise\<void>
......@@ -888,13 +879,11 @@ setAVMetadata(data: AVMetadata): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------------------- | ---- | ------------ |
| data | [AVMetadata](#avmetadata) | 是 | 会话元数据。 |
| data | [AVMetadata](#avmetadata10) | 是 | 会话元数据。 |
**返回值:**
......@@ -936,7 +925,7 @@ session.setAVMetadata(metadata).then(() => {
});
```
### setAVMetadata
### setAVMetadata<sup>10+</sup>
setAVMetadata(data: AVMetadata, callback: AsyncCallback\<void>): void
......@@ -944,13 +933,11 @@ setAVMetadata(data: AVMetadata, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------- |
| data | [AVMetadata](#avmetadata) | 是 | 会话元数据。 |
| data | [AVMetadata](#avmetadata10) | 是 | 会话元数据。 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当元数据设置成功,err为undefined,否则返回错误对象。 |
**错误码:**
......@@ -989,7 +976,7 @@ session.setAVMetadata(metadata, function (err) {
});
```
### setAVPlaybackState
### setAVPlaybackState<sup>10+</sup>
setAVPlaybackState(state: AVPlaybackState): Promise\<void>
......@@ -997,13 +984,11 @@ setAVPlaybackState(state: AVPlaybackState): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ----------------------------------- | ---- | ---------------------------------------------- |
| data | [AVPlaybackState](#avplaybackstate) | 是 | 会话播放状态,包括状态、倍数、循环模式等信息。 |
| data | [AVPlaybackState](#avplaybackstate10) | 是 | 会话播放状态,包括状态、倍数、循环模式等信息。 |
**返回值:**
......@@ -1037,7 +1022,7 @@ session.setAVPlaybackState(playbackState).then(() => {
});
```
### setAVPlaybackState
### setAVPlaybackState<sup>10+</sup>
setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\<void>): void
......@@ -1045,13 +1030,11 @@ setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------- | ---- | ---------------------------------------------- |
| data | [AVPlaybackState](#avplaybackstate) | 是 | 会话播放状态,包括状态、倍数、循环模式等信息。 |
| data | [AVPlaybackState](#avplaybackstate10) | 是 | 会话播放状态,包括状态、倍数、循环模式等信息。 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当播放状态设置成功,err为undefined,否则返回错误对象。 |
**错误码:**
......@@ -1090,8 +1073,6 @@ setAVQueueItems(items: Array\<AVQueueItem>): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1159,8 +1140,6 @@ setAVQueueItems(items: Array\<AVQueueItem>, callback: AsyncCallback\<void>): voi
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1225,8 +1204,6 @@ setAVQueueTitle(title: string): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1266,8 +1243,6 @@ setAVQueueTitle(title: string, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1296,7 +1271,7 @@ session.setAVQueueTitle(queueTitle, function (err) {
});
```
### setLaunchAbility
### setLaunchAbility<sup>10+</sup>
setLaunchAbility(ability: WantAgent): Promise\<void>
......@@ -1304,8 +1279,6 @@ setLaunchAbility(ability: WantAgent): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1368,7 +1341,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
});
```
### setLaunchAbility
### setLaunchAbility<sup>10+</sup>
setLaunchAbility(ability: WantAgent, callback: AsyncCallback\<void>): void
......@@ -1376,8 +1349,6 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1445,8 +1416,6 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise\<voi
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1491,8 +1460,6 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: Asy
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1534,8 +1501,6 @@ setExtras(extras: {[key: string]: Object}): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1609,7 +1574,7 @@ await session.setExtras(extras, (err) => {
})
```
### getController
### getController<sup>10+</sup>
getController(): Promise\<AVSessionController>
......@@ -1617,13 +1582,11 @@ getController(): Promise\<AVSessionController>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| ---------------------------------------------------- | ----------------------------- |
| Promise<[AVSessionController](#avsessioncontroller)> | Promise对象。返回会话控制器。 |
| Promise<[AVSessionController](#avsessioncontroller10)> | Promise对象。返回会话控制器。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -1645,7 +1608,7 @@ session.getController().then((avcontroller) => {
});
```
### getController
### getController<sup>10+</sup>
getController(callback: AsyncCallback\<AVSessionController>): void
......@@ -1653,13 +1616,11 @@ getController(callback: AsyncCallback\<AVSessionController>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | 是 | 回调函数。返回会话控制器。 |
| callback | AsyncCallback<[AVSessionController](#avsessioncontroller10)\> | 是 | 回调函数。返回会话控制器。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -1683,7 +1644,7 @@ session.getController(function (err, avcontroller) {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(): Promise\<OutputDeviceInfo>
......@@ -1691,13 +1652,11 @@ getOutputDevice(): Promise\<OutputDeviceInfo>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| ---------------------------------------------- | --------------------------------- |
| Promise<[OutputDeviceInfo](#outputdeviceinfo)> | Promise对象。返回播放设备信息。 |
| Promise<[OutputDeviceInfo](#outputdeviceinfo10)> | Promise对象。返回播放设备信息。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -1717,7 +1676,7 @@ session.getOutputDevice().then((outputDeviceInfo) => {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void
......@@ -1725,13 +1684,11 @@ getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | 是 | 回调函数,返回播放设备信息。 |
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo10)\> | 是 | 回调函数,返回播放设备信息。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -1753,7 +1710,7 @@ session.getOutputDevice(function (err, outputDeviceInfo) {
});
```
### activate
### activate<sup>10+</sup>
activate(): Promise\<void>
......@@ -1761,8 +1718,6 @@ activate(): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -1787,7 +1742,7 @@ session.activate().then(() => {
});
```
### activate
### activate<sup>10+</sup>
activate(callback: AsyncCallback\<void>): void
......@@ -1795,8 +1750,6 @@ activate(callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1823,16 +1776,14 @@ session.activate(function (err) {
});
```
### deactivate
### deactivate<sup>10+</sup>
deactivate(): Promise\<void>
禁用当前会话的功能,可通过[activate](#activate)恢复。结果通过Promise异步回调方式返回。
禁用当前会话的功能,可通过[activate](#activate10)恢复。结果通过Promise异步回调方式返回。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -1857,18 +1808,16 @@ session.deactivate().then(() => {
});
```
### deactivate
### deactivate<sup>10+</sup>
deactivate(callback: AsyncCallback\<void>): void
禁用当前会话。结果通过callback异步回调方式返回。
禁用当前会话的功能,可通过[activate](#activate)恢复。
禁用当前会话的功能,可通过[activate](#activate10)恢复。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1895,7 +1844,7 @@ session.deactivate(function (err) {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(): Promise\<void>
......@@ -1903,8 +1852,6 @@ destroy(): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -1929,7 +1876,7 @@ session.destroy().then(() => {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(callback: AsyncCallback\<void>): void
......@@ -1937,8 +1884,6 @@ destroy(callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -1965,7 +1910,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
......@@ -1973,8 +1918,6 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind',
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2016,7 +1959,7 @@ session.on('rewind', () => {
});
```
### on('seek')
### on('seek')<sup>10+</sup>
on(type: 'seek', callback: (time: number) => void): void
......@@ -2024,8 +1967,6 @@ on(type: 'seek', callback: (time: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2049,7 +1990,7 @@ session.on('seek', (time) => {
});
```
### on('setSpeed')
### on('setSpeed')<sup>10+</sup>
on(type: 'setSpeed', callback: (speed: number) => void): void
......@@ -2057,8 +1998,6 @@ on(type: 'setSpeed', callback: (speed: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2082,7 +2021,7 @@ session.on('setSpeed', (speed) => {
});
```
### on('setLoopMode')
### on('setLoopMode')<sup>10+</sup>
on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void
......@@ -2090,14 +2029,12 @@ on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ---- |
| type | string | 是 | 事件回调类型,支持事件`'setLoopMode'`:当设置循环模式的命令被发送到会话时,触发该事件。 |
| callback | (mode: [LoopMode](#loopmode)) => void | 是 | 回调函数。参数mode是循环模式。 |
| callback | (mode: [LoopMode](#loopmode10)) => void | 是 | 回调函数。参数mode是循环模式。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2115,7 +2052,7 @@ session.on('setLoopMode', (mode) => {
});
```
### on('toggleFavorite')
### on('toggleFavorite')<sup>10+</sup>
on(type: 'toggleFavorite', callback: (assetId: string) => void): void
......@@ -2123,8 +2060,6 @@ on(type: 'toggleFavorite', callback: (assetId: string) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2156,8 +2091,6 @@ on(type: 'skipToQueueItem', callback: (itemId: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2181,7 +2114,7 @@ session.on('skipToQueueItem', (itemId) => {
});
```
### on('handleKeyEvent')
### on('handleKeyEvent')<sup>10+</sup>
on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void
......@@ -2189,8 +2122,6 @@ on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2214,7 +2145,7 @@ session.on('handleKeyEvent', (event) => {
});
```
### on('outputDeviceChange')
### on('outputDeviceChange')<sup>10+</sup>
on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void
......@@ -2222,14 +2153,12 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 事件回调类型,支持事件`'outputDeviceChange'`:当播放设备变化时,触发该事件。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 是 | 回调函数。参数device是设备相关信息。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | 是 | 回调函数。参数device是设备相关信息。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2255,8 +2184,6 @@ on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Obje
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2280,7 +2207,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
......@@ -2288,8 +2215,6 @@ off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2317,7 +2242,7 @@ session.off('fastForward');
session.off('rewind');
```
### off('seek')
### off('seek')<sup>10+</sup>
off(type: 'seek', callback?: (time: number) => void): void
......@@ -2325,8 +2250,6 @@ off(type: 'seek', callback?: (time: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2348,7 +2271,7 @@ off(type: 'seek', callback?: (time: number) => void): void
session.off('seek');
```
### off('setSpeed')
### off('setSpeed')<sup>10+</sup>
off(type: 'setSpeed', callback?: (speed: number) => void): void
......@@ -2356,8 +2279,6 @@ off(type: 'setSpeed', callback?: (speed: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2379,7 +2300,7 @@ off(type: 'setSpeed', callback?: (speed: number) => void): void
session.off('setSpeed');
```
### off('setLoopMode')
### off('setLoopMode')<sup>10+</sup>
off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void
......@@ -2387,14 +2308,12 @@ off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ----- |
| type | string | 是 | 关闭对应的监听事件,支持关闭事件`'setLoopMode'`。|
| callback | (mode: [LoopMode](#loopmode)) => void | 否 | 回调函数,参数mode是循环模式。<br>当监听事件取消成功,err为undefined,否则返回错误对象。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
| callback | (mode: [LoopMode](#loopmode10)) => void | 否 | 回调函数,参数mode是循环模式。<br>当监听事件取消成功,err为undefined,否则返回错误对象。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2410,7 +2329,7 @@ off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void
session.off('setLoopMode');
```
### off('toggleFavorite')
### off('toggleFavorite')<sup>10+</sup>
off(type: 'toggleFavorite', callback?: (assetId: string) => void): void
......@@ -2418,8 +2337,6 @@ off(type: 'toggleFavorite', callback?: (assetId: string) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2449,8 +2366,6 @@ off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2472,7 +2387,7 @@ off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void
session.off('skipToQueueItem');
```
### off('handleKeyEvent')
### off('handleKeyEvent')<sup>10+</sup>
off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void
......@@ -2480,8 +2395,6 @@ off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2503,7 +2416,7 @@ off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void
session.off('handleKeyEvent');
```
### off('outputDeviceChange')
### off('outputDeviceChange')<sup>10+</sup>
off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void
......@@ -2511,14 +2424,12 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void):
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------ |
| type | string | 是 | 关闭对应的监听事件,支持关闭事件`'outputDeviceChange'`。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 否 | 回调函数,参数device是设备相关信息。<br>当监听事件取消成功,err为undefined,否则返回错误对象。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | 否 | 回调函数,参数device是设备相关信息。<br>当监听事件取消成功,err为undefined,否则返回错误对象。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2543,8 +2454,6 @@ off(type: 'commonCommand', callback?: (command: string, args: {[key:string]: Obj
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2567,7 +2476,7 @@ session.off('commonCommand');
## AVSessionController
## AVSessionController<sup>10+</sup>
调用[avSession.createController](#avsessioncreatecontroller)后,返回会话控制器实例。控制器可查看会话ID,并可完成对会话发送命令及事件,获取会话元数据,播放状态信息等操作。
......@@ -2575,9 +2484,6 @@ session.off('commonCommand');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 可读 | 可写 | 说明 |
| :-------- | :----- | :--- | :--- | :-------------------------------------- |
| sessionId | string | 是 | 否 | AVSessionController对象唯一的会话标识。 |
......@@ -2593,7 +2499,7 @@ await avSession.createController(session.sessionId).then((controller) => {
});
```
### getAVPlaybackState
### getAVPlaybackState<sup>10+</sup>
getAVPlaybackState(): Promise\<AVPlaybackState>
......@@ -2601,13 +2507,11 @@ getAVPlaybackState(): Promise\<AVPlaybackState>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| --------------------------------------------- | --------------------------- |
| Promise<[AVPlaybackState](#avplaybackstate)\> | Promise对象。返回播放状态对象。 |
| Promise<[AVPlaybackState](#avplaybackstate10)\> | Promise对象。返回播放状态对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2627,7 +2531,7 @@ controller.getAVPlaybackState().then((playbackState) => {
});
```
### getAVPlaybackState
### getAVPlaybackState<sup>10+</sup>
getAVPlaybackState(callback: AsyncCallback\<AVPlaybackState>): void
......@@ -2635,13 +2539,11 @@ getAVPlaybackState(callback: AsyncCallback\<AVPlaybackState>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------- | ---- | ---------------------------- |
| callback | AsyncCallback<[AVPlaybackState](#avplaybackstate)\> | 是 | 回调函数,返回当前播放状态对象。 |
| callback | AsyncCallback<[AVPlaybackState](#avplaybackstate10)\> | 是 | 回调函数,返回当前播放状态对象。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2671,8 +2573,6 @@ getAVQueueItems(): Promise\<Array\<AVQueueItem>>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -2705,8 +2605,6 @@ getAVQueueItems(callback: AsyncCallback\<Array\<AVQueueItem>>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2741,8 +2639,6 @@ getAVQueueTitle(): Promise\<string>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -2775,8 +2671,6 @@ getAVQueueTitle(callback: AsyncCallback\<string>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2811,8 +2705,6 @@ skipToQueueItem(itemId: number): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2852,8 +2744,6 @@ skipToQueueItem(itemId: number, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -2882,7 +2772,7 @@ controller.skipToQueueItem(queueItemId, function (err) {
});
```
### getAVMetadata
### getAVMetadata<sup>10+</sup>
getAVMetadata(): Promise\<AVMetadata>
......@@ -2890,13 +2780,11 @@ getAVMetadata(): Promise\<AVMetadata>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| ----------------------------------- | ----------------------------- |
| Promise<[AVMetadata](#avmetadata)\> | Promise对象,返回会话元数据。 |
| Promise<[AVMetadata](#avmetadata10)\> | Promise对象,返回会话元数据。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2916,7 +2804,7 @@ controller.getAVMetadata().then((metadata) => {
});
```
### getAVMetadata
### getAVMetadata<sup>10+</sup>
getAVMetadata(callback: AsyncCallback\<AVMetadata>): void
......@@ -2924,13 +2812,11 @@ getAVMetadata(callback: AsyncCallback\<AVMetadata>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | -------------------------- |
| callback | AsyncCallback<[AVMetadata](#avmetadata)\> | 是 | 回调函数,返回会话元数据。 |
| callback | AsyncCallback<[AVMetadata](#avmetadata10)\> | 是 | 回调函数,返回会话元数据。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2952,7 +2838,7 @@ controller.getAVMetadata(function (err, metadata) {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(): Promise\<OutputDeviceInfo>
......@@ -2960,13 +2846,11 @@ getOutputDevice(): Promise\<OutputDeviceInfo>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| ----------------------------------------------- | --------------------------------- |
| Promise<[OutputDeviceInfo](#outputdeviceinfo)\> | Promise对象,返回播放设备信息。 |
| Promise<[OutputDeviceInfo](#outputdeviceinfo10)\> | Promise对象,返回播放设备信息。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -2985,7 +2869,7 @@ controller.getOutputDevice().then((deviceInfo) => {
});
```
### getOutputDevice
### getOutputDevice<sup>10+</sup>
getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void
......@@ -2993,13 +2877,11 @@ getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------------------- | ---- | ------------------------------ |
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | 是 | 回调函数,返回播放设备信息。 |
| callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo10)\> | 是 | 回调函数,返回播放设备信息。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3029,8 +2911,6 @@ getExtras(): Promise\<{[key: string]: Object}>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -3061,8 +2941,6 @@ getExtras(callback: AsyncCallback\<{[key: string]: Object}>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3105,7 +2983,7 @@ controller.getExtras(function (err, extras) {
});
```
### sendAVKeyEvent
### sendAVKeyEvent<sup>10+</sup>
sendAVKeyEvent(event: KeyEvent): Promise\<void>
......@@ -3113,8 +2991,6 @@ sendAVKeyEvent(event: KeyEvent): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3151,7 +3027,7 @@ controller.sendAVKeyEvent(event).then(() => {
});
```
### sendAVKeyEvent
### sendAVKeyEvent<sup>10+</sup>
sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void
......@@ -3159,8 +3035,6 @@ sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3194,7 +3068,7 @@ controller.sendAVKeyEvent(event, function (err) {
});
```
### getLaunchAbility
### getLaunchAbility<sup>10+</sup>
getLaunchAbility(): Promise\<WantAgent>
......@@ -3202,13 +3076,11 @@ getLaunchAbility(): Promise\<WantAgent>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------- | ------------------------------------------------------------ |
| Promise<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Promise对象,返回在[setLaunchAbility](#setlaunchability)保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
| Promise<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Promise对象,返回在[setLaunchAbility](#setlaunchability10)保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3231,7 +3103,7 @@ controller.getLaunchAbility().then((agent) => {
});
```
### getLaunchAbility
### getLaunchAbility<sup>10+</sup>
getLaunchAbility(callback: AsyncCallback\<WantAgent>): void
......@@ -3239,13 +3111,11 @@ getLaunchAbility(callback: AsyncCallback\<WantAgent>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<[WantAgent](js-apis-app-ability-wantAgent.md)\> | 是 | 回调函数。返回在[setLaunchAbility](#setlaunchability)保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
| callback | AsyncCallback<[WantAgent](js-apis-app-ability-wantAgent.md)\> | 是 | 回调函数。返回在[setLaunchAbility](#setlaunchability10)保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3270,7 +3140,7 @@ controller.getLaunchAbility(function (err, agent) {
});
```
### getRealPlaybackPositionSync
### getRealPlaybackPositionSync<sup>10+</sup>
getRealPlaybackPositionSync(): number
......@@ -3278,8 +3148,6 @@ getRealPlaybackPositionSync(): number
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -3300,7 +3168,7 @@ getRealPlaybackPositionSync(): number
let time = controller.getRealPlaybackPositionSync();
```
### isActive
### isActive<sup>10+</sup>
isActive(): Promise\<boolean>
......@@ -3308,8 +3176,6 @@ isActive(): Promise\<boolean>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -3335,7 +3201,7 @@ controller.isActive().then((isActive) => {
});
```
### isActive
### isActive<sup>10+</sup>
isActive(callback: AsyncCallback\<boolean>): void
......@@ -3343,8 +3209,6 @@ isActive(callback: AsyncCallback\<boolean>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3372,7 +3236,7 @@ controller.isActive(function (err, isActive) {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(): Promise\<void>
......@@ -3380,8 +3244,6 @@ destroy(): Promise\<void>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
......@@ -3406,7 +3268,7 @@ controller.destroy().then(() => {
});
```
### destroy
### destroy<sup>10+</sup>
destroy(callback: AsyncCallback\<void>): void
......@@ -3414,8 +3276,6 @@ destroy(callback: AsyncCallback\<void>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3442,7 +3302,7 @@ controller.destroy(function (err) {
});
```
### getValidCommands
### getValidCommands<sup>10+</sup>
getValidCommands(): Promise\<Array\<AVControlCommandType>>
......@@ -3450,13 +3310,11 @@ getValidCommands(): Promise\<Array\<AVControlCommandType>>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**返回值:**
| 类型 | 说明 |
| ------------------------------------------------------------ | --------------------------------- |
| Promise<Array<[AVControlCommandType](#avcontrolcommandtype)\>\> | Promise对象。返回有效命令的集合。 |
| Promise<Array<[AVControlCommandType](#avcontrolcommandtype10)\>\> | Promise对象。返回有效命令的集合。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3477,7 +3335,7 @@ controller.getValidCommands.then((validCommands) => {
});
```
### getValidCommands
### getValidCommands<sup>10+</sup>
getValidCommands(callback: AsyncCallback\<Array\<AVControlCommandType>>): void
......@@ -3485,13 +3343,11 @@ getValidCommands(callback: AsyncCallback\<Array\<AVControlCommandType>>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
| callback | AsyncCallback\<Array\<[AVControlCommandType](#avcontrolcommandtype)\>\> | 是 | 回调函数,返回有效命令的集合。 |
| callback | AsyncCallback\<Array\<[AVControlCommandType](#avcontrolcommandtype10)\>\> | 是 | 回调函数,返回有效命令的集合。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3514,7 +3370,7 @@ controller.getValidCommands(function (err, validCommands) {
});
```
### sendControlCommand
### sendControlCommand<sup>10+</sup>
sendControlCommand(command: AVControlCommand): Promise\<void>
......@@ -3522,17 +3378,15 @@ sendControlCommand(command: AVControlCommand): Promise\<void>
> **说明:**
>
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind10)。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------- | ---- | ------------------------------ |
| command | [AVControlCommand](#avcontrolcommand) | 是 | 会话的相关命令和命令相关参数。 |
| command | [AVControlCommand](#avcontrolcommand10) | 是 | 会话的相关命令和命令相关参数。 |
**返回值:**
......@@ -3573,7 +3427,7 @@ controller.sendControlCommand(avCommand).then(() => {
});
```
### sendControlCommand
### sendControlCommand<sup>10+</sup>
sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): void
......@@ -3581,17 +3435,15 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): v
> **说明:**
>
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind10)。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | ------------------------------ |
| command | [AVControlCommand](#avcontrolcommand) | 是 | 会话的相关命令和命令相关参数。 |
| command | [AVControlCommand](#avcontrolcommand10) | 是 | 会话的相关命令和命令相关参数。 |
| callback | AsyncCallback\<void> | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 |
**错误码:**
......@@ -3637,8 +3489,6 @@ sendCommonCommand(command: string, args: {[key: string]: Object}): Promise\<void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3687,8 +3537,6 @@ sendCommonCommand(command: string, args: {[key: string]: Object}, callback: Asyn
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3726,7 +3574,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)
......@@ -3734,15 +3582,13 @@ on(type: 'metadataChange', filter: Array\<keyof AVMetadata> | 'all', callback: (
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 事件回调类型,支持事件`'metadataChange'`:当元数据变化时,触发该事件。 |
| filter | Array\<keyof&nbsp;[AVMetadata](#avmetadata)\>&nbsp;&#124;&nbsp;'all' | 是 | 'all' 表示关注元数据所有字段变化;Array<keyof&nbsp;[AVMetadata](#avmetadata)\> 表示关注Array中的字段变化。 |
| callback | (data: [AVMetadata](#avmetadata)) => void | 是 | 回调函数,参数data是变化后的元数据。 |
| filter | Array\<keyof&nbsp;[AVMetadata](#avmetadata10)\>&nbsp;&#124;&nbsp;'all' | 是 | 'all' 表示关注元数据所有字段变化;Array<keyof&nbsp;[AVMetadata](#avmetadata10)\> 表示关注Array中的字段变化。 |
| callback | (data: [AVMetadata](#avmetadata10)) => void | 是 | 回调函数,参数data是变化后的元数据。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3765,7 +3611,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)
......@@ -3773,15 +3619,13 @@ on(type: 'playbackStateChange', filter: Array\<keyof AVPlaybackState> | 'all', c
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 事件回调类型,支持事件`'playbackStateChange'`:当播放状态变化时,触发该事件。 |
| filter | Array\<keyof&nbsp;[AVPlaybackState](#avplaybackstate)\>&nbsp;&#124;&nbsp;'all' | 是 | 'all' 表示关注播放状态所有字段变化;Array<keyof&nbsp;[AVPlaybackState](#avplaybackstate)\> 表示关注Array中的字段变化。 |
| callback | (state: [AVPlaybackState](#avplaybackstate)) => void | 是 | 回调函数,参数state是变化后的播放状态。 |
| filter | Array\<keyof&nbsp;[AVPlaybackState](#avplaybackstate10)\>&nbsp;&#124;&nbsp;'all' | 是 | 'all' 表示关注播放状态所有字段变化;Array<keyof&nbsp;[AVPlaybackState](#avplaybackstate10)\> 表示关注Array中的字段变化。 |
| callback | (state: [AVPlaybackState](#avplaybackstate10)) => void | 是 | 回调函数,参数state是变化后的播放状态。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -3812,8 +3656,6 @@ on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key:string]: O
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3845,8 +3687,6 @@ on(type: 'queueItemsChange', callback: (items: Array<[AVQueueItem](#avqueueitem1
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3878,8 +3718,6 @@ on(type: 'queueTitleChange', callback: (title: string) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3911,8 +3749,6 @@ on(type: 'extrasChange', callback: (extras: {[key:string]: Object}) => void): vo
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3937,7 +3773,7 @@ controller.on('extrasChange', (extras) => {
});
```
### on('sessionDestroy')
### on('sessionDestroy')<sup>10+</sup>
on(type: 'sessionDestroy', callback: () => void)
......@@ -3945,8 +3781,6 @@ on(type: 'sessionDestroy', callback: () => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -3970,7 +3804,7 @@ controller.on('sessionDestroy', () => {
});
```
### on('activeStateChange')
### on('activeStateChange')<sup>10+</sup>
on(type: 'activeStateChange', callback: (isActive: boolean) => void)
......@@ -3978,8 +3812,6 @@ on(type: 'activeStateChange', callback: (isActive: boolean) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4003,7 +3835,7 @@ controller.on('activeStateChange', (isActive) => {
});
```
### on('validCommandChange')
### on('validCommandChange')<sup>10+</sup>
on(type: 'validCommandChange', callback: (commands: Array\<AVControlCommandType>) => void)
......@@ -4011,14 +3843,12 @@ on(type: 'validCommandChange', callback: (commands: Array\<AVControlCommandType>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | 是 | 事件回调类型,支持事件`'validCommandChange'`:当检测到会话的合法命令发生改变时,触发该事件。 |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | 是 | 回调函数。参数commands是有效命令的集合。 |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype10)\>) => void | 是 | 回调函数。参数commands是有效命令的集合。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -4037,7 +3867,7 @@ controller.on('validCommandChange', (validCommands) => {
});
```
### on('outputDeviceChange')
### on('outputDeviceChange')<sup>10+</sup>
on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void
......@@ -4045,14 +3875,12 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | 是 | 事件回调类型,支持事件为`'outputDeviceChange'`:当播放设备变化时,触发该事件)。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 是 | 回调函数,参数device是设备相关信息。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | 是 | 回调函数,参数device是设备相关信息。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -4070,7 +3898,7 @@ controller.on('outputDeviceChange', (device) => {
});
```
### off('metadataChange')
### off('metadataChange')<sup>10+</sup>
off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
......@@ -4078,14 +3906,12 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------ | ---- | ------------------------------------------------------ |
| type | string | 是 | 取消对应的监听事件,支持事件`'metadataChange'`。 |
| callback | (data: [AVMetadata](#avmetadata)) => void | 否 | 回调函数,参数data是变化后的元数据。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
| callback | (data: [AVMetadata](#avmetadata10)) => void | 否 | 回调函数,参数data是变化后的元数据。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -4100,7 +3926,7 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
controller.off('metadataChange');
```
### off('playbackStateChange')
### off('playbackStateChange')<sup>10+</sup>
off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void)
......@@ -4108,14 +3934,12 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- |
| type | string | 是 | 取消对应的监听事件,支持事件`'playbackStateChange'`。 |
| callback | (state: [AVPlaybackState](#avplaybackstate)) => void | 否 | 回调函数,参数state是变化后的播放状态。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
| callback | (state: [AVPlaybackState](#avplaybackstate10)) => void | 否 | 回调函数,参数state是变化后的播放状态。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -4138,8 +3962,6 @@ off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key:string]:
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4168,8 +3990,6 @@ off(type: 'queueItemsChange', callback?: (items: Array<[AVQueueItem](#avqueueite
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4198,8 +4018,6 @@ off(type: 'queueTitleChange', callback?: (title: string) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4228,8 +4046,6 @@ off(type: 'extrasChange', callback?: (extras: {[key:string]: Object}) => void):
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4252,7 +4068,7 @@ off(type: 'extrasChange', callback?: (extras: {[key:string]: Object}) => void):
controller.off('extrasChange');
```
### off('sessionDestroy')
### off('sessionDestroy')<sup>10+</sup>
off(type: 'sessionDestroy', callback?: () => void)
......@@ -4260,8 +4076,6 @@ off(type: 'sessionDestroy', callback?: () => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4282,7 +4096,7 @@ off(type: 'sessionDestroy', callback?: () => void)
controller.off('sessionDestroy');
```
### off('activeStateChange')
### off('activeStateChange')<sup>10+</sup>
off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
......@@ -4290,8 +4104,6 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -4312,7 +4124,7 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
controller.off('activeStateChange');
```
### off('validCommandChange')
### off('validCommandChange')<sup>10+</sup>
off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void)
......@@ -4320,14 +4132,12 @@ off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandTyp
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------------------- |
| type | string | 是 | 取消对应的监听事件,支持事件`'validCommandChange'`。 |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | 否 | 回调函数。参数commands是有效命令的集合。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype10)\>) => void | 否 | 回调函数。参数commands是有效命令的集合。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -4342,7 +4152,7 @@ off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandTyp
controller.off('validCommandChange');
```
### off('outputDeviceChange')
### off('outputDeviceChange')<sup>10+</sup>
off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void
......@@ -4350,14 +4160,12 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void):
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------ |
| type | string | 是 | 取消对应的监听事件,支持事件`'outputDeviceChange'`。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 否 | 回调函数,参数device是设备相关信息。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
| callback | (device: [OutputDeviceInfo](#outputdeviceinfo10)) => void | 否 | 回调函数,参数device是设备相关信息。<br>该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 |
**错误码:**
以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)
......@@ -4388,13 +4196,11 @@ controller.off('outputDeviceChange');
| pid | number | 是 | 会话的进程ID |
| uid | number | 是 | 用户ID |
## AVSessionType
## AVSessionType<sup>10+<sup>
当前会话支持的会话类型。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口。
| 名称 | 类型 | 说明 |
| ----- | ------ | ---- |
| audio | string | 音频 |
......@@ -4411,21 +4217,19 @@ controller.off('outputDeviceChange');
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ------------ | ------------------------------------------------------------ | ---- | --------------------------------------------------- | --------------------------------------------------- |
| sessionId | string | 是 | 否 | 会话ID |
| type | [AVSessionType](#avsessiontype) | 是 | 否 | 会话类型 |
| type | [AVSessionType](#avsessiontype10) | 是 | 否 | 会话类型 |
| sessionTag | string | 是 | 否 | 会话的自定义名称 |
| elementName | [ElementName](js-apis-bundle-ElementName.md) | 是 | 否 | 会话所属应用的信息(包含bundleName、abilityName等) |
| isActive | boolean | 是 | 否 | 会话是否被激活 |
| isTopSession | boolean | 是 | 否 | 会话是否为最新的会话 |
| outputDevice | [OutputDeviceInfo](#outputdeviceinfo) | 是 | 否 | 分布式设备相关信息 |
| outputDevice | [OutputDeviceInfo](#outputdeviceinfo10) | 是 | 否 | 分布式设备相关信息 |
## AVControlCommandType
## AVControlCommandType<sup>10+</sup>
会话可传递的命令。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 说明 |
| -------------- | ------ | ------------ |
| play | string | 播放 |
......@@ -4440,27 +4244,23 @@ controller.off('outputDeviceChange');
| setLoopMode | string | 设置循环模式 |
| toggleFavorite | string | 是否收藏 |
## AVControlCommand
## AVControlCommand<sup>10+</sup>
会话接受的命令的对象描述。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 必填 | 说明 |
| --------- | ------------------------------------------------- | ---- | -------------- |
| command | [AVControlCommandType](#avcontrolcommandtype) | 是 | 命令 |
| parameter | [LoopMode](#loopmode) &#124; string &#124; number | 否 | 命令对应的参数 |
| command | [AVControlCommandType](#avcontrolcommandtype10) | 是 | 命令 |
| parameter | [LoopMode](#loopmode10) &#124; string &#124; number | 否 | 命令对应的参数 |
## AVMetadata
## AVMetadata<sup>10+</sup>
媒体元数据的相关属性。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 必填 | 说明 |
| --------------- |-------------------------| ---- |---------------------------------------------------------------------|
| assetId | string | 是 | 媒体ID。 |
......@@ -4507,60 +4307,52 @@ controller.off('outputDeviceChange');
| itemId | number | 是 | 播放列表中单项的ID。 |
| description | [AVMediaDescription](#avmediadescription10) | 是 | 播放列表中单项的媒体元数据。 |
## AVPlaybackState
## AVPlaybackState<sup>10+</sup>
媒体播放状态的相关属性。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 必填 | 说明 |
| ------------ | ------------------------------------- | ---- | ------- |
| state | [PlaybackState](#playbackstate) | 否 | 播放状态 |
| speed | number | 否 | 播放倍速 |
| position | [PlaybackPosition](#playbackposition) | 否 | 播放位置 |
| bufferedTime | number | 否 | 缓冲时间 |
| loopMode | [LoopMode](#loopmode) | 否 | 循环模式 |
| loopMode | [LoopMode](#loopmode10) | 否 | 循环模式 |
| isFavorite | boolean | 否 | 是否收藏 |
| activeItemId<sup>10+</sup> | number | 否 | 正在播放的媒体Id |
| extras<sup>10+</sup> | {[key: string]: Object} | 否 | 自定义媒体数据 |
## PlaybackPosition
## PlaybackPosition<sup>10+</sup>
媒体播放位置的相关属性。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | ------------------ |
| elapsedTime | number | 是 | 已用时间,单位毫秒(ms)。 |
| updateTime | number | 是 | 更新时间,单位毫秒(ms)。 |
## OutputDeviceInfo
## OutputDeviceInfo<sup>10+</sup>
播放设备的相关信息。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 类型 | 必填 | 说明 |
| ---------- | -------------- | ---- | ---------------------- |
| isRemote | boolean | 是 | 设备是否连接。 |
| audioDeviceId | Array<number\> | 是 | 播放设备的ID集合。 |
| deviceName | Array<string\> | 是 | 播放设备的名称集合。 |
## PlaybackState
## PlaybackState<sup>10+</sup>
表示媒体播放状态的枚举。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 值 | 说明 |
| --------------------------- | ---- | ----------- |
| PLAYBACK_STATE_INITIAL | 0 | 初始状态 |
......@@ -4572,14 +4364,12 @@ controller.off('outputDeviceChange');
| PLAYBACK_STATE_STOP | 6 | 停止 |
## LoopMode
## LoopMode<sup>10+</sup>
表示媒体播放循环模式的枚举。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 值 | 说明 |
| ------------------ | ---- | -------- |
| LOOP_MODE_SEQUENCE | 0 | 顺序播放 |
......@@ -4587,14 +4377,12 @@ controller.off('outputDeviceChange');
| LOOP_MODE_LIST | 2 | 表单循环 |
| LOOP_MODE_SHUFFLE | 3 | 随机播放 |
## AVSessionErrorCode
## AVSessionErrorCode<sup>10+</sup>
会话发生错误时的错误码。
**系统能力:** SystemCapability.Multimedia.AVSession.Core
**系统接口:** 该接口为系统接口
| 名称 | 值 | 说明 |
| ------------------------------ | ------- | ------------------------------- |
| ERR_CODE_SERVICE_EXCEPTION | 6600101 | Session service exception. |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册