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系统预置的播控中心,作为媒体会话控制方与音视频
// 注册服务异常监听
AVSessionManager
.
on
(
'
sessionServiceDie
'
,
()
=>
{
// 服务端异常,应用清理资源
console
.
info
(
'
服务端异常
'
);
console
.
info
(
`服务端异常`
);
})
```
...
...
@@ -153,16 +153,16 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
// 注册会话激活状态变更监听
controller
.
on
(
'
activeStateChange
'
,
(
isActive
)
=>
{
if
(
isActive
)
{
console
.
info
(
'
控制器卡片按键高亮
'
);
console
.
info
(
`控制器卡片按键高亮`
);
}
else
{
console
.
info
(
'
控制器卡片按键变更为无效
'
);
console
.
info
(
`控制器卡片按键变更为无效`
);
}
});
// 注册会话销毁监听
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
console
.
info
(
'
on sessionDestroy : SUCCESS
'
);
info
(
`on sessionDestroy : SUCCESS `
);
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
destroy : SUCCESS
'
);
console
.
info
(
`destroy : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to destroy session. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -290,14 +290,14 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
command
:
'
This is my custom command
'
}
await
controller
.
sendCommonCommand
(
commandName
,
args
).
then
(()
=>
{
console
.
info
(
'
SendCommonCommand successfully
'
);
console
.
info
(
`SendCommonCommand successfully`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to send common command. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
// 设置指定播放列表单项的ID,供session选择播放
let
queueItemId
:
number
=
0
;
await
controller
.
skipToQueueItem
(
queueItemId
).
then
(()
=>
{
console
.
info
(
'
SkipToQueueItem successfully
'
);
console
.
info
(
`SkipToQueueItem successfully`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to skip to queue item. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -316,7 +316,7 @@ OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频
if
(
err
)
{
console
.
error
(
`Failed to destroy controller. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
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 @@
artist
:
'
ARTIST
'
};
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
console
.
info
(
'
SetAVMetadata successfully
'
);
console
.
info
(
`SetAVMetadata successfully`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set AVMetadata. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -87,7 +87,7 @@
if
(
err
)
{
console
.
error
(
`Failed to set AVPlaybackState. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SetAVPlaybackState successfully
'
);
console
.
info
(
`SetAVPlaybackState successfully`
);
}
});
}
...
...
@@ -132,7 +132,7 @@
lyric
:
'
This is my lyric
'
}
await
session
.
dispatchSessionEvent
(
eventName
,
args
).
then
(()
=>
{
console
.
info
(
'
Dispatch session event successfully
'
);
console
.
info
(
`Dispatch session event successfully`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to dispatch session event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
...
...
@@ -150,7 +150,7 @@
extra
:
'
This is my custom meida packet
'
}
await
session
.
setExtras
(
extras
).
then
(()
=>
{
console
.
info
(
'
Set extras successfully
'
);
console
.
info
(
`Set extras successfully`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set extras. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
...
...
@@ -175,23 +175,23 @@
// 一般在监听器中会对播放器做相应逻辑处理
// 不要忘记处理完后需要通过set接口同步播放相关信息,参考上面的用例
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
on play , do play task
'
);
console
.
info
(
`on play , do play task`
);
// do some tasks ···
});
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
on pause , do pause task
'
);
console
.
info
(
`on pause , do pause task`
);
// do some tasks ···
});
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
on stop , do stop task
'
);
console
.
info
(
`on stop , do stop task`
);
// do some tasks ···
});
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
on playNext , do playNext task
'
);
console
.
info
(
`on playNext , do playNext task`
);
// do some tasks ···
});
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
on playPrevious , do playPrevious task
'
);
console
.
info
(
`on playPrevious , do playPrevious task`
);
// do some tasks ···
});
session
.
on
(
'
fastForward
'
,
()
=>
{
...
...
@@ -312,7 +312,7 @@
if
(
err
)
{
console
.
error
(
`Failed to destroy session. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}
});
}
...
...
zh-cn/application-dev/media/using-distributed-avsession.md
浏览文件 @
f3414d48
...
...
@@ -36,13 +36,13 @@
let
audioDevices
;
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
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
)
=>
{
console
.
error
(
`Failed to get devices. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
AVSessionManager
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
createController : SUCCESS
'
);
console
.
info
(
`createController : SUCCESS`
);
}).
catch
((
err
)
=>
{
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();
let
audioDevices
;
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
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
)
=>
{
console
.
info
(
`GetDevices BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
avSession
.
castAudio
(
'
all
'
,
audioDevices
).
then
(()
=>
{
console
.
info
(
'
CreateController : SUCCESS
'
);
console
.
info
(
`CreateController : SUCCESS`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`CreateController BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -498,7 +498,7 @@ let audioRoutingManager = audioManager.getRoutingManager();
let
audioDevices
;
await
audioRoutingManager
.
getDevices
(
audio
.
DeviceFlag
.
OUTPUT_DEVICES_FLAG
).
then
((
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
)
=>
{
console
.
info
(
`GetDevices BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -507,7 +507,7 @@ avSession.castAudio('all', audioDevices, function (err) {
if
(
err
)
{
console
.
info
(
`CastAudio BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
CastAudio : SUCCESS
'
);
console
.
info
(
`CastAudio : SUCCESS `
);
}
});
```
...
...
@@ -622,7 +622,7 @@ on(type: 'sessionServiceDie', callback: () => void): void
```
js
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};
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
(()
=>
{
console
.
info
(
'
SendSystemAVKeyEvent Successfully
'
);
console
.
info
(
`SendSystemAVKeyEvent Successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SendSystemAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -740,7 +740,7 @@ avSession.sendSystemAVKeyEvent(event, function (err) {
if
(
err
)
{
console
.
info
(
`SendSystemAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SendSystemAVKeyEvent : SUCCESS
'
);
console
.
info
(
`SendSystemAVKeyEvent : SUCCESS `
);
}
});
```
...
...
@@ -798,7 +798,7 @@ let avcommand = {command:cmd};
// let cmd : avSession.AVControlCommandType = 'toggleFavorite';
// let avcommand = {command:cmd, parameter:"false"};
avSession
.
sendSystemControlCommand
(
avcommand
).
then
(()
=>
{
console
.
info
(
'
SendSystemControlCommand successfully
'
);
console
.
info
(
`SendSystemControlCommand successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SendSystemControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -855,7 +855,7 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
if
(
err
)
{
console
.
info
(
`SendSystemControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
sendSystemControlCommand successfully
'
);
console
.
info
(
`sendSystemControlCommand successfully`
);
}
});
```
...
...
@@ -931,7 +931,7 @@ let metadata = {
nextAssetId
:
"
121279
"
,
};
session
.
setAVMetadata
(
metadata
).
then
(()
=>
{
console
.
info
(
'
SetAVMetadata successfully
'
);
console
.
info
(
`SetAVMetadata successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVMetadata BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -985,7 +985,7 @@ session.setAVMetadata(metadata, function (err) {
if
(
err
)
{
console
.
info
(
`SetAVMetadata BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SetAVMetadata successfully
'
);
console
.
info
(
`SetAVMetadata successfully`
);
}
});
```
...
...
@@ -1032,7 +1032,7 @@ let playbackState = {
isFavorite
:
true
,
};
session
.
setAVPlaybackState
(
playbackState
).
then
(()
=>
{
console
.
info
(
'
SetAVPlaybackState successfully
'
);
console
.
info
(
`SetAVPlaybackState successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVPlaybackState BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1078,7 +1078,7 @@ session.setAVPlaybackState(PlaybackState, function (err) {
if
(
err
)
{
console
.
info
(
`SetAVPlaybackState BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SetAVPlaybackState successfully
'
);
console
.
info
(
`SetAVPlaybackState successfully`
);
}
});
```
...
...
@@ -1144,7 +1144,7 @@ let queueItem_2 = {
};
let
queueItemsArray
=
[
queueItem_1
,
queueItem_2
];
session
.
setAVQueueItems
(
queueItemsArray
).
then
(()
=>
{
console
.
info
(
'
SetAVQueueItems successfully
'
);
console
.
info
(
`SetAVQueueItems successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVQueueItems BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1209,7 +1209,7 @@ session.setAVQueueItems(queueItemsArray, function (err) {
if
(
err
)
{
console
.
info
(
`SetAVQueueItems BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SetAVQueueItems successfully
'
);
console
.
info
(
`SetAVQueueItems successfully`
);
}
});
```
...
...
@@ -1249,7 +1249,7 @@ setAVQueueTitle(title: string): Promise\<void>
```
js
let
queueTitle
=
'
QUEUE_TITLE
'
;
session
.
setAVQueueTitle
(
queueTitle
).
then
(()
=>
{
console
.
info
(
'
SetAVQueueTitle successfully
'
);
console
.
info
(
`SetAVQueueTitle successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SetAVQueueTitle BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1288,7 +1288,7 @@ session.setAVQueueTitle(queueTitle, function (err) {
if
(
err
)
{
console
.
info
(
`SetAVQueueTitle BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SetAVQueueTitle successfully
'
);
console
.
info
(
`SetAVQueueTitle successfully`
);
}
});
```
...
...
@@ -1358,7 +1358,7 @@ let wantAgentInfo = {
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
agent
)
=>
{
session
.
setLaunchAbility
(
agent
).
then
(()
=>
{
console
.
info
(
'
SetLaunchAbility successfully
'
);
console
.
info
(
`SetLaunchAbility successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SetLaunchAbility BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1428,7 +1428,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => {
if
(
err
)
{
console
.
info
(
`SetLaunchAbility BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SetLaunchAbility successfully
'
);
console
.
info
(
`SetLaunchAbility successfully`
);
}
});
});
...
...
@@ -1689,7 +1689,7 @@ activate(): Promise\<void>
```
js
session
.
activate
().
then
(()
=>
{
console
.
info
(
'
Activate : SUCCESS
'
);
console
.
info
(
`Activate : SUCCESS `
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Activate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1726,7 +1726,7 @@ session.activate(function (err) {
if
(
err
)
{
console
.
info
(
`Activate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
Activate : SUCCESS
'
);
console
.
info
(
`Activate : SUCCESS `
);
}
});
```
...
...
@@ -1759,7 +1759,7 @@ deactivate(): Promise\<void>
```
js
session
.
deactivate
().
then
(()
=>
{
console
.
info
(
'
Deactivate : SUCCESS
'
);
console
.
info
(
`Deactivate : SUCCESS `
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Deactivate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1798,7 +1798,7 @@ session.deactivate(function (err) {
if
(
err
)
{
console
.
info
(
`Deactivate BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
Deactivate : SUCCESS
'
);
console
.
info
(
`Deactivate : SUCCESS `
);
}
});
```
...
...
@@ -1831,7 +1831,7 @@ destroy(): Promise\<void>
```
js
session
.
destroy
().
then
(()
=>
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -1868,7 +1868,7 @@ session.destroy(function (err) {
if
(
err
)
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}
});
```
...
...
@@ -1902,25 +1902,25 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind',
```
js
session
.
on
(
'
play
'
,
()
=>
{
console
.
info
(
'
on play entry
'
);
console
.
info
(
`on play entry`
);
});
session
.
on
(
'
pause
'
,
()
=>
{
console
.
info
(
'
on pause entry
'
);
console
.
info
(
`on pause entry`
);
});
session
.
on
(
'
stop
'
,
()
=>
{
console
.
info
(
'
on stop entry
'
);
console
.
info
(
`on stop entry`
);
});
session
.
on
(
'
playNext
'
,
()
=>
{
console
.
info
(
'
on playNext entry
'
);
console
.
info
(
`on playNext entry`
);
});
session
.
on
(
'
playPrevious
'
,
()
=>
{
console
.
info
(
'
on playPrevious entry
'
);
console
.
info
(
`on playPrevious entry`
);
});
session
.
on
(
'
fastForward
'
,
()
=>
{
console
.
info
(
'
on fastForward entry
'
);
console
.
info
(
`on fastForward entry`
);
});
session
.
on
(
'
rewind
'
,
()
=>
{
console
.
info
(
'
on rewind entry
'
);
console
.
info
(
`on rewind entry`
);
});
```
...
...
@@ -2744,7 +2744,7 @@ skipToQueueItem(itemId: number): Promise\<void>
```
js
let
queueItemId
=
0
;
controller
.
skipToQueueItem
(
queueItemId
).
then
(()
=>
{
console
.
info
(
'
SkipToQueueItem successfully
'
);
console
.
info
(
`SkipToQueueItem successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SkipToQueueItem BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -2783,7 +2783,7 @@ controller.skipToQueueItem(queueItemId, function (err) {
if
(
err
)
{
console
.
info
(
`SkipToQueueItem BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SkipToQueueItem successfully
'
);
console
.
info
(
`SkipToQueueItem successfully`
);
}
});
```
...
...
@@ -2967,7 +2967,7 @@ let keyItem = {code:0x49, pressedTime:2, deviceId:0};
let
event
=
{
action
:
2
,
key
:
keyItem
,
keys
:[
keyItem
]};
controller
.
sendAVKeyEvent
(
event
).
then
(()
=>
{
console
.
info
(
'
SendAVKeyEvent Successfully
'
);
console
.
info
(
`SendAVKeyEvent Successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SendAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -3011,7 +3011,7 @@ controller.sendAVKeyEvent(event, function (err) {
if
(
err
)
{
console
.
info
(
`SendAVKeyEvent BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SendAVKeyEvent Successfully
'
);
console
.
info
(
`SendAVKeyEvent Successfully`
);
}
});
```
...
...
@@ -3222,7 +3222,7 @@ destroy(): Promise\<void>
```
js
controller
.
destroy
().
then
(()
=>
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}).
catch
((
err
)
=>
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -3259,7 +3259,7 @@ controller.destroy(function (err) {
if
(
err
)
{
console
.
info
(
`Destroy BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
Destroy : SUCCESS
'
);
console
.
info
(
`Destroy : SUCCESS `
);
}
});
```
...
...
@@ -3342,6 +3342,10 @@ sendControlCommand(command: AVControlCommand): Promise\<void>
通过控制器发送命令到其对应的会话。结果通过Promise异步回调方式返回。
> **说明:**
>
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
...
...
@@ -3385,7 +3389,7 @@ let avCommand = {command:'play'};
// let avCommand = {command:'setLoopMode', parameter:avSession.LoopMode.LOOP_MODE_SINGLE};
// let avCommand = {command:'toggleFavorite', parameter:"false"};
controller
.
sendControlCommand
(
avCommand
).
then
(()
=>
{
console
.
info
(
'
SendControlCommand successfully
'
);
console
.
info
(
`SendControlCommand successfully`
);
}).
catch
((
err
)
=>
{
console
.
info
(
`SendControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -3397,6 +3401,10 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): v
通过会话控制器发送命令到其对应的会话。结果通过callback异步回调方式返回。
> **说明:**
>
> 媒体控制方在使用sendControlCommand命令前,需要确保控制对应的媒体会话注册了对应的监听,注册媒体会话相关监听的方法请参见接口[注册媒体会话相关监听](#onplaypausestopplaynextplaypreviousfastforwardrewind)。
**系统能力:**
SystemCapability.Multimedia.AVSession.Core
**系统接口:**
该接口为系统接口
...
...
@@ -3438,7 +3446,7 @@ controller.sendControlCommand(avCommand, function (err) {
if
(
err
)
{
console
.
info
(
`SendControlCommand BusinessError: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
'
SendControlCommand successfully
'
);
console
.
info
(
`SendControlCommand successfully`
);
}
});
```
...
...
@@ -3736,7 +3744,7 @@ on(type: 'sessionDestroy', callback: () => void)
```
js
controller
.
on
(
'
sessionDestroy
'
,
()
=>
{
console
.
info
(
'
on sessionDestroy : SUCCESS
'
);
console
.
info
(
`on sessionDestroy : SUCCESS `
);
});
```
...
...
@@ -4340,3 +4348,5 @@ controller.off('outputDeviceChange');
| ERR_CODE_COMMAND_INVALID | 6600105 | Invalid session command. |
| ERR_CODE_SESSION_INACTIVE | 6600106 | The session is not activated. |
| ERR_CODE_MESSAGE_OVERLOAD | 6600107 | Too many commands or events. |
<!--no_check-->
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录