From cfc515fa567a350202df9543d2df430c7315deab Mon Sep 17 00:00:00 2001
From: yujiaxinwt <1157613664@qq.com>
Date: Tue, 7 Nov 2023 16:31:32 +0800
Subject: [PATCH] =?UTF-8?q?sdk=E6=8F=90=E4=BE=9Bhome=E3=80=81back=E3=80=81?=
=?UTF-8?q?menu=E6=8E=A5=E5=8F=A3=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 30 ++++++++++++++++++++++++++++++
sdk/demo/demo.html | 45 +++++++++++++++++++--------------------------
sdk/index.html | 45 +++++++++++++++++++--------------------------
sdk/src/CloudApp.js | 12 ++++++++++--
4 files changed, 78 insertions(+), 54 deletions(-)
diff --git a/README.md b/README.md
index b14abb8..87465c9 100644
--- a/README.md
+++ b/README.md
@@ -266,6 +266,36 @@ Chrome restricts the usage of WebCryptographyApi to secure origins. It means 'ht
| delay | number | 网络时延,单位是ms |
| bitrate | number | 码率,单位是kbps |
+### 4.12 云手机桌面(home)功能
+
+- 接口介绍
+
+ cloudApp.home();
+
+- 功能描述
+
+ 进入云手机桌面。
+
+### 4.13 云手机回退(back)功能
+
+- 接口介绍
+
+ cloudApp.back();
+
+- 功能描述
+
+ 应用退出、返回上一步。
+
+### 4.14 云手机多任务(menu)功能
+
+- 接口介绍
+
+ cloudApp.menu();
+
+- 功能描述
+
+ 进入云手机多任务页面。
+
### 5. 开发指导
### 6. license
Apache License 2.0。
\ No newline at end of file
diff --git a/sdk/demo/demo.html b/sdk/demo/demo.html
index dc8a403..cb58d92 100644
--- a/sdk/demo/demo.html
+++ b/sdk/demo/demo.html
@@ -399,9 +399,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
退出云手机
-
-
-
+
+
+
@@ -444,9 +444,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
-
-
-
+
+
+
@@ -774,27 +774,20 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
console.log("Is in fullscreen?", cloudapp.isFullscreen());
}
- function sendKeyCodeCmd(code) {
- // keyCodeType与PROTOCOL_CONFIG中KEYEVENT_KEYCODE_TYPE对应
- let keyCodeType = '';
- switch (code) {
- case 4:
- keyCodeType = 'KEYCODE_BACK';
- break;
- case 3:
- keyCodeType = 'KEYCODE_HOME';
- break;
- case 187:
- keyCodeType = 'KEYCODE_APP_SWITCH';
- break;
- default:
- break;
- }
- cloudapp.sendKeyCodeCmd(keyCodeType);
+ function sendKeyCodeBack() {
+ cloudapp.back();
+ }
+
+ function sendKeyCodeHome() {
+ cloudapp.home();
const buttonModalEle = document.getElementById('buttonModal');
- if (keyCodeType !== 'KEYCODE_BACK') {
- buttonModalEle.style.display = 'none';
- }
+ buttonModalEle.style.display = 'none';
+ }
+
+ function sendKeyCodeMenu() {
+ cloudapp.menu();
+ const buttonModalEle = document.getElementById('buttonModal');
+ buttonModalEle.style.display = 'none';
}
function setResolution() {
diff --git a/sdk/index.html b/sdk/index.html
index dc8a403..cb58d92 100644
--- a/sdk/index.html
+++ b/sdk/index.html
@@ -399,9 +399,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
退出云手机
-
-
-
+
+
+
@@ -444,9 +444,9 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
-
-
-
+
+
+
@@ -774,27 +774,20 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
console.log("Is in fullscreen?", cloudapp.isFullscreen());
}
- function sendKeyCodeCmd(code) {
- // keyCodeType与PROTOCOL_CONFIG中KEYEVENT_KEYCODE_TYPE对应
- let keyCodeType = '';
- switch (code) {
- case 4:
- keyCodeType = 'KEYCODE_BACK';
- break;
- case 3:
- keyCodeType = 'KEYCODE_HOME';
- break;
- case 187:
- keyCodeType = 'KEYCODE_APP_SWITCH';
- break;
- default:
- break;
- }
- cloudapp.sendKeyCodeCmd(keyCodeType);
+ function sendKeyCodeBack() {
+ cloudapp.back();
+ }
+
+ function sendKeyCodeHome() {
+ cloudapp.home();
const buttonModalEle = document.getElementById('buttonModal');
- if (keyCodeType !== 'KEYCODE_BACK') {
- buttonModalEle.style.display = 'none';
- }
+ buttonModalEle.style.display = 'none';
+ }
+
+ function sendKeyCodeMenu() {
+ cloudapp.menu();
+ const buttonModalEle = document.getElementById('buttonModal');
+ buttonModalEle.style.display = 'none';
}
function setResolution() {
diff --git a/sdk/src/CloudApp.js b/sdk/src/CloudApp.js
index 837a5fd..1551a3d 100644
--- a/sdk/src/CloudApp.js
+++ b/sdk/src/CloudApp.js
@@ -80,8 +80,16 @@ class CloudApp {
this.channel.sendDataToCloudApp(data);
}
- sendKeyCodeCmd(keyCodeType) {
- this.channel.sendKeyCodeMsg(keyCodeType);
+ home() {
+ this.channel.sendKeyCodeMsg('KEYCODE_HOME');
+ }
+
+ back() {
+ this.channel.sendKeyCodeMsg('KEYCODE_BACK');
+ }
+
+ menu() {
+ this.channel.sendKeyCodeMsg('KEYCODE_APP_SWITCH');
}
_getChannel(containerId, options) {
--
Gitee