diff --git a/sdk/demo/demo.html b/sdk/demo/demo.html
index 2eff3169e30f9d3eacfcfc35936ecf0e701fd20b..4bdcd17033ad058f69552494e62f42565c6b2bea 100644
--- a/sdk/demo/demo.html
+++ b/sdk/demo/demo.html
@@ -95,6 +95,42 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
.play-ctr-btn-mobile {
flex: 1;
}
+ .message-modal {
+ display: none;
+ width: 300px;
+ height: 200px;
+ position: absolute;
+ z-index: 999;
+ top: 50%;
+ left: 50%;
+ background-color: #fff;
+ border: 1px solid #dfe1e6;
+ border-radius: 5px;
+ transform: translate(-50%, -50%);
+ }
+ .header-content {
+ height: 20%;
+ line-height: 20%;
+ text-align: center;
+ font-size: 16px;
+ }
+ .body-content {
+ text-align: center;
+ height: 40%;
+ }
+
+ .footer-content {
+ height: 20%;
+ border-top: 1px solid #dfe1e6;
+ }
+
+ .button-alone {
+ width: 100%;
+ height: 100%;
+ border: none;
+ text-align: center;
+ background-color: #fff;
+ }
@@ -129,6 +165,17 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
网络时延 ms 码率 kbps
+
@@ -157,6 +204,15 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
diff --git a/sdk/index.html b/sdk/index.html
index 77c56e94a12d66fe599fb449711942c5eb098da9..ad7e654c2107ccb46d48a39c78149b501949ab12 100644
--- a/sdk/index.html
+++ b/sdk/index.html
@@ -16,7 +16,6 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
-
h5 demo
@@ -95,6 +94,43 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
font-size: 14px;
}
+ .message-modal {
+ display: none;
+ width: 300px;
+ height: 200px;
+ position: absolute;
+ z-index: 999;
+ top: 50%;
+ left: 50%;
+ background-color: #fff;
+ border: 1px solid #dfe1e6;
+ border-radius: 5px;
+ transform: translate(-50%, -50%);
+ }
+ .header-content {
+ height: 20%;
+ line-height: 20%;
+ text-align: center;
+ font-size: 16px;
+ }
+ .body-content {
+ text-align: center;
+ height: 40%;
+ }
+
+ .footer-content {
+ height: 20%;
+ border-top: 1px solid #dfe1e6;
+ }
+
+ .button-alone {
+ width: 100%;
+ height: 100%;
+ border: none;
+ text-align: center;
+ background-color: #fff;
+ }
+
@@ -132,6 +168,17 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
网络时延 ms 码率 kbps
+
@@ -170,6 +217,15 @@ Copyright 2022 Huawei Cloud Computing Technology Co., Ltd.
diff --git a/sdk/src/AppController.js b/sdk/src/AppController.js
index 0dad8b1f7f4f724f908443dc94c92da4cac2ce3b..3d23f67b807fe9b4712e360d5eab19121b8f8756 100644
--- a/sdk/src/AppController.js
+++ b/sdk/src/AppController.js
@@ -52,7 +52,8 @@ const APP_STATE_FROM_CLIENT = {
},
'unreachable': {
state: 769,
- message: 'Server unreachable'
+ message: 'Server unreachable',
+ tip: '连接服务器失败,请稍后重试'
},
'reconnecting': {
state: 2816,
@@ -60,9 +61,28 @@ const APP_STATE_FROM_CLIENT = {
},
'exit': {
state: 5888,
- message: 'Cloud Phone exit'
+ message: 'Cloud Phone exit',
+ tip: '已退出'
}
};
+const APP_STATE_ERROR_CODE_TIP = {
+ 5888: '已退出',
+ 769: '连接服务器失败,请稍后重试',
+ 2308: '启动失败',
+ 4353: '启动失败',
+ 770: '资源正在使用中,请稍后',
+ 65535: '与服务器连接出现异常',
+ 1537: '认证失败',
+ 1538: '认证失败',
+ 1539: '认证失败',
+ 1540: '认证失败',
+ 1541: '认证失败',
+ 1542: '认证失败',
+ 3584: '试玩时间已到',
+ 2560: '与服务器连接出现异常',
+ 3840: '由于您长时间未操作游戏,服务断开',
+ 4096: '切换后台超时'
+};
const DEFAULT_VALUME_VALUE = 50;
const WEBSOCKET_READY_STATE = {
CONNECTING: 0,
@@ -643,7 +663,8 @@ class AppController {
break;
}
- this.appState = {state: Number(resp.code), message: resp.msg};
+ const tip = APP_STATE_ERROR_CODE_TIP[resp.code];
+ this.appState = {state: Number(resp.code), message: resp.msg, tip};
this.subscribe.trigger('appStateChange', {...this.appState});
if (needToTellExit) {
this.appState = APP_STATE_FROM_CLIENT.exit;
diff --git a/sdk/src/CanvasPlayer.js b/sdk/src/CanvasPlayer.js
index c6b2e86be944d7174acecdcd9e3342154674c785..69dbb692b3d9f60c4d87b332698bba90e4bb7798 100644
--- a/sdk/src/CanvasPlayer.js
+++ b/sdk/src/CanvasPlayer.js
@@ -39,7 +39,7 @@ class CanvasPlayer extends BaseClass {
/* javascript-obfuscator:enable */
this.videoDecoderWorker.addEventListener('message', this.eventMessageHandel.bind(this));
- this.loadjs();
+ // this.loadjs();
}
setCanvas () {
@@ -57,11 +57,11 @@ class CanvasPlayer extends BaseClass {
});
}
- loadjs() {
+ loadjs(decoderType) {
this.videoDecoderWorker.postMessage({
type: 'loadwasm',
libPath: this.options.libPath,
- decoderType: this.options.decoderType
+ decoderType
})
}
@@ -157,6 +157,7 @@ class CanvasPlayer extends BaseClass {
}
decode(data) {
+ console.log('流数据:', data);
/*global __IS_DEBUG__*/
if (__IS_DEBUG__) {
let traceId = window.delayAnalysis.shiftTraceId('receive') || '';
diff --git a/sdk/src/TouchHandler.js b/sdk/src/TouchHandler.js
index 8ba6370a5eac0a8a11c581fb0744c7779247fbff..73a962860c36f7dc3d475f2e06780463d56a04e0 100644
--- a/sdk/src/TouchHandler.js
+++ b/sdk/src/TouchHandler.js
@@ -432,6 +432,10 @@ export default class TouchHandler {
* touchleave :移动的手指离开一个dom元素。
*/
sendTouchMsg(touch, action) {
+ // 触控点不在player区域,不发送指令
+ if (touch.x > this.displayBox.width || touch.x < 0 || touch.y < 0 || touch.y > this.displayBox.height) {
+ return;
+ }
let oritenation = this.isMobile && this.orientation === ORIENTATION_REVERSE_LANDSCAPE ? 0 : ORIENTATION_ORIGIN[this.orientation];
const msg = {
...touch,