WXtrialInterface.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta name="x5-orientation" content="portrait" />
  7. <meta name="screen-orientation" content="portrait" />
  8. <meta name="apple-mobile-web-app-capable" content="yes">
  9. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  10. <!-- 删除苹果默认的工具栏和菜单栏 -->
  11. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  12. <!-- 设置苹果工具栏颜 -->
  13. <meta name="format-detection" content="telphone=no, email=no">
  14. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  15. <!-- 启用360浏览器的极速模(webkit) -->
  16. <meta name="renderer" content="webkit">
  17. <!-- 避免IE使用兼容模式 -->
  18. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  19. <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑 -->
  20. <meta name="HandheldFriendly" content="true">
  21. <!-- 微软的老式浏览 -->
  22. <meta name="MobileOptimized" content="320">
  23. <!-- 不能旋转,问题出在这 -->
  24. <!-- UC强制全屏 -->
  25. <meta name="full-screen" content="yes">
  26. <!-- QQ强制全屏 -->
  27. <meta name="x5-fullscreen" content="true">
  28. <!-- UC应用模式 -->
  29. <meta name="browsermode" content="application">
  30. <!-- QQ应用模式 -->
  31. <meta name="x5-page-mode" content="app">
  32. <!-- windows phone 点击无高 -->
  33. <meta name="msapplication-tap-highlight" content="no">
  34. <link rel="stylesheet" type="text/css" href="css/WXtrialInterface.css" />
  35. <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css" />
  36. <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css" />
  37. </head>
  38. <body class="scroll h-player" style="overscroll-behavior: contain;">
  39. <div class="container" id="player">
  40. <div class="muted" id="btnMuted">
  41. <div class="control-right-img" data-id="1">
  42. <img src="../static/img/xuanfu_icon.png">
  43. </div>
  44. </div>
  45. <div id="wine">
  46. <div id="box">
  47. <canvas id="playCanvas" width="450" height="800"></canvas>
  48. </div>
  49. </div>
  50. <div class="leftmains">
  51. <div class="PictureQualityMain">
  52. <div class="PictureQuality " data-id="1803000">高清</div>
  53. <div class="PictureQuality avit" data-id="1243000">标清</div>
  54. <div class="PictureQuality" data-id="400000">极速</div>
  55. <div class="PictureQuality" data-id="200">自动</div>
  56. </div>
  57. <div class="operation">
  58. <div class="upload" id="showsuss" data-text="uploads">
  59. <img src="../static/img/wx/shangchuan_icon.png">
  60. <div>上传</div>
  61. </div>
  62. <div class="upload" onclick="showShearPlate()" data-text="Shearplate">
  63. <img src="../static/img/wx/jianqieban_icon.png">
  64. <div>剪贴板</div>
  65. </div>
  66. <div class="upload" id="upload" data-text="Signout">
  67. <img src="../static/img/wx/tuichu_icon.png">
  68. <div>退出</div>
  69. </div>
  70. </div>
  71. </div>
  72. <div class="bottommains">
  73. <div class="botmat1">
  74. <div class="botmat1img" data-text="gengduo">
  75. <img src="../static/img/wx/gengduo_icon.png">
  76. </div>
  77. </div>
  78. <div class="botmat1">
  79. <div class="botmat1img" data-text="home">
  80. <img src="../static/img/wx/home_icon.png">
  81. </div>
  82. </div>
  83. <div class="botmat1">
  84. <div class="botmat1img" data-text="return">
  85. <img src="../static/img/wx/fanhui_icon.png">
  86. </div>
  87. </div>
  88. </div>
  89. <img class="loading loading_sceen_pic" />
  90. </div>
  91. <div class="mask">
  92. <div class="box-shear-plate"></div>
  93. <img class="close" onclick="handleClose()" src="img/guanbi_icon@2x.png" alt="">
  94. </div>
  95. <div class="weui-mask_transparent"></div>
  96. <div class="weui-toast weui_loading_toast weui-toast--visible">
  97. <div class="weui_loading"><i class="weui-loading weui-icon_toast"></i></div>
  98. <p class="weui-toast_content">数据加载中</p>
  99. </div>
  100. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  101. <script src="https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.0.3.js"></script>
  102. <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
  103. <!-- ffm软解 -->
  104. <script type="text/javascript" src="helper.js"></script>
  105. <script type="text/javascript" src="jquery-weui.min.js"></script>
  106. <script type="text/javascript" src="pcm-player.js"></script>
  107. <script type="text/javascript" src="webgl.js"></script>
  108. <script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
  109. <script type="text/javascript" src="WXdraw.js?id=105"></script>
  110. <script type="text/javascript">
  111. $(function () {
  112. //手指滑动多少距离就认为是滑成功
  113. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  114. var diffXDistance = 50;
  115. //当前滑动的对象
  116. var currentObject;
  117. //上一次滑动的对象
  118. var lastObject;
  119. //是否可以左右滑动,在上下滑的时候禁止左右滑
  120. var canSlide = true;
  121. //用于记录按下的点
  122. var startPoint;
  123. $(".slide-content").css({
  124. width: $(".slide-wrapper").width()
  125. });
  126. $(".slide-scroll").css({
  127. width: $(".slide-wrapper").width() + $(".slide-content-button").width()
  128. })
  129. .on('touchstart', function (e) {
  130. currentObject = this;
  131. startPoint = {
  132. x: e.originalEvent.changedTouches[0].pageX,
  133. y: e.originalEvent.changedTouches[0].pageY
  134. };
  135. })
  136. .on('touchmove', function (e) {
  137. //如果是左右滑动,就禁止上下的滑动
  138. //如果是上下的滑动,就禁止左右滑动
  139. if (Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) > Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)) {
  140. event.preventDefault();
  141. } else {
  142. canSlide = false;
  143. }
  144. })
  145. .on('touchend', function (e) {
  146. //如果是上下滑动,这里就直接返回了
  147. if (!canSlide) {
  148. canSlide = true;
  149. return true;
  150. }
  151. //点击除当前左滑对象之外的任意其他位置
  152. if (lastObject && currentObject != lastObject) {
  153. //右滑→
  154. $(lastObject).removeClass("animate-slide");
  155. //清空上一个左滑的对象
  156. lastObject = undefined;
  157. }
  158. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  159. if (diffX < -diffXDistance) {
  160. //左滑←
  161. $(currentObject).addClass("animate-slide");
  162. if (lastObject && lastObject != currentObject) {
  163. //右滑→
  164. $(lastObject).removeClass("animate-slide");
  165. }
  166. //记录上一个左滑的对象
  167. lastObject = currentObject;
  168. } else if (diffX >= diffXDistance) {
  169. if (currentObject == lastObject) {
  170. //右滑→
  171. $(currentObject).removeClass("animate-slide");
  172. //清空上一个左滑的对象
  173. lastObject = undefined;
  174. }
  175. }
  176. });
  177. });
  178. </script>
  179. <script>
  180. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  181. var renderCount = 0
  182. $('#wine').css({
  183. "width": window.screen.width,
  184. "height": window.screen.height - topwinHeight - 20,
  185. "position": "absolute"
  186. })
  187. $('.loading').css({
  188. "width": window.screen.width,
  189. "height": window.screen.height - topwinHeight - 20
  190. });
  191. var winese = document.createElement("wine");
  192. wine.style.top = "-" + winese + 'px';
  193. var isAudioPlay = false;
  194. $.alert({
  195. title: '提示',
  196. text: '开始使用云手机',
  197. onOK: function () {
  198. isAudioPlay = true;
  199. }
  200. });
  201. var url = window.location.href;
  202. url = url.split('/');
  203. var baseUrl = url[0] + '//' + url[2];
  204. var form = {};
  205. var parameters = GetRequest();
  206. form.userCardId = parameters['userCardId'];
  207. form.token = parameters['token'];
  208. var orientation = 0; //0 竖屏,1横屏
  209. function array_unique(arr) {
  210. return arr.filter(function (e, i) {
  211. return arr.indexOf(e) === i;
  212. })
  213. }
  214. var cutList = [];
  215. let timer, isFlag = true;
  216. function showShearPlate() {
  217. stopManyClick(() => {
  218. $('.box-shear-plate').empty();
  219. $.ajax({
  220. url: baseUrl + "/api/public/v5/shear/content",
  221. headers: {
  222. 'Authorization': form.token
  223. },
  224. type: 'get',
  225. dataType: 'json',
  226. success: function (res) {
  227. if (res.status === 0) {
  228. if (res.data.length) {
  229. cutList = array_unique(res.data)
  230. var str = '<div class="title">剪贴板<div onclick="handleClear()" class="btn-clear">清空</div></div><div class="slide-wrapper-content">'
  231. cutList.forEach(function (item) {
  232. str += "<div class='slide-wrapper'><div class='slide-scroll animate-slide-start'><div class='slide-content'><div onclick='handleCopy(\"" + item.content + "\")'>" + item.content + "</div></div><div class='slide-content-button'><button onclick='handleDelete(" + item.id + ")'>删除</button></div></div></div>"
  233. })
  234. str += '</div>'
  235. $('.box-shear-plate').append(str);
  236. } else {
  237. $('.box-shear-plate').append('<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>')
  238. }
  239. $('.mask').show();
  240. initSlider();
  241. } else {
  242. $('.box-shear-plate').append('<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>')
  243. $('.mask').show();
  244. }
  245. }
  246. })
  247. })
  248. }
  249. //防止提示一秒内重复显示
  250. function stopManyClick(fn) {
  251. if (isFlag) {
  252. fn();
  253. }
  254. isFlag = false;
  255. if (timer) { clearTimeout(timer); }
  256. timer = setTimeout(() => { isFlag = true }, 1500);
  257. }
  258. // 清空剪贴板
  259. function handleClear() {
  260. var ids = '';
  261. cutList.forEach(function (item) {
  262. ids += 'ids=' + item.id + '&'
  263. });
  264. ids = ids.substring(0, ids.lastIndexOf('&'));
  265. $.confirm("确定清空剪贴板?", function () {
  266. $.ajax({
  267. url: baseUrl + "/api/public/v5/shear/content?" + ids,
  268. headers: {
  269. 'Authorization': form.token
  270. },
  271. type: 'DELETE',
  272. dataType: 'json',
  273. success: function (res) {
  274. if (res.status === 0) {
  275. showShearPlate();
  276. } else {
  277. $.toast(res.msg, "text");
  278. }
  279. }
  280. })
  281. });
  282. }
  283. function handleCopy(content) {
  284. var cutting = {
  285. "type": "cutting",
  286. "data": {
  287. "str": content
  288. }
  289. }
  290. wsss.send(JSON.stringify(cutting));
  291. }
  292. // 删除剪贴板
  293. function handleDelete(id) {
  294. $.ajax({
  295. url: baseUrl + "/api/public/v5/shear/content?ids=" + id,
  296. headers: {
  297. 'Authorization': form.token
  298. },
  299. type: 'DELETE',
  300. dataType: 'json',
  301. success: function (res) {
  302. if (res.status === 0) {
  303. showShearPlate();
  304. } else {
  305. $.toast(res.msg, "text");
  306. }
  307. }
  308. })
  309. }
  310. function initSlider() {
  311. //手指滑动多少距离就认为是滑成功
  312. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  313. var diffXDistance = 50;
  314. //当前滑动的对象
  315. var currentObject;
  316. //上一次滑动的对象
  317. var lastObject;
  318. //是否可以左右滑动,在上下滑的时候禁止左右滑
  319. var canSlide = true;
  320. //用于记录按下的点
  321. var startPoint;
  322. $(".slide-content").css({
  323. width: $(".slide-wrapper").width()
  324. });
  325. document.body.removeEventListener('touchmove', function (e) {
  326. e.preventDefault()
  327. }, {
  328. passive: false
  329. })
  330. $(".slide-scroll").css({
  331. width: $(".slide-wrapper").width() + $(".slide-content-button").width()
  332. })
  333. .on('touchstart', function (e) {
  334. currentObject = this;
  335. startPoint = {
  336. x: e.originalEvent.changedTouches[0].pageX,
  337. y: e.originalEvent.changedTouches[0].pageY
  338. };
  339. })
  340. .on('touchmove', function (e) {
  341. //如果是左右滑动,就禁止上下的滑动
  342. //如果是上下的滑动,就禁止左右滑动
  343. if (Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) > Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)) {
  344. event.preventDefault();
  345. } else {
  346. canSlide = false;
  347. }
  348. })
  349. .on('touchend', function (e) {
  350. //如果是上下滑动,这里就直接返回了
  351. if (!canSlide) {
  352. canSlide = true;
  353. return true;
  354. }
  355. //点击除当前左滑对象之外的任意其他位置
  356. if (lastObject && currentObject != lastObject) {
  357. //右滑→
  358. $(lastObject).removeClass("animate-slide");
  359. //清空上一个左滑的对象
  360. lastObject = undefined;
  361. }
  362. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  363. if (diffX < -diffXDistance) {
  364. //左滑←
  365. $(currentObject).addClass("animate-slide");
  366. if (lastObject && lastObject != currentObject) {
  367. //右滑→
  368. $(lastObject).removeClass("animate-slide");
  369. }
  370. //记录上一个左滑的对象
  371. lastObject = currentObject;
  372. } else if (diffX >= diffXDistance) {
  373. if (currentObject == lastObject) {
  374. //右滑→
  375. $(currentObject).removeClass("animate-slide");
  376. //清空上一个左滑的对象
  377. lastObject = undefined;
  378. }
  379. }
  380. });
  381. }
  382. // 初始化一下就可以了,
  383. // var vConsole = new VConsole();
  384. var btnMuted = document.querySelector("#btnMuted");
  385. btnMuted && (function () {
  386. var setHistory = function (left, top) {
  387. try {
  388. localStorage.setItem("muted-btn-loc", JSON.stringify({
  389. left: left,
  390. top: top
  391. }));
  392. } catch (ex) { }
  393. };
  394. var getHistory = function () {
  395. try {
  396. var value = localStorage.getItem("muted-btn-loc");
  397. if (!value) return null;
  398. value = JSON.parse(value);
  399. if (!value) return null;
  400. return value;
  401. } catch (ex) {
  402. return null
  403. }
  404. };
  405. var fixLoc = function (loc) {
  406. var rect = btnMuted.getBoundingClientRect();
  407. rect = {
  408. top: rect.top,
  409. left: rect.left,
  410. width: rect.width,
  411. height: rect.height
  412. }; // 部分低版本浏览器,该属性为只读
  413. if (loc) {
  414. rect.left = loc.left;
  415. rect.top = loc.top;
  416. }
  417. var minX = 0;
  418. var minY = 0;
  419. var docRect = document.documentElement.getBoundingClientRect();
  420. var maxY = docRect.height - rect.height;
  421. var maxX = docRect.width - rect.width;
  422. var left = rect.left;
  423. var top = rect.top;
  424. left = Math.min(left, maxX);
  425. left = Math.max(left, minX);
  426. top = Math.min(top, maxY);
  427. top = Math.max(top, minY);
  428. if (loc || top !== rect.top || left !== rect.left) {
  429. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  430. }
  431. }
  432. window.addEventListener("resize", function () {
  433. fixLoc();
  434. });
  435. var touchPoint = {
  436. pageY: 0,
  437. pageX: 0
  438. };
  439. var currentLoc = {
  440. top: 0,
  441. left: 0,
  442. curTop: 0,
  443. curLeft: 0
  444. };
  445. var toMove = false;
  446. var touchmove = function (e) {
  447. e.preventDefault();
  448. var point = e.changedTouches[0];
  449. var top = -touchPoint.pageY + point.pageY;
  450. var left = -touchPoint.pageX + point.pageX;
  451. if (toMove) {
  452. top += currentLoc.top;
  453. left += currentLoc.left;
  454. currentLoc.curLeft = left;
  455. currentLoc.curTop = top;
  456. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  457. } else {
  458. if (Math.abs(top) >= 5 || Math.abs(left) >= 5) {
  459. toMove = true;
  460. }
  461. }
  462. };
  463. var touchend = function () {
  464. window.removeEventListener("touchmove", touchmove, {
  465. passive: false
  466. });
  467. window.removeEventListener("touchend", touchend, {
  468. passive: false
  469. });
  470. if (toMove) {
  471. setHistory(currentLoc.curLeft, currentLoc.curTop);
  472. fixLoc();
  473. } else {
  474. //按点击处理
  475. var set = $('.control-right-img').attr("data-id")
  476. if (set == '1') {
  477. $('.control-right-img').attr({
  478. "data-id": "2"
  479. })
  480. $(".leftmains").css({
  481. "right": "0rem"
  482. })
  483. } else {
  484. $('.control-right-img').attr({
  485. "data-id": "1"
  486. })
  487. $(".leftmains").css({
  488. "right": "-4rem"
  489. })
  490. }
  491. }
  492. }
  493. btnMuted.addEventListener("touchstart", function (e) {
  494. e.preventDefault();
  495. toMove = false;
  496. var point = e.changedTouches[0];
  497. touchPoint.pageX = point.pageX;
  498. touchPoint.pageY = point.pageY;
  499. var rect = e.target.getBoundingClientRect();
  500. currentLoc.top = rect.top;
  501. currentLoc.left = rect.left;
  502. window.addEventListener("touchmove", touchmove, {
  503. passive: false
  504. });
  505. window.addEventListener("touchend", touchend, {
  506. passive: false
  507. });
  508. }, {
  509. passive: false
  510. });
  511. var history = getHistory();
  512. if (history) {
  513. fixLoc(history);
  514. }
  515. btnMuted.classList.remove("hide");
  516. })();
  517. $(".boximg").on("click", function () {
  518. $(".mainbox").css({
  519. "display": "none"
  520. })
  521. })
  522. // 剪贴板
  523. $(".sboxbu").on("click", function () {
  524. $(".sbox").css({
  525. "display": "none"
  526. })
  527. })
  528. // 剪贴板
  529. $(".uploadss").on("click", function () {
  530. $(".sbox").css({
  531. "display": "none"
  532. })
  533. })
  534. $("#upload").on("click", function () {
  535. decodeWoker.postMessage('close');
  536. decodeWoker.terminate();
  537. webSocketWorker.terminate();
  538. if(navigator.userAgent.toLowerCase().includes('toutiaomicroapp')){
  539. tt.miniProgram.switchTab({
  540. url: '/pages/home/home'
  541. })
  542. }else{
  543. wx.miniProgram.switchTab({
  544. url: '/pages/home/home'
  545. })
  546. }
  547. })
  548. function selectText(x) {
  549. if (document.selection) {
  550. var range = document.body.createTextRange();
  551. range.moveToElementText(x);
  552. range.select();
  553. } else if (window.getSelection) {
  554. var selection = window.getSelection();
  555. var range = document.createRange();
  556. selection.removeAllRanges();
  557. range.selectNodeContents(x);
  558. selection.addRange(range);
  559. }
  560. }
  561. function handleClose() {
  562. $('.mask').hide();
  563. }
  564. function cp(x) {
  565. $(".mainbox").css({
  566. "display": "none"
  567. })
  568. $(".sbox").css({
  569. "display": "block"
  570. })
  571. selectText(x);
  572. document.execCommand("copy");
  573. }
  574. var decodeCount = 1;
  575. var isFinish = false;
  576. var player = new PCMPlayer({
  577. encoding: '16bitInt',
  578. channels: 2,
  579. sampleRate: 44100,
  580. flushingTime: 22,
  581. debug: false
  582. });
  583. Module = {};
  584. Module.onRuntimeInitialized = function () {
  585. isFinish = true;
  586. }
  587. function decodeAAC(data) {
  588. var retPtr = Module._malloc(4 * 5 * 1024); //接收的数据
  589. var inputPtr = Module._malloc(4 * data.length); //输入数据
  590. for (var i = 0; i < data.length; i++) {
  591. Module.HEAPU8[(inputPtr) + i] = data[i]; //转换为堆数据
  592. }
  593. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  594. if (pcmLen >= 0) {
  595. var pcmData = new Uint8Array(pcmLen);
  596. for (var i = 0; i < pcmLen; i++) {
  597. pcmData[i] = Module.HEAPU8[(retPtr) + i]
  598. }
  599. player.feed(pcmData);
  600. }
  601. decodeCount++;
  602. Module._free(inputPtr);
  603. Module._free(retPtr);
  604. }
  605. var decodeWoker = new Worker('decoder.js?width=' + videoWidth + '&height=' + videoHeight);
  606. var myVideo = document.getElementById("playCanvas");
  607. decodeWoker.onmessage = function (event) {
  608. var objData = event.data;
  609. switch (objData.cmd) {
  610. case 0:
  611. break;
  612. case 1:
  613. if (renderCount++ < 4 || !isAudioPlay) {
  614. return
  615. }
  616. webglPlayer.renderFrame(objData.data, videoWidth, videoHeight, videoWidth * videoHeight, (videoWidth / 2) * (videoHeight / 2));
  617. $('.weui-mask_transparent').hide()
  618. $('.weui-toast').hide()
  619. $('.loading').hide()
  620. }
  621. }
  622. var isFinish = false;
  623. var webglPlayer = new WebGLPlayer(myVideo, {
  624. preserveDrawingBuffer: false
  625. });
  626. function GetRequest() {
  627. var url = location.search; // 获取url中"?"符后的字串
  628. var obj = new Object();
  629. if (url.indexOf("?") != -1) {
  630. var str = url.substr(1);
  631. strs = str.split("&");
  632. for (var i = 0; i < strs.length; i++) {
  633. obj[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
  634. }
  635. }
  636. return obj;
  637. }
  638. var ip = parameters["ip"];
  639. var appletPushAddress = parameters["appletPushAddress"];
  640. var token = parameters["cardToken"];
  641. var webSocketWorker = new Worker('websocket.js?ip=' + ip + '&appletPushAddress=' + appletPushAddress + '&token=' + token);
  642. webSocketWorker.onmessage = function (event) {
  643. var input = event.data;
  644. if (input[0] == 0xff && isAudioPlay && renderCount >= 4) {
  645. decodeAAC(input);
  646. }
  647. if (input[0] == 0 && input[1] == 0 && input[2] == 0 && input[3] == 1) {
  648. decodeWoker.postMessage(event.data);
  649. }
  650. if (input[0] == 0x68) {
  651. if (input[23] == 0x5c) {
  652. if (CheckVerifyCode(input)) {
  653. webSocketWorker.postMessage(ConfigChannel('RK3923C1201900139'));
  654. var checkBuffer = GetScreenState();
  655. webSocketWorker.postMessage(checkBuffer);
  656. }
  657. else {
  658. $.toast("画面异常,请重新进入", "text");
  659. decodeWoker.postMessage('close');
  660. decodeWoker.terminate();
  661. webSocketWorker.terminate();
  662. if(navigator.userAgent.toLowerCase().includes('toutiaomicroapp')){
  663. tt.miniProgram.switchTab({
  664. url: '/pages/home/home'
  665. })
  666. }else{
  667. wx.miniProgram.switchTab({
  668. url: '/pages/home/home'
  669. })
  670. }
  671. }
  672. }
  673. if (input[23] == 0x05) { //横竖屏标识
  674. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  675. if (state == 1) {
  676. console.log("安卓卡此时竖屏");
  677. //竖屏处理
  678. resolving = 1;
  679. } else {
  680. console.log("安卓卡此时横屏");
  681. //横屏处理
  682. resolving = 0;
  683. }
  684. }
  685. if (input[23] == 0x0b) {
  686. console.log("多端登陆");
  687. }
  688. }
  689. if (event.data === 'close') {
  690. $.toast("画面异常,请重新进入", "text");
  691. decodeWoker.postMessage('close');
  692. decodeWoker.terminate();
  693. webSocketWorker.terminate();
  694. if(navigator.userAgent.toLowerCase().includes('toutiaomicroapp')){
  695. tt.miniProgram.switchTab({
  696. url: '/pages/home/home'
  697. })
  698. }else{
  699. wx.miniProgram.switchTab({
  700. url: '/pages/home/home'
  701. })
  702. }
  703. }
  704. }
  705. function Close() { // webworker 关闭,清理
  706. var cmd = {
  707. cmd: 0
  708. };
  709. decodeWoker.postMessage(cmd);
  710. decodeWoker.terminate();
  711. webSocketWorker.postMessage(cmd);
  712. webSocketWorker.terminate();
  713. }
  714. var isDrag = false;
  715. myVideo.onkeydown = function (event) {
  716. ExexuteKeyDown(e.keyCode);
  717. }
  718. window.onbeforeunload = function () {
  719. wsss.close();
  720. decodeWoker.postMessage('close');
  721. decodeWoker.terminate();
  722. webSocketWorker.terminate();
  723. }
  724. </script>
  725. <script type="text/javascript" src="aac.js"></script>
  726. </body>
  727. </html>