方法 | 描述 |
|---|---|
first-remote-video-render 事件 | |
message 事件 | |
运行过程中,云机实例发送到客户端的消息已接收回调 | |
clipboard-message-received 事件 | |
error 事件 | |
warning 事件 | |
message-channel-connected 事件 | |
message-channel-online 事件 | |
message-channel-offline 事件 | |
stream-reconnecting 事件 | |
stream-reconnected 事件 | |
remote-app-switched-background 事件 | |
remote-app-switched-foreground 事件 | |
remote-stream-start-request 事件 | |
remote-stream-stop-request 事件 | |
start-audio-capture 事件 | |
stop-audio-capture 事件 | |
start-video-capture 事件 | |
stop-video-capture 事件 | |
audio-playback-route-updated 事件 | |
audio-capture-route-updated 事件 | |
send-stream-stats 事件 | |
received-stream-stats 事件 | |
video-capture-route-updated 事件 | |
local-audio-stream-state 事件 | |
focused-window 事件 | |
on-screen-record-response 事件 | |
network-quality 事件 | |
on-navbar-status 事件 | |
shake-response 事件 | |
on-screen-rotation 事件 | |
on-camera-inject-status 事件 | |
'on-send-file-done 事件 | |
on-send-file-progress 事件 | |
on-send-file-info 事件 | |
on-send-file-error 事件 | |
on-send-file-message-error 事件 | |
on-send-file-request-error 事件 | |
on-download-file-done 事件 | |
on-download-file-progress 事件 | |
on-download-file-request-error 事件 | |
on-download-file-message-error 事件 | |
云机实例分辨率发生变更时回调 | |
初次进房时,主动获取云机实例分辨率 | |
音频注入状态发生变化时回调 | |
视频注入状态发生变化时回调 | |
清晰度变更时回调 | |
指令分发模式下监听分发pod是否断开 | |
应用启动结果回调 | |
应用崩溃回调 | |
用户在云手机画面的鼠标或触控操作数据的回调 | |
本地截图回调 | |
本地键盘开启回调 | |
本地键盘关闭回调 |
类型:interface
first-remote-video-render 事件
SDK 拉流首帧事件,客户端视频首帧渲染成功时触发的回调
vePlayer.on('first-remote-video-render', () => { // do something });
message 事件
运行过程中,云机实例发送到客户端的自定义消息事件回调
类型
(response: { userId: string; text: string; mid: string; time: number;}) => void
参数
{ userId: string; text: string; mid: string; time: number; }成员
名称 | 类型 | 描述 |
|---|---|---|
userId |
| 消息发送方的用 ID |
text |
| 消息内容 |
mid |
| 消息唯一标识 ID |
time |
| 消息发送时的时间戳 |
示例
vePlayer.on('message', (res) => { console.log(res); });
运行过程中,云机实例发送到客户端的消息已接收回调
类型
(response: { from: string; to: string; msg: any;}) => void
参数
{ from: string; to: string; msg: any; }成员
名称 | 类型 | 描述 |
|---|---|---|
from |
| 消息发送端 ID |
to |
| 消息接收端 ID |
msg |
| 消息内容 |
示例
vePlayer.on('general-message-received', (res) => { console.log(res); });
clipboard-message-received 事件
运行过程中,云机实例剪贴板发生变化时的回调。
类型
(response: string[]) => void
参数
string[]示例
vePlayer.on('clipboard-message-received', (res) => { console.log(res[0]); });
error 事件
SDK 运行过程中的错误回调
类型
(err: { errorCode: number; errorMessage: string;}) => void
参数
{ errorCode: number; errorMessage: string; }成员
名称 | 类型 | 描述 |
|---|---|---|
errorCode |
| 错误码 |
errorMessage |
| 错误信息 |
示例
vePlayer.on('error', (err) => { console.log(err); });
warning 事件
SDK 运行过程中的警告回调
类型
(warning: { warningCode: number; message: string;}) => void ts
参数
{ warningCode: number; message: string; }成员
名称 | 类型 | 描述 |
|---|---|---|
warningCode |
| 警告码 |
message |
| 警告信息 |
示例
vePlayer.on('warning', (warning) => { console.log(err); });
message-channel-connected 事件
消息收发通道就绪的事件
类型
() => void
示例
vePlayer.on('message-channel-connected', () => { });
message-channel-online 事件
通过消息通道收发消息时,云机实例在线的回调
类型
() => void
示例
vePlayer.on('message-channel-online', () => { });
message-channel-offline 事件
通过消息通道收发消息时,云机实例离线的回调(发送消息可能失败)
类型
() => void
示例
vePlayer.on('message-channel-offline', () => { });
stream-reconnecting 事件
视频流开始重连的回调
类型
() => void
示例
vePlayer.on('stream-reconnecting', () => { });
stream-reconnected 事件
视频流重连成功的回调
类型
() => void
示例
vePlayer.on('stream-reconnected', () => { });
remote-app-switched-background 事件
云机应用切换到后台的回调
类型
() => void
示例
vePlayer.on('remote-app-switched-background', () => { });
remote-app-switched-foreground 事件
云机应用切换到前台的回调
类型
() => void
示例
vePlayer.on('remote-app-switched-foreground', () => { });
remote-stream-start-request 事件
收到云机请求开始音视频数据事件回调。
类型
(response: { isAudio: boolean; isVideo: boolean; videoWidth?: number; videoHeight?: number; facingMode: string;}) => void
参数
{ isAudio: boolean; isVideo: boolean; videoWidth?: number | undefined; videoHeight?: number | undefined; facingMode: 'user' | 'environment'; }成员
名称 | 类型 | 描述 |
|---|---|---|
isAudio |
| 是否音屏 |
isVideo |
| 是否视频 |
videoWidth |
| 视频宽度 |
videoHeight |
| 视频高度 |
facingMode |
| 云手机的摄像头类型。包含以下值:
人脸识别类场景中,可以使用该参数判断是否增加亮度调节提示,以提升人脸识别成功率。 |
示例
vePlayer.on('remote-stream-start-request', (res) => { console.log(res); });
remote-stream-stop-request 事件
收到云机请求停止音频数据事件回调。
类型
(response: { isAudio: boolean; isVideo: boolean;}) => void
参数
{ isAudio: boolean; isVideo: boolean; }成员
名称 | 类型 | 描述 |
|---|---|---|
isAudio |
| 是否音屏 |
isVideo |
| 是否视频 |
示例
vePlayer.on('remote-stream-stop-request', (res) => { console.log(res); });
start-audio-capture 事件
音频采集开始回调。
类型
() => void
示例
vePlayer.on('start-audio-capture', () => { });
stop-audio-capture 事件
音频采集结束回调。
类型
() => void
示例
vePlayer.on('stop-audio-capture', () => { });
start-video-capture 事件
相机采集开始回调。
类型
() => void
示例
vePlayer.on('start-video-capture', () => { });
stop-video-capture 事件
相机采集结束回调。
类型
() => void
示例
vePlayer.on('stop-video-capture', () => { });
audio-playback-route-updated 事件
更新音频播放设备回调。
类型
(response: { deviceId: string;}) => void
参数
{ deviceId: string; }成员
名称 | 类型 | 描述 |
|---|---|---|
deviceId |
| 设备Id |
示例
vePlayer.on('audio-playback-route-updated', (res) => { console.log(res); });
audio-capture-route-updated 事件
更新音频采集设备回调。
类型
(response: { deviceId: string;}) => void
参数
{ deviceId: string; }成员
名称 | 类型 | 描述 |
|---|---|---|
deviceId |
| 设备Id |
示例
vePlayer.on('audio-capture-route-updated', (res) => { console.log(res); });
send-stream-stats 事件
发送流状态回调。
类型
(response: { stats: LocalAudioStats;}) => void
参数
{ stats: LocalAudioStats; }成员
名称 | 类型 | 描述 |
|---|---|---|
stats |
| 本地音频流统计信息及网络状况 |
示例
vePlayer.on('send-stream-stats', (res) => { console.log(res); });
received-stream-stats 事件
接收流状态回调。
类型
(response: { stats: LocalVideoStats;}) => void
参数
{ stats: LocalVideoStats; }成员
名称 | 类型 | 描述 |
|---|---|---|
stats |
| 本地音频流统计信息以及网络状况 |
示例
vePlayer.on('received-stream-stats', (res) => { console.log(res.stats); });
video-capture-route-updated 事件
更新相机采集设备回调。
类型
(response: { deviceId: string;}) => void
参数
{ deviceId: string; }成员
名称 | 类型 | 描述 |
|---|---|---|
deviceId |
| 设备Id |
示例
vePlayer.on('video-capture-route-updated', (res) => { const {deviceId} = res });
local-audio-stream-state 事件
本地音频流状态回调。
类型
(response: { deviceId: string; state: LocalAudioStats;}) => void
参数
{ deviceId: string; state: LocalAudioStats; }成员
名称 | 类型 | 描述 |
|---|---|---|
deviceId |
| 设备Id |
state |
| 本地音频流统计信息以及网络状况 |
示例
vePlayer.on('local-audio-stream-state', (res) => { const {state,deviceId} = res });
focused-window 事件
获取当前屏幕焦点应用回调。
类型
(response: { code: number; packageName: string; msg: string;}) => void
参数
{ code: number; packageName: string; msg: string; }成员
名称 | 类型 | 描述 |
|---|---|---|
code |
| 返回码,0:成功并返回应用包名,其他为失败错误码 |
packageName |
| 当前屏幕焦点应用包名 |
msg |
| 提示信息 |
示例
vePlayer.on('focused-window', (res) => { const {code,packageName,msg} = res });
on-screen-record-response 事件
云手机录屏结果回调。
类型
(response: { status: number; savePath: string; downloadUrl?: string;}) => void
参数
{ status: number; savePath: string; downloadUrl?: string | undefined; }成员
名称 | 类型 | 描述 |
|---|---|---|
status |
| 云手机录屏状态: |
savePath |
| 保存录像文件的完整路径,默认为 |
downloadUrl |
| (result 为 0 时返回)录屏文件下载链接 |
示例
vePlayer.on('on-screen-record-response', (res) => { const {status,savePath,downloadUrl} = res });
network-quality 事件
网络质量检测回调。
类型
(quality: any) => void
参数
any示例
vePlayer.on('network-quality', (quality) => { console.log(quality) });
on-navbar-status 事件
获取云手机导航栏开关状态回调。
类型
(response: { status: number; reason: number;}) => void
参数
{ status: number; reason: number; }成员
名称 | 类型 | 描述 |
|---|---|---|
status |
| 导航栏状态 |
reason |
| 触发原因 |
示例
vePlayer.on('on-navbar-status', (res) => { const {status,reason} = res });
shake-response 事件
摇一摇结果回调。
类型
(response: any) => void
参数
any示例
vePlayer.on('shake-response', (res) => { console.log(res) });
on-screen-rotation 事件
屏幕旋转结果回调。
类型
(response: { appOriginDirection: string; streamDirection: string; uiDomRotation: number;}) => void
参数
{ appOriginDirection: string; streamDirection: string; uiDomRotation: number; }成员
名称 | 类型 | 描述 |
|---|---|---|
appOriginDirection |
| 当前云手机中应用的显示方向: |
streamDirection |
| 当前客户端拉取视频流的方向: |
uiDomRotation |
| 云手机本身旋转角度(顺时针): |
示例
vePlayer.on('on-screen-rotation', (res) => { const {appOriginDirection,streamDirection,uiDomRotation} = res });
on-camera-inject-status 事件
视频源状态变化回调。
类型
(response: { status: number; errorCode: number; path?: string;}) => void
参数
{ status: number; errorCode: number; path?: string | undefined; }成员
名称 | 类型 | 描述 |
|---|---|---|
status |
| 视频源状态 |
errorCode |
| 错误码 |
path |
| 播放路径(仅mp4注入时存在) |
示例
vePlayer.on('on-camera-inject-status', (res) => { const {status,errorCode} = res });
'on-send-file-done 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-send-file-done', (res) => { console.log(res) });
on-send-file-progress 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-send-file-progress', (res) => { console.log(res) });
on-send-file-info 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-send-file-info', (res) => { console.log(res) });
on-send-file-error 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-send-file-error', (res) => { console.log(res) });
on-send-file-message-error 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-send-file-message-error', (res) => { console.log(res) });
on-send-file-request-error 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-send-file-request-error', (res) => { console.log(res) });
on-download-file-done 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-download-file-done', (res) => { console.log(res) });
on-download-file-progress 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-download-file-progress', (res) => { console.log(res) });
on-download-file-request-error 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-download-file-request-error', (res) => { console.log(res) });
on-download-file-message-error 事件
大文件传输事件
类型
(response: any) => void
参数
any示例
vePlayer.on('on-download-file-message-error', (res) => { console.log(res) });
云机实例分辨率发生变更时回调
类型
(response: { width: boolean; height: boolean; callUserId?: number;}) => void
参数
{ width: boolean; height: boolean; callUserId?: number | undefined; }成员
名称 | 类型 | 描述 |
|---|---|---|
width |
| 云机实例宽度 |
height |
| 云机实例高度 |
callUserId |
| 设置云机实例全面屏状态的用户ID |
初次进房时,主动获取云机实例分辨率
类型
(response: { width: boolean; height: boolean;}) => void
参数
{ width: boolean; height: boolean; }成员
名称 | 类型 | 描述 |
|---|---|---|
width |
| 云机实例宽度 |
height |
| 云机实例高度 |
音频注入状态发生变化时回调
类型
(response: { state: boolean; code: number; userId?: string; msg?: string;}) => void
参数
{ state: boolean; code: number; userId?: string | undefined; msg?: string | undefined; }成员
名称 | 类型 | 描述 |
|---|---|---|
state |
| 音频注入状态
|
code |
| 当前设置是否成功
|
userId |
| 调用 setAudioInjectionState 方法开启/关闭音频注入功能的用户的 Id |
msg |
| 错误信息 |
视频注入状态发生变化时回调
类型
(response: { state: boolean; code: number; userId?: string; msg?: string;}) => void
参数
{ state: boolean; code: number; userId?: string | undefined; msg?: string | undefined; }成员
名称 | 类型 | 描述 |
|---|---|---|
state |
| 视频注入状态
|
code |
| 当前设置是否成功
|
userId |
| 调用 setVideoInjectionState 方法开启/关闭视频注入功能的用户的 Id |
msg |
| 错误信息 |
清晰度变更时回调
类型
(response: { from: number; current: number; result: number; userId?: number;}) => void
参数
{ from: number; current: number; result: number; userId?: number | undefined; }成员
名称 | 类型 | 描述 |
|---|---|---|
from |
| 清晰度变更前对应的清晰度ID |
current |
| 当前清晰度ID |
result |
| 清晰度变更结果 |
userId |
| 操作用户对应userId |
群控模式下监听从控pod是否断开
类型
(response: { podType: number; roomState: number; podList: number;}) => void
参数
{ podType: number; roomState: number; podList: number; }成员
名称 | 类型 | 描述 |
|---|---|---|
podType |
| 0 表示被控,1表示主控 |
roomState |
| 0 表示退房, 1表示加房 |
podList |
| pod列表 |
云手机内应用程序启动结果回调
类型
(response: { code: number; msg: string; packageName: string; timestamp: number }) => void
参数
{ code: number; msg: string; packageName: string; timestamp: number }成员
名称 | 类型 | 描述 |
|---|---|---|
code |
| 结果码。
|
msg |
| 启动结果相关信息。 |
packageName |
| 启动失败的应用包名。 |
timestamp |
| 时间戳。 |
云手机内应用程序崩溃回调
类型
(response: { packageName: string; reason: string; timestamp: number}) => void
参数
{ packageName: string; reason: string; timestamp: number}成员
名称 | 类型 | 描述 |
|---|---|---|
packageName |
| 崩溃的应用包名。 |
timestamp |
| 时间戳。 |
reason |
| 崩溃原因。 |
监听用户在云手机画面的鼠标或触控操作,实时回调操作的详细数据。
类型
(response: { action: number; pointerId: number; x: number; y: number; movementX: number; movementY: number; timestamp: number}[]) => void
参数
{ action: number; pointerId: number; x: number; y: number; movementX: number; movementY: number; timestamp: number}[]成员
名称 | 类型 | 描述 |
|---|---|---|
action |
| 操作类型。
|
pointerId |
| 触点 ID,用于在多点触控场景下区分不同的触点。 |
x |
| 触摸点在水平方向上的归一化坐标(0 到 1 之间,6 位小数)。 |
y |
| 触摸点在垂直方向上的归一化坐标(0 到 1 之间,6 位小数)。 |
movementX |
| 在滑动 ( |
movementX |
| 在滑动 ( |
timestamp |
| 毫秒时间戳。 |
本地截图成功回调。当 screenShotLocal 接口的 autoDownload 参数为 false 时触发,返回图片的临时链接。
类型
(response: { tempUrl: string; width: number; height: number; format: string }) => void
参数
{ tempUrl: string; width: number; height: number; format: string }成员
名称 | 类型 | 描述 |
|---|---|---|
format |
| 图片格式,默认为 “image/png”。 |
width |
| 图片宽度,单位:像素。 |
height |
| 图片高度,单位:像素。 |
tempUrl |
| 图片的临时链接,仅在当前页面生命周期内有效。 |
本地键盘开启回调。云机输入框聚焦时,触发此回调。
类型
(params: { content: string }) => void
参数
{ content: string }成员
名称 | 类型 | 描述 |
|---|---|---|
content |
| 云机输入框内容。 |
本地键盘关闭回调。云机输入框失去焦点时,触发此回调。