提交 785f105e 编写于 作者: L liyuhang

Add historical related docs

Signed-off-by: Nliyuhang <liyuhang24@huawei.com>
Change-Id: I5d4c659651284f1d2a40c72049ace342f3ed0907
上级 ba6f195a
......@@ -32,6 +32,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback&lt;void&gt;): void | 向置顶会话发送按键命令。 |
| sendControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | 通过会话对应的AVSessionController向会话发送播控命令。 |
| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback&lt;void&gt;): void | 向置顶会话发送播控命令。 |
| getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback\<Array\<Readonly\<AVSessionDescriptor>>>): void<sup>10+<sup> | 获取历史会话的描述符。 |
### 通过AVSessionController对象调用的接口
......@@ -80,6 +81,19 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
console.error(`Failed to get all session descriptors. Code: ${err.code}, message: ${err.message}`);
});
// 获取历史会话的描述符
avSession.getHistoricalSessionDescriptors().then((descriptors) => {
console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors.length : ${descriptors.length}`);
if (descriptors.length > 0){
console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].isActive : ${descriptors[0].isActive}`);
console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].type : ${descriptors[0].type}`);
console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionTag : ${descriptors[0].sessionTag}`);
console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionId : ${descriptors[0].sessionId}`);
console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].elementName.bundleName : ${descriptors[0].elementName.bundleName}`);
}
}).catch((err) => {
console.error(`Failed to get historical session descriptors, error code: ${err.code}, error message: ${err.message}`);
});
```
2. 监听AVSession会话状态及AVSession服务状态事件。
......
......@@ -90,6 +90,46 @@
console.info(`SetAVPlaybackState successfully`);
}
});
// 设置一个播放列表
let queueItemDescription_1 = {
mediaId: '001',
title: 'music_name',
subtitle: 'music_sub_name',
description: 'music_description',
icon: PIXELMAP_OBJECT,
iconUri: 'http://www.xxx.com',
extras: {'extras':'any'}
};
let queueItem_1 = {
itemId: 1,
description: queueItemDescription_1
};
let queueItemDescription_2 = {
mediaId: '002',
title: 'music_name',
subtitle: 'music_sub_name',
description: 'music_description',
icon: PIXELMAP_OBJECT,
iconUri: 'http://www.xxx.com',
extras: {'extras':'any'}
};
let queueItem_2 = {
itemId: 2,
description: queueItemDescription_2
};
let queueItemsArray = [queueItem_1, queueItem_2];
session.setAVQueueItems(queueItemsArray).then(() => {
console.info(`SetAVQueueItems successfully`);
}).catch((err) => {
console.error(`Failed to set AVQueueItem, error code: ${err.code}, error message: ${err.message}`);
});
// 设置媒体播放列表名称
let queueTitle = 'QUEUE_TITLE';
session.setAVQueueTitle(queueTitle).then(() => {
console.info(`SetAVQueueTitle successfully`);
}).catch((err) => {
console.info(`Failed to set AVQueueTitle, error code: ${err.code}, error message: ${err.message}`);
});
}
```
......
......@@ -1133,7 +1133,7 @@ let queueItemDescription_2 = {
subtitle: 'music_sub_name',
description: 'music_description',
icon: PIXELMAP_OBJECT,
iconUri: 'http://www.icon.uri.com',
iconUri: 'http://www.xxx.com',
extras: {'extras':'any'}
};
let queueItem_2 = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册