Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
f3414d48
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
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看板
未验证
提交
f3414d48
编写于
5月 08, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 08, 2023
浏览文件
操作
浏览文件
下载
差异文件
!17946 Fix doc desciption and quotation mark
Merge pull request !17946 from Li Yuhang/fix_quotation_0508
上级
640ac93e
6a3690a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
72 addition
and
62 deletion
+72
-62
zh-cn/application-dev/media/using-avsession-controller.md
zh-cn/application-dev/media/using-avsession-controller.md
+8
-8
zh-cn/application-dev/media/using-avsession-developer.md
zh-cn/application-dev/media/using-avsession-developer.md
+10
-10
zh-cn/application-dev/media/using-distributed-avsession.md
zh-cn/application-dev/media/using-distributed-avsession.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-avsession.md
zh-cn/application-dev/reference/apis/js-apis-avsession.md
+52
-42
未找到文件。
zh-cn/application-dev/media/using-avsession-controller.md
浏览文件 @
f3414d48
...
@@ -128,7 +128,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
...
@@ -128,7 +128,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
// 注册服务异常监听
// 注册服务异常监听
AVSessionManager
.
on
(
'
sessionServiceDie
'
,
()
=>
{
AVSessionManager
.
on
(
'
sessionServiceDie
'
,
()
=>
{
// 服务端异常,应用清理资源
// 服务端异常,应用清理资源
console
.
info
(
'
服务端异常
'
);
console
.
info
(
`服务端异常`
);
})
})
```
```
...
@@ -153,16 +153,16 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
...
@@ -153,16 +153,16 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
// 注册会话激活状态变更监听
// 注册会话激活状态变更监听
controller
.
on
(
'
activeStateChange
'
,
(
isActive
)
=>
{
controller
.
on
(
'
activeStateChange
'
,
(
isActive
)
=>
{
if
(
isActive
)
{
if
(
isActive
)
{
console
.
info
(
'
控制器卡片按键高亮
'
);
console
.
info
(
`控制器卡片按键高亮`
);
}
else
{
}
else
{
console
.
info
(
'
控制器卡片按键变更为无效
'
);
console
.
info
(
`控制器卡片按键变更为无效`
);
}
}
});
});
// 注册会话销毁监听
// 注册会话销毁监听
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
console
.
info
(
'
on sessionDestroy : SUCCESS
'
);
info
(
`on sessionDestroy : SUCCESS `
);
controller
.
destroy
().
then
(()
=>
{
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
destroy : SUCCESS
'
);
console
.
info
(
`destroy : SUCCESS`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to destroy session. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to destroy session. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -290,14 +290,14 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
...
@@ -290,14 +290,14 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
command
:
'
This is my custom command
'
command
:
'
This is my custom command
'
}
}
await
controller
.
sendCommonCommand
(
commandName
,
args
).
then
(()
=>
{
await
controller
.
sendCommonCommand
(
commandName
,
args
).
then
(()
=>
{
console
.
info
(
'
SendCommonCommand successfully
'
);
console
.
info
(
`SendCommonCommand successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to send common command. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to send common command. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
})
// 设置指定播放列表单项的ID,供session选择播放
// 设置指定播放列表单项的ID,供session选择播放
let
queueItemId
:
number
=
0
;
let
queueItemId
:
number
=
0
;
await
controller
.
skipToQueueItem
(
queueItemId
).
then
(()
=>
{
await
controller
.
skipToQueueItem
(
queueItemId
).
then
(()
=>
{
console
.
info
(
'
SkipToQueueItem successfully
'
);
console
.
info
(
`SkipToQueueItem successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to skip to queue item. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to skip to queue item. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -316,7 +316,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
...
@@ -316,7 +316,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
if
(
err
)
{
if
(
err
)
{
console
.
error
(
`Failed to destroy controller. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to destroy controller. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
Destroy controller SUCCESS
'
);
console
.
info
(
`Destroy controller SUCCESS`
);
}
}
});
});
}
}
...
...
zh-cn/application-dev/media/using-avsession-developer.md
浏览文件 @
f3414d48
...
@@ -74,7 +74,7 @@
...
@@ -74,7 +74,7 @@
artist
:
'
ARTIST
'
artist
:
'
ARTIST
'
};
};
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
console
.
info
(
'
SetAVMetadata successfully
'
);
console
.
info
(
`SetAVMetadata successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set AVMetadata. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to set AVMetadata. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -87,7 +87,7 @@
...
@@ -87,7 +87,7 @@
if
(
err
)
{
if
(
err
)
{
console
.
error
(
`Failed to set AVPlaybackState. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to set AVPlaybackState. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SetAVPlaybackState successfully
'
);
console
.
info
(
`SetAVPlaybackState successfully`
);
}
}
});
});
}
}
...
@@ -132,7 +132,7 @@
...
@@ -132,7 +132,7 @@
lyric
:
'
This is my lyric
'
lyric
:
'
This is my lyric
'
}
}
await
session
.
dispatchSessionEvent
(
eventName
,
args
).
then
(()
=>
{
await
session
.
dispatchSessionEvent
(
eventName
,
args
).
then
(()
=>
{
console
.
info
(
'
Dispatch session event successfully
'
);
console
.
info
(
`Dispatch session event successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to dispatch session event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to dispatch session event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
})
...
@@ -150,7 +150,7 @@
...
@@ -150,7 +150,7 @@
extra
:
'
This is my custom meida packet
'
extra
:
'
This is my custom meida packet
'
}
}
await
session
.
setExtras
(
extras
).
then
(()
=>
{
await
session
.
setExtras
(
extras
).
then
(()
=>
{
console
.
info
(
'
Set extras successfully
'
);
console
.
info
(
`Set extras successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set extras. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to set extras. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
})
...
@@ -175,23 +175,23 @@
...
@@ -175,23 +175,23 @@
// 一般在监听器中会对播放器做相应逻辑处理
// 一般在监听器中会对播放器做相应逻辑处理
// 不要忘记处理完后需要通过set接口同步播放相关信息,参考上面的用例
// 不要忘记处理完后需要通过set接口同步播放相关信息,参考上面的用例
session
.
on
(
'
play
'
,
()
=>
{
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
on play , do play task
'
);
console
.
info
(
`on play , do play task`
);
// do some tasks ···
// do some tasks ···
});
});
session
.
on
(
'
pause
'
,
()
=>
{
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
on pause , do pause task
'
);
console
.
info
(
`on pause , do pause task`
);
// do some tasks ···
// do some tasks ···
});
});
session
.
on
(
'
stop
'
,
()
=>
{
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
on stop , do stop task
'
);
console
.
info
(
`on stop , do stop task`
);
// do some tasks ···
// do some tasks ···
});
});
session
.
on
(
'
playNext
'
,
()
=>
{
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
on playNext , do playNext task
'
);
console
.
info
(
`on playNext , do playNext task`
);
// do some tasks ···
// do some tasks ···
});
});
session
.
on
(
'
playPrevious
'
,
()
=>
{
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
on playPrevious , do playPrevious task
'
);
console
.
info
(
`on playPrevious , do playPrevious task`
);
// do some tasks ···
// do some tasks ···
});
});
session
.
on
(
'
fastForward
'
,
()
=>
{
session
.
on
(
'
fastForward
'
,
()
=>
{
...
@@ -312,7 +312,7 @@
...
@@ -312,7 +312,7 @@
if
(
err
)
{
if
(
err
)
{
console
.
error
(
`Failed to destroy session. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to destroy session. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}
}
});
});
}
}
...
...
zh-cn/application-dev/media/using-distributed-avsession.md
浏览文件 @
f3414d48
...
@@ -36,13 +36,13 @@
...
@@ -36,13 +36,13 @@
let
audioDevices
;
let
audioDevices
;
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
data
)
=>
{
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
data
)
=>
{
audioDevices
=
data
;
audioDevices
=
data
;
console
.
info
(
'
Promise returned to indicate that the device list is obtained.
'
);
console
.
info
(
`Promise returned to indicate that the device list is obtained.`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to get devices. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to get devices. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
AVSessionManager
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
AVSessionManager
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
createController : SUCCESS
'
);
console
.
info
(
`createController : SUCCESS`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to cast audio. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
error
(
`Failed to cast audio. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
...
zh-cn/application-dev/reference/apis/js-apis-avsession.md
浏览文件 @
f3414d48
...
@@ -445,13 +445,13 @@ let audioRoutingManager = audioManager.getRoutingManager();
...
@@ -445,13 +445,13 @@ let audioRoutingManager = audioManager.getRoutingManager();
let
audioDevices
;
let
audioDevices
;
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
data
)
=>
{
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
data
)
=>
{
audioDevices
=
data
;
audioDevices
=
data
;
console
.
info
(
'
Promise returned to indicate that the device list is obtained.
'
);
console
.
info
(
`Promise returned to indicate that the device list is obtained.`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`GetDevices BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`GetDevices BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
avSession
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
avSession
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
CreateController : SUCCESS
'
);
console
.
info
(
`CreateController : SUCCESS`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`CreateController BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`CreateController BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -498,7 +498,7 @@ let audioRoutingManager = audioManager.getRoutingManager();
...
@@ -498,7 +498,7 @@ let audioRoutingManager = audioManager.getRoutingManager();
let
audioDevices
;
let
audioDevices
;
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
data
)
=>
{
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
data
)
=>
{
audioDevices
=
data
;
audioDevices
=
data
;
console
.
info
(
'
Promise returned to indicate that the device list is obtained.
'
);
console
.
info
(
`Promise returned to indicate that the device list is obtained.`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`GetDevices BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`GetDevices BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -507,7 +507,7 @@ avSession.castAudio('all', audioDevices, function (err) {
...
@@ -507,7 +507,7 @@ avSession.castAudio('all', audioDevices, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`CastAudio BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`CastAudio BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
CastAudio : SUCCESS
'
);
console
.
info
(
`CastAudio : SUCCESS `
);
}
}
});
});
```
```
...
@@ -622,7 +622,7 @@ on(type: 'sessionServiceDie', callback: () => void): void
...
@@ -622,7 +622,7 @@ on(type: 'sessionServiceDie', callback: () => void): void
```
js
```
js
avSession
.
on
(
'
sessionServiceDie
'
,
()
=>
{
avSession
.
on
(
'
sessionServiceDie
'
,
()
=>
{
console
.
info
(
'
on sessionServiceDie : session is Died
'
);
console
.
info
(
`on sessionServiceDie : session is Died `
);
});
});
```
```
...
@@ -696,7 +696,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
...
@@ -696,7 +696,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let
event
=
{
id
:
1
,
deviceId
:
0
,
actionTime
:
1
,
screenId
:
1
,
windowId
:
1
,
action
:
2
,
key
:
keyItem
,
unicodeChar
:
0
,
keys
:[
keyItem
],
ctrlKey
:
false
,
altKey
:
false
,
shiftKey
:
false
,
logoKey
:
false
,
fnKey
:
false
,
capsLock
:
false
,
numLock
:
false
,
scrollLock
:
false
};
let
event
=
{
id
:
1
,
deviceId
:
0
,
actionTime
:
1
,
screenId
:
1
,
windowId
:
1
,
action
:
2
,
key
:
keyItem
,
unicodeChar
:
0
,
keys
:[
keyItem
],
ctrlKey
:
false
,
altKey
:
false
,
shiftKey
:
false
,
logoKey
:
false
,
fnKey
:
false
,
capsLock
:
false
,
numLock
:
false
,
scrollLock
:
false
};
avSession
.
sendSystemAVKeyEvent
(
event
).
then
(()
=>
{
avSession
.
sendSystemAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
SendSystemAVKeyEvent Successfully
'
);
console
.
info
(
`SendSystemAVKeyEvent Successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SendSystemAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendSystemAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -740,7 +740,7 @@ avSession.sendSystemAVKeyEvent(event, function (err) {
...
@@ -740,7 +740,7 @@ avSession.sendSystemAVKeyEvent(event, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SendSystemAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendSystemAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SendSystemAVKeyEvent : SUCCESS
'
);
console
.
info
(
`SendSystemAVKeyEvent : SUCCESS `
);
}
}
});
});
```
```
...
@@ -798,7 +798,7 @@ let avcommand = {command:cmd};
...
@@ -798,7 +798,7 @@ let avcommand = {command:cmd};
// let cmd : avSession.AVControlCommandType = 'toggleFavorite';
// let cmd : avSession.AVControlCommandType = 'toggleFavorite';
// let avcommand = {command:cmd, parameter:"false"};
// let avcommand = {command:cmd, parameter:"false"};
avSession
.
sendSystemControlCommand
(
avcommand
).
then
(()
=>
{
avSession
.
sendSystemControlCommand
(
avcommand
).
then
(()
=>
{
console
.
info
(
'
SendSystemControlCommand successfully
'
);
console
.
info
(
`SendSystemControlCommand successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SendSystemControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendSystemControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -855,7 +855,7 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
...
@@ -855,7 +855,7 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SendSystemControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendSystemControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
sendSystemControlCommand successfully
'
);
console
.
info
(
`sendSystemControlCommand successfully`
);
}
}
});
});
```
```
...
@@ -931,7 +931,7 @@ let metadata = {
...
@@ -931,7 +931,7 @@ let metadata = {
nextAssetId
:
"
121279
"
,
nextAssetId
:
"
121279
"
,
};
};
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
console
.
info
(
'
SetAVMetadata successfully
'
);
console
.
info
(
`SetAVMetadata successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVMetadata BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVMetadata BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -985,7 +985,7 @@ session.setAVMetadata(metadata, function (err) {
...
@@ -985,7 +985,7 @@ session.setAVMetadata(metadata, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SetAVMetadata BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVMetadata BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SetAVMetadata successfully
'
);
console
.
info
(
`SetAVMetadata successfully`
);
}
}
});
});
```
```
...
@@ -1032,7 +1032,7 @@ let playbackState = {
...
@@ -1032,7 +1032,7 @@ let playbackState = {
isFavorite
:
true
,
isFavorite
:
true
,
};
};
session
.
setAVPlaybackState
(
playbackState
).
then
(()
=>
{
session
.
setAVPlaybackState
(
playbackState
).
then
(()
=>
{
console
.
info
(
'
SetAVPlaybackState successfully
'
);
console
.
info
(
`SetAVPlaybackState successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVPlaybackState BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVPlaybackState BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1078,7 +1078,7 @@ session.setAVPlaybackState(PlaybackState, function (err) {
...
@@ -1078,7 +1078,7 @@ session.setAVPlaybackState(PlaybackState, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SetAVPlaybackState BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVPlaybackState BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SetAVPlaybackState successfully
'
);
console
.
info
(
`SetAVPlaybackState successfully`
);
}
}
});
});
```
```
...
@@ -1144,7 +1144,7 @@ let queueItem_2 = {
...
@@ -1144,7 +1144,7 @@ let queueItem_2 = {
};
};
let
queueItemsArray
=
[
queueItem_1
,
queueItem_2
];
let
queueItemsArray
=
[
queueItem_1
,
queueItem_2
];
session
.
setAVQueueItems
(
queueItemsArray
).
then
(()
=>
{
session
.
setAVQueueItems
(
queueItemsArray
).
then
(()
=>
{
console
.
info
(
'
SetAVQueueItems successfully
'
);
console
.
info
(
`SetAVQueueItems successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVQueueItems BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVQueueItems BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1209,7 +1209,7 @@ session.setAVQueueItems(queueItemsArray, function (err) {
...
@@ -1209,7 +1209,7 @@ session.setAVQueueItems(queueItemsArray, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SetAVQueueItems BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVQueueItems BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SetAVQueueItems successfully
'
);
console
.
info
(
`SetAVQueueItems successfully`
);
}
}
});
});
```
```
...
@@ -1249,7 +1249,7 @@ setAVQueueTitle(title: string): Promise\<void>
...
@@ -1249,7 +1249,7 @@ setAVQueueTitle(title: string): Promise\<void>
```
js
```
js
let
queueTitle
=
'
QUEUE_TITLE
'
;
let
queueTitle
=
'
QUEUE_TITLE
'
;
session
.
setAVQueueTitle
(
queueTitle
).
then
(()
=>
{
session
.
setAVQueueTitle
(
queueTitle
).
then
(()
=>
{
console
.
info
(
'
SetAVQueueTitle successfully
'
);
console
.
info
(
`SetAVQueueTitle successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVQueueTitle BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVQueueTitle BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1288,7 +1288,7 @@ session.setAVQueueTitle(queueTitle, function (err) {
...
@@ -1288,7 +1288,7 @@ session.setAVQueueTitle(queueTitle, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SetAVQueueTitle BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetAVQueueTitle BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SetAVQueueTitle successfully
'
);
console
.
info
(
`SetAVQueueTitle successfully`
);
}
}
});
});
```
```
...
@@ -1358,7 +1358,7 @@ let wantAgentInfo = {
...
@@ -1358,7 +1358,7 @@ let wantAgentInfo = {
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
agent
)
=>
{
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
agent
)
=>
{
session
.
setLaunchAbility
(
agent
).
then
(()
=>
{
session
.
setLaunchAbility
(
agent
).
then
(()
=>
{
console
.
info
(
'
SetLaunchAbility successfully
'
);
console
.
info
(
`SetLaunchAbility successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SetLaunchAbility BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetLaunchAbility BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1428,7 +1428,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
...
@@ -1428,7 +1428,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SetLaunchAbility BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SetLaunchAbility BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SetLaunchAbility successfully
'
);
console
.
info
(
`SetLaunchAbility successfully`
);
}
}
});
});
});
});
...
@@ -1689,7 +1689,7 @@ activate(): Promise\<void>
...
@@ -1689,7 +1689,7 @@ activate(): Promise\<void>
```
js
```
js
session
.
activate
().
then
(()
=>
{
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
Activate : SUCCESS
'
);
console
.
info
(
`Activate : SUCCESS `
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`Activate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Activate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1726,7 +1726,7 @@ session.activate(function (err) {
...
@@ -1726,7 +1726,7 @@ session.activate(function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`Activate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Activate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
Activate : SUCCESS
'
);
console
.
info
(
`Activate : SUCCESS `
);
}
}
});
});
```
```
...
@@ -1759,7 +1759,7 @@ deactivate(): Promise\<void>
...
@@ -1759,7 +1759,7 @@ deactivate(): Promise\<void>
```
js
```
js
session
.
deactivate
().
then
(()
=>
{
session
.
deactivate
().
then
(()
=>
{
console
.
info
(
'
Deactivate : SUCCESS
'
);
console
.
info
(
`Deactivate : SUCCESS `
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`Deactivate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Deactivate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1798,7 +1798,7 @@ session.deactivate(function (err) {
...
@@ -1798,7 +1798,7 @@ session.deactivate(function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`Deactivate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Deactivate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
Deactivate : SUCCESS
'
);
console
.
info
(
`Deactivate : SUCCESS `
);
}
}
});
});
```
```
...
@@ -1831,7 +1831,7 @@ destroy(): Promise\<void>
...
@@ -1831,7 +1831,7 @@ destroy(): Promise\<void>
```
js
```
js
session
.
destroy
().
then
(()
=>
{
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -1868,7 +1868,7 @@ session.destroy(function (err) {
...
@@ -1868,7 +1868,7 @@ session.destroy(function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}
}
});
});
```
```
...
@@ -1902,25 +1902,25 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind',
...
@@ -1902,25 +1902,25 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind',
```
js
```
js
session
.
on
(
'
play
'
,
()
=>
{
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
on play entry
'
);
console
.
info
(
`on play entry`
);
});
});
session
.
on
(
'
pause
'
,
()
=>
{
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
on pause entry
'
);
console
.
info
(
`on pause entry`
);
});
});
session
.
on
(
'
stop
'
,
()
=>
{
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
on stop entry
'
);
console
.
info
(
`on stop entry`
);
});
});
session
.
on
(
'
playNext
'
,
()
=>
{
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
on playNext entry
'
);
console
.
info
(
`on playNext entry`
);
});
});
session
.
on
(
'
playPrevious
'
,
()
=>
{
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
on playPrevious entry
'
);
console
.
info
(
`on playPrevious entry`
);
});
});
session
.
on
(
'
fastForward
'
,
()
=>
{
session
.
on
(
'
fastForward
'
,
()
=>
{
console
.
info
(
'
on fastForward entry
'
);
console
.
info
(
`on fastForward entry`
);
});
});
session
.
on
(
'
rewind
'
,
()
=>
{
session
.
on
(
'
rewind
'
,
()
=>
{
console
.
info
(
'
on rewind entry
'
);
console
.
info
(
`on rewind entry`
);
});
});
```
```
...
@@ -2744,7 +2744,7 @@ skipToQueueItem(itemId: number): Promise\<void>
...
@@ -2744,7 +2744,7 @@ skipToQueueItem(itemId: number): Promise\<void>
```
js
```
js
let
queueItemId
=
0
;
let
queueItemId
=
0
;
controller
.
skipToQueueItem
(
queueItemId
).
then
(()
=>
{
controller
.
skipToQueueItem
(
queueItemId
).
then
(()
=>
{
console
.
info
(
'
SkipToQueueItem successfully
'
);
console
.
info
(
`SkipToQueueItem successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SkipToQueueItem BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SkipToQueueItem BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -2783,7 +2783,7 @@ controller.skipToQueueItem(queueItemId, function (err) {
...
@@ -2783,7 +2783,7 @@ controller.skipToQueueItem(queueItemId, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SkipToQueueItem BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SkipToQueueItem BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SkipToQueueItem successfully
'
);
console
.
info
(
`SkipToQueueItem successfully`
);
}
}
});
});
```
```
...
@@ -2967,7 +2967,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
...
@@ -2967,7 +2967,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
SendAVKeyEvent Successfully
'
);
console
.
info
(
`SendAVKeyEvent Successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SendAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -3011,7 +3011,7 @@ controller.sendAVKeyEvent(event, function (err) {
...
@@ -3011,7 +3011,7 @@ controller.sendAVKeyEvent(event, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SendAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SendAVKeyEvent Successfully
'
);
console
.
info
(
`SendAVKeyEvent Successfully`
);
}
}
});
});
```
```
...
@@ -3222,7 +3222,7 @@ destroy(): Promise\<void>
...
@@ -3222,7 +3222,7 @@ destroy(): Promise\<void>
```
js
```
js
controller
.
destroy
().
then
(()
=>
{
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -3259,7 +3259,7 @@ controller.destroy(function (err) {
...
@@ -3259,7 +3259,7 @@ controller.destroy(function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}
}
});
});
```
```
...
@@ -3342,6 +3342,10 @@ sendControlCommand(command: AVControlCommand): Promise\<void>
...
@@ -3342,6 +3342,10 @@ sendControlCommand(command: AVControlCommand): Promise\<void>
通过控制器发送命令到其对应的会话。结果通过Promise异步回调方式返回。
通过控制器发送命令到其对应的会话。结果通过Promise异步回调方式返回。
> **说明:**
>
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**系统接口:**
该接口为系统接口
...
@@ -3385,7 +3389,7 @@ let avCommand = {command:'play'};
...
@@ -3385,7 +3389,7 @@ let avCommand = {command:'play'};
// let avCommand = {command:'setLoopMode', parameter:avSession.LoopMode.LOOP_MODE_SINGLE};
// let avCommand = {command:'setLoopMode', parameter:avSession.LoopMode.LOOP_MODE_SINGLE};
// let avCommand = {command:'toggleFavorite', parameter:"false"};
// let avCommand = {command:'toggleFavorite', parameter:"false"};
controller
.
sendControlCommand
(
avCommand
).
then
(()
=>
{
controller
.
sendControlCommand
(
avCommand
).
then
(()
=>
{
console
.
info
(
'
SendControlCommand successfully
'
);
console
.
info
(
`SendControlCommand successfully`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
console
.
info
(
`SendControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
});
...
@@ -3397,6 +3401,10 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): v
...
@@ -3397,6 +3401,10 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): v
通过会话控制器发送命令到其对应的会话。结果通过callback异步回调方式返回。
通过会话控制器发送命令到其对应的会话。结果通过callback异步回调方式返回。
> **说明:**
>
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
**系统接口:**
该接口为系统接口
...
@@ -3438,7 +3446,7 @@ controller.sendControlCommand(avCommand, function (err) {
...
@@ -3438,7 +3446,7 @@ controller.sendControlCommand(avCommand, function (err) {
if
(
err
)
{
if
(
err
)
{
console
.
info
(
`SendControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
console
.
info
(
`SendControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
}
else
{
console
.
info
(
'
SendControlCommand successfully
'
);
console
.
info
(
`SendControlCommand successfully`
);
}
}
});
});
```
```
...
@@ -3736,7 +3744,7 @@ on(type: 'sessionDestroy', callback: () => void)
...
@@ -3736,7 +3744,7 @@ on(type: 'sessionDestroy', callback: () => void)
```
js
```
js
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
console
.
info
(
'
on sessionDestroy : SUCCESS
'
);
console
.
info
(
`on sessionDestroy : SUCCESS `
);
});
});
```
```
...
@@ -4339,4 +4347,6 @@ controller.off('outputDeviceChange');
...
@@ -4339,4 +4347,6 @@ controller.off('outputDeviceChange');
| ERR_CODE_REMOTE_CONNECTION_ERR | 6600104 | The remote session connection failed. |
| ERR_CODE_REMOTE_CONNECTION_ERR | 6600104 | The remote session connection failed. |
| ERR_CODE_COMMAND_INVALID | 6600105 | Invalid session command. |
| ERR_CODE_COMMAND_INVALID | 6600105 | Invalid session command. |
| ERR_CODE_SESSION_INACTIVE | 6600106 | The session is not activated. |
| ERR_CODE_SESSION_INACTIVE | 6600106 | The session is not activated. |
| ERR_CODE_MESSAGE_OVERLOAD | 6600107 | Too many commands or events. |
| ERR_CODE_MESSAGE_OVERLOAD | 6600107 | Too many commands or events. |
\ No newline at end of file
<!--no_check-->
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录