Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
bd469e22
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bd469e22
编写于
5月 18, 2023
作者:
H
houyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pr_doc
Signed-off-by:
N
houyu
<
houyu21@h-partners.com
>
上级
980b5e1a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
44 addition
and
4 deletion
+44
-4
zh-cn/application-dev/reference/apis/js-apis-avsession.md
zh-cn/application-dev/reference/apis/js-apis-avsession.md
+44
-4
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-avsession.md
浏览文件 @
bd469e22
...
...
@@ -1091,6 +1091,8 @@ setAVQueueItems(items: Array\<AVQueueItem>): Promise<void\>
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -1114,12 +1116,14 @@ setAVQueueItems(items: Array\<AVQueueItem>): Promise<void\>
**示例:**
```
js
let
imageSource
:
imageImageSource
=
image
.
createImageSource
(
value
.
buffer
);
let
imagePixel
:
image
.
PixelMap
=
await
imageSource
.
createPixelMap
({
desiredSize
:{
width
:
150
,
height
:
150
}});
let
queueItemDescription_1
=
{
mediaId
:
'
001
'
,
title
:
'
music_name
'
,
subtitle
:
'
music_sub_name
'
,
description
:
'
music_description
'
,
icon
:
PIXELMAP_OBJECT
,
icon
:
imagePixel
,
iconUri
:
'
http://www.icon.uri.com
'
,
extras
:
{
'
extras
'
:
'
any
'
}
};
...
...
@@ -1156,6 +1160,8 @@ setAVQueueItems(items: Array\<AVQueueItem>, callback: AsyncCallback<void\>): voi
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -1174,12 +1180,14 @@ setAVQueueItems(items: Array\<AVQueueItem>, callback: AsyncCallback<void\>): voi
**示例:**
```
js
let
imageSource
:
imageImageSource
=
image
.
createImageSource
(
value
.
buffer
);
let
imagePixel
:
image
.
PixelMap
=
await
imageSource
.
createPixelMap
({
desiredSize
:{
width
:
150
,
height
:
150
}});
let
queueItemDescription_1
=
{
mediaId
:
'
001
'
,
title
:
'
music_name
'
,
subtitle
:
'
music_sub_name
'
,
description
:
'
music_description
'
,
icon
:
PIXELMAP_OBJECT
,
icon
:
imagePixel
,
iconUri
:
'
http://www.icon.uri.com
'
,
extras
:
{
'
extras
'
:
'
any
'
}
};
...
...
@@ -1218,6 +1226,8 @@ setAVQueueTitle(title: string): Promise\<void>
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -1257,6 +1267,8 @@ setAVQueueTitle(title: string, callback: AsyncCallback\<void\>): void
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -1434,6 +1446,8 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise\<voi
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -1478,6 +1492,8 @@ dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: Asy
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -1519,6 +1535,8 @@ setExtras(extras: {[key: string]: Object}): Promise\<void>
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -2520,7 +2538,7 @@ session.off('outputDeviceChange');
### off('commonCommand')<sup>10+</sup>
off(type: 'commonCommand', callback?: (comm
onComm
and: string, args: {[key:string]: Object}) => void): void
off(type: 'commonCommand', callback?: (command: string, args: {[key:string]: Object}) => void): void
取消监听自定义控制命令的变化。
...
...
@@ -2533,7 +2551,7 @@ off(type: 'commonCommand', callback?: (commonCommand: string, args: {[key:string
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- |
| type | string | 是 | 取消对应的监听事件,支持事件
`'commonCommand'`
。 |
| callback | (comm
onCommand: string, args: {[key:string]: Object}) => void | 否 | 回调函数,参数commonCommand是变化的自定义控制命令名,args为自定义控制命令的参数。
<br>
该参数为可选参数,若不填写该参数,则认为取消所有对commonC
ommand事件的监听。 |
| callback | (comm
and: string, args: {[key:string]: Object}) => void | 否 | 回调函数,参数command是变化的自定义控制命令名,args为自定义控制命令的参数。
<br>
该参数为可选参数,若不填写该参数,则认为取消所有对c
ommand事件的监听。 |
**错误码:**
以下错误码的详细介绍请参见
[
媒体会话管理错误码
](
../errorcodes/errorcode-avsession.md
)
。
...
...
@@ -2558,6 +2576,8 @@ session.off('commonCommand');
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
| 名称 | 类型 | 可读 | 可写 | 说明 |
| :-------- | :----- | :--- | :--- | :-------------------------------------- |
...
...
@@ -3061,6 +3081,22 @@ getExtras(callback: AsyncCallback\<{[key: string]: Object}>): void
**示例:**
```
js
let
metadata
=
{
assetId
:
"
121278
"
,
title
:
"
lose yourself
"
,
artist
:
"
Eminem
"
,
author
:
"
ST
"
,
album
:
"
Slim shady
"
,
writer
:
"
ST
"
,
composer
:
"
ST
"
,
duration
:
2222
,
mediaImage
:
"
https://www.example.com/example.jpg
"
,
subtitle
:
"
8 Mile
"
,
description
:
"
Rap
"
,
lyric
:
"
https://www.example.com/example.lrc
"
,
previousAssetId
:
"
121277
"
,
nextAssetId
:
"
121279
"
,
};
controller
.
getExtras
(
function
(
err
,
extras
)
{
if
(
err
)
{
console
.
info
(
`getExtras BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
...
...
@@ -3602,6 +3638,8 @@ sendCommonCommand(command: string, args: {[key: string]: Object}): Promise\<void
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
@@ -3650,6 +3688,8 @@ sendCommonCommand(command: string, args: {[key: string]: Object}, callback: Asyn
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录