WXtrialInterface.html 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201
  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. <style>
  38. .try-use-wrap,
  39. .buy-phone-wrap,
  40. .look-wrap {
  41. width: 100%;
  42. height: 100%;
  43. position: fixed;
  44. top: 0;
  45. left: 0;
  46. z-index: 9999;
  47. background: rgba(0, 0, 0, 0.5);
  48. display: none;
  49. }
  50. .try-use-container {
  51. width: 80%;
  52. height: 409px;
  53. position: absolute;
  54. top: 50%;
  55. left: 50%;
  56. transform: translate(-50%, -50%);
  57. background-color: #FFFFFF;
  58. border-radius: 0.66em;
  59. }
  60. .time-close-wrap {
  61. width: 5.46em;
  62. height: 2em;
  63. line-height: 2em;
  64. text-align: center;
  65. position: absolute;
  66. top: 0.24em;
  67. right: 0.3em;
  68. background: rgba(0, 0, 0, 0.49);
  69. border-radius: 1.26em;
  70. font-size: 12px;
  71. color: #FFFFFF;
  72. }
  73. .bug-wrap {
  74. width: 90%;
  75. height: 115px;
  76. background: #FFFFFF;
  77. border-radius: 10px;
  78. position: absolute;
  79. top: 50%;
  80. left: 50%;
  81. transform: translate(-50%, -50%);
  82. }
  83. .bug-title {
  84. text-align: center;
  85. margin: 25px 0;
  86. font-size: 18px;
  87. font-weight: 600;
  88. color: #333333;
  89. }
  90. .btn-list {
  91. width: 100%;
  92. height: 44px;
  93. line-height: 44px;
  94. border-top: 1px solid rgba(238, 238, 238, 1);
  95. position: absolute;
  96. bottom: 0;
  97. left: 0;
  98. display: flex;
  99. align-items: center;
  100. }
  101. .btn {
  102. flex: 1;
  103. text-align: center;
  104. }
  105. .cannel-btn {
  106. font-size: 18px;
  107. color: #666666;
  108. }
  109. .go-bug {
  110. font-size: 18px;
  111. color: #3B7FFF;
  112. border-left: 1px solid rgba(238, 238, 238, 1);
  113. }
  114. </style>
  115. </head>
  116. <body class="scroll h-player" style="overscroll-behavior: contain;">
  117. <div class="container" id="player">
  118. <div class="muted" id="btnMuted">
  119. <div class="control-right-img" data-id="1">
  120. <img src="../static/img/xuanfu_icon.png">
  121. </div>
  122. </div>
  123. <div id="wine">
  124. <div id="box">
  125. <canvas id="playCanvas" width="450" height="800"></canvas>
  126. </div>
  127. </div>
  128. <div class="leftmains">
  129. <div class="PictureQualityMain">
  130. <div class="PictureQuality" data-id="4">高清</div>
  131. <div class="PictureQuality avit" data-id="3">标清</div>
  132. <div class="PictureQuality" data-id="2">极速</div>
  133. </div>
  134. <div class="operation">
  135. <div class="upload" id="showsuss" data-text="uploads">
  136. <img src="../static/img/wx/shangchuan_icon.png">
  137. <div>上传</div>
  138. </div>
  139. <div class="upload" onclick="showShearPlate()" data-text="Shearplate">
  140. <img src="../static/img/wx/jianqieban_icon.png">
  141. <div>剪贴板</div>
  142. </div>
  143. <div class="upload" id="upload" data-text="Signout">
  144. <img src="../static/img/wx/tuichu_icon.png">
  145. <div>退出</div>
  146. </div>
  147. </div>
  148. </div>
  149. <div class="bottommains">
  150. <div class="botmat1">
  151. <div class="botmat1img" data-text="gengduo">
  152. <img src="../static/img/wx/gengduo_icon.png">
  153. </div>
  154. </div>
  155. <div class="botmat1">
  156. <div class="botmat1img" data-text="home">
  157. <img src="../static/img/wx/home_icon.png">
  158. </div>
  159. </div>
  160. <div class="botmat1">
  161. <div class="botmat1img" data-text="return">
  162. <img src="../static/img/wx/fanhui_icon.png">
  163. </div>
  164. </div>
  165. </div>
  166. <img class="loading loading_sceen_pic" />
  167. </div>
  168. <div class="mask">
  169. <div class="box-shear-plate"></div>
  170. <img class="close" onclick="handleClose()" src="img/guanbi_icon@2x.png" alt="">
  171. </div>
  172. <div class="weui-mask_transparent"></div>
  173. <div class="weui-toast weui_loading_toast weui-toast--visible">
  174. <div class="weui_loading"><i class="weui-loading weui-icon_toast"></i></div>
  175. <p class="weui-toast_content">数据加载中</p>
  176. </div>
  177. <div class="try-use-wrap">
  178. <div class="try-use-container">
  179. <video width="100%" height="100%" id="source" muted autoplay="autoplay" loop="loop">
  180. 您的浏览器不支持 video 标签。
  181. </video>
  182. <div class="time-close-wrap"><span class="time-node"></span> 关闭</div>
  183. </div>
  184. </div>
  185. <div class="buy-phone-wrap">
  186. <div class="bug-wrap">
  187. <div class="bug-title">获得极致体验服务请购买云手机</div>
  188. <div class="btn-list">
  189. <div class="btn cannel-btn">取消</div>
  190. <div class="btn go-bug">去购买</div>
  191. </div>
  192. </div>
  193. </div>
  194. <div class="look-wrap">
  195. <div class="bug-wrap">
  196. <div class="bug-title">关闭广告会退出云手机是否继续观看</div>
  197. <div class="btn-list">
  198. <div class="btn cannel-btn cannel-ad-btn">放弃</div>
  199. <div class="btn go-bug looking">继续观看</div>
  200. </div>
  201. </div>
  202. </div>
  203. <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
  204. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  205. <script src="https://lf1-cdn-tos.bytegoofy.com/goofy/developer/jssdk/jssdk-1.0.3.js"></script>
  206. <script type="text/javascript" src="jquery-1.11.0.min.js"></script>
  207. <!-- ffm软解 -->
  208. <script type="text/javascript" src="helper.js"></script>
  209. <script type="text/javascript" src="jquery-weui.min.js"></script>
  210. <script type="text/javascript" src="pcm-player.js"></script>
  211. <script type="text/javascript" src="webgl.js"></script>
  212. <script type="text/javascript" src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
  213. <script type="text/javascript" src="WXdraw.js"></script>
  214. <script type="text/javascript" src="https://unpkg.com/@dcloudio/uni-webview-js@0.0.2/index.js"></script>
  215. <script type="text/javascript">
  216. $(function () {
  217. //手指滑动多少距离就认为是滑成功
  218. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  219. var diffXDistance = 50;
  220. //当前滑动的对象
  221. var currentObject;
  222. //上一次滑动的对象
  223. var lastObject;
  224. //是否可以左右滑动,在上下滑的时候禁止左右滑
  225. var canSlide = true;
  226. //用于记录按下的点
  227. var startPoint;
  228. $(".slide-content").css({
  229. width: $(".slide-wrapper").width()
  230. });
  231. $(".slide-scroll").css({
  232. width: $(".slide-wrapper").width() + $(".slide-content-button").width()
  233. })
  234. .on('touchstart', function (e) {
  235. currentObject = this;
  236. startPoint = {
  237. x: e.originalEvent.changedTouches[0].pageX,
  238. y: e.originalEvent.changedTouches[0].pageY
  239. };
  240. })
  241. .on('touchmove', function (e) {
  242. //如果是左右滑动,就禁止上下的滑动
  243. //如果是上下的滑动,就禁止左右滑动
  244. if (Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) > Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)) {
  245. event.preventDefault();
  246. } else {
  247. canSlide = false;
  248. }
  249. })
  250. .on('touchend', function (e) {
  251. //如果是上下滑动,这里就直接返回了
  252. if (!canSlide) {
  253. canSlide = true;
  254. return true;
  255. }
  256. //点击除当前左滑对象之外的任意其他位置
  257. if (lastObject && currentObject != lastObject) {
  258. //右滑→
  259. $(lastObject).removeClass("animate-slide");
  260. //清空上一个左滑的对象
  261. lastObject = undefined;
  262. }
  263. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  264. if (diffX < -diffXDistance) {
  265. //左滑←
  266. $(currentObject).addClass("animate-slide");
  267. if (lastObject && lastObject != currentObject) {
  268. //右滑→
  269. $(lastObject).removeClass("animate-slide");
  270. }
  271. //记录上一个左滑的对象
  272. lastObject = currentObject;
  273. } else if (diffX >= diffXDistance) {
  274. if (currentObject == lastObject) {
  275. //右滑→
  276. $(currentObject).removeClass("animate-slide");
  277. //清空上一个左滑的对象
  278. lastObject = undefined;
  279. }
  280. }
  281. });
  282. });
  283. </script>
  284. <script>
  285. var videoTimer = null, videoTime = 0, adType = 0, sourceType = 0, disconnectionFlag = false, getDate = false;
  286. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  287. var url = window.location.href;
  288. url = url.split('/');
  289. var baseUrl = url[0] + '//' + url[2];
  290. console.log(baseUrl)
  291. var parameters = GetRequest();
  292. var form = {};
  293. form.token = parameters['token'];
  294. form.mealType = parameters['mealType'];
  295. form.userCardId = parameters['userCardId'];
  296. if (parameters['mealType'] === 'VIP') {
  297. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_VIP.png');
  298. } else if (parameters['mealType'] === 'SVIP') {
  299. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_SVIP.png');
  300. } else if (parameters['mealType'] === 'STAR') {
  301. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_STAR.png');
  302. } else if (parameters['mealType'] === 'STARPRO') {
  303. $(".loading_sceen_pic").attr('src', '../static/img/home_bg_PRO.png');
  304. }
  305. $('#wine').css({
  306. "width": window.screen.width,
  307. "height": window.screen.height - topwinHeight - 20,
  308. "position": "absolute"
  309. })
  310. $('.loading').css({
  311. "width": window.screen.width,
  312. "height": window.screen.height - topwinHeight - 20
  313. });
  314. var winese = document.createElement("wine");
  315. wine.style.top = "-" + winese + 'px';
  316. var isAudioPlay = false;
  317. adInit();
  318. $.alert({
  319. title: '提示',
  320. text: '开始使用云手机',
  321. onOK: function () {
  322. isAudioPlay = true;
  323. }
  324. });
  325. //云机倒计时
  326. let validTime = parameters['validTime'] || 10000;
  327. if (validTime > 32000) {
  328. validTime = 32000;
  329. }
  330. let detailTime = validTime * 60 * 1000;
  331. setTimeout(() => {
  332. $('.bug-title').eq(0).text('尊敬的用户您的云手机试用时间已到期');
  333. getDate = true;
  334. $('.buy-phone-wrap').eq(0).show();
  335. }, detailTime)
  336. var orientation = 0; //0 竖屏,1横屏
  337. function array_unique(arr) {
  338. return arr.filter(function (e, i) {
  339. return arr.indexOf(e) === i;
  340. })
  341. }
  342. var cutList = [];
  343. let timer, isFlag = true;
  344. function showShearPlate() {
  345. stopManyClick(() => {
  346. $('.box-shear-plate').empty();
  347. $.ajax({
  348. url: baseUrl + "/api/public/v5/shear/content",
  349. headers: {
  350. 'Authorization': form.token
  351. },
  352. type: 'get',
  353. dataType: 'json',
  354. success: function (res) {
  355. if (res.status === 0) {
  356. if (res.data.length) {
  357. cutList = array_unique(res.data)
  358. var str = '<div class="title">剪贴板<div onclick="handleClear()" class="btn-clear">清空</div></div><div class="slide-wrapper-content">'
  359. cutList.forEach(function (item) {
  360. 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>"
  361. })
  362. str += '</div>'
  363. $('.box-shear-plate').append(str);
  364. } else {
  365. $('.box-shear-plate').append('<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>')
  366. }
  367. $('.mask').show();
  368. initSlider();
  369. } else {
  370. $('.box-shear-plate').append('<img class="empty" src="img/jianqieban_pic@2x.png" alt="" /><div class="empty-txt">剪贴板为空</div>')
  371. $('.mask').show();
  372. }
  373. }
  374. })
  375. })
  376. }
  377. //防止提示一秒内重复显示
  378. function stopManyClick(fn) {
  379. if (isFlag) {
  380. fn();
  381. }
  382. isFlag = false;
  383. if (timer) { clearTimeout(timer); }
  384. timer = setTimeout(() => { isFlag = true }, 1500);
  385. }
  386. // 清空剪贴板
  387. function handleClear() {
  388. var ids = '';
  389. cutList.forEach(function (item) {
  390. ids += 'ids=' + item.id + '&'
  391. });
  392. ids = ids.substring(0, ids.lastIndexOf('&'));
  393. $.confirm("确定清空剪贴板?", function () {
  394. $.ajax({
  395. url: baseUrl + "/api/public/v5/shear/content?" + ids,
  396. headers: {
  397. 'Authorization': form.token
  398. },
  399. type: 'DELETE',
  400. dataType: 'json',
  401. success: function (res) {
  402. if (res.status === 0) {
  403. showShearPlate();
  404. } else {
  405. $.toast(res.msg, "text");
  406. }
  407. }
  408. })
  409. });
  410. }
  411. function handleCopy(content) {
  412. var cutting = {
  413. "type": "cutting",
  414. "data": {
  415. "str": content
  416. }
  417. }
  418. wsss.send(JSON.stringify(cutting));
  419. }
  420. // 删除剪贴板
  421. function handleDelete(id) {
  422. $.ajax({
  423. url: baseUrl + "/api/public/v5/shear/content?ids=" + id,
  424. headers: {
  425. 'Authorization': form.token
  426. },
  427. type: 'DELETE',
  428. dataType: 'json',
  429. success: function (res) {
  430. if (res.status === 0) {
  431. showShearPlate();
  432. } else {
  433. $.toast(res.msg, "text");
  434. }
  435. }
  436. })
  437. }
  438. function initSlider() {
  439. //手指滑动多少距离就认为是滑成功
  440. //这个值不能太大,否则影响斜着滑动时,垂直滑动的流畅性,也不能太小,太灵敏也不好
  441. var diffXDistance = 50;
  442. //当前滑动的对象
  443. var currentObject;
  444. //上一次滑动的对象
  445. var lastObject;
  446. //是否可以左右滑动,在上下滑的时候禁止左右滑
  447. var canSlide = true;
  448. //用于记录按下的点
  449. var startPoint;
  450. $(".slide-content").css({
  451. width: $(".slide-wrapper").width()
  452. });
  453. document.body.removeEventListener('touchmove', function (e) {
  454. e.preventDefault()
  455. }, {
  456. passive: false
  457. })
  458. $(".slide-scroll").css({
  459. width: $(".slide-wrapper").width() + $(".slide-content-button").width()
  460. })
  461. .on('touchstart', function (e) {
  462. currentObject = this;
  463. startPoint = {
  464. x: e.originalEvent.changedTouches[0].pageX,
  465. y: e.originalEvent.changedTouches[0].pageY
  466. };
  467. })
  468. .on('touchmove', function (e) {
  469. //如果是左右滑动,就禁止上下的滑动
  470. //如果是上下的滑动,就禁止左右滑动
  471. if (Math.abs(e.originalEvent.changedTouches[0].pageX - startPoint.x) > Math.abs(e.originalEvent.changedTouches[0].pageY - startPoint.y)) {
  472. event.preventDefault();
  473. } else {
  474. canSlide = false;
  475. }
  476. })
  477. .on('touchend', function (e) {
  478. //如果是上下滑动,这里就直接返回了
  479. if (!canSlide) {
  480. canSlide = true;
  481. return true;
  482. }
  483. //点击除当前左滑对象之外的任意其他位置
  484. if (lastObject && currentObject != lastObject) {
  485. //右滑→
  486. $(lastObject).removeClass("animate-slide");
  487. //清空上一个左滑的对象
  488. lastObject = undefined;
  489. }
  490. var diffX = e.originalEvent.changedTouches[0].pageX - startPoint.x;
  491. if (diffX < -diffXDistance) {
  492. //左滑←
  493. $(currentObject).addClass("animate-slide");
  494. if (lastObject && lastObject != currentObject) {
  495. //右滑→
  496. $(lastObject).removeClass("animate-slide");
  497. }
  498. //记录上一个左滑的对象
  499. lastObject = currentObject;
  500. } else if (diffX >= diffXDistance) {
  501. if (currentObject == lastObject) {
  502. //右滑→
  503. $(currentObject).removeClass("animate-slide");
  504. //清空上一个左滑的对象
  505. lastObject = undefined;
  506. }
  507. }
  508. });
  509. }
  510. var btnMuted = document.querySelector("#btnMuted");
  511. btnMuted && (function () {
  512. var setHistory = function (left, top) {
  513. try {
  514. localStorage.setItem("muted-btn-loc", JSON.stringify({
  515. left: left,
  516. top: top
  517. }));
  518. } catch (ex) { }
  519. };
  520. var getHistory = function () {
  521. try {
  522. var value = localStorage.getItem("muted-btn-loc");
  523. if (!value) return null;
  524. value = JSON.parse(value);
  525. if (!value) return null;
  526. return value;
  527. } catch (ex) {
  528. return null
  529. }
  530. };
  531. var fixLoc = function (loc) {
  532. var rect = btnMuted.getBoundingClientRect();
  533. rect = {
  534. top: rect.top,
  535. left: rect.left,
  536. width: rect.width,
  537. height: rect.height
  538. }; // 部分低版本浏览器,该属性为只读
  539. if (loc) {
  540. rect.left = loc.left;
  541. rect.top = loc.top;
  542. }
  543. var minX = 0;
  544. var minY = 0;
  545. var docRect = document.documentElement.getBoundingClientRect();
  546. var maxY = docRect.height - rect.height;
  547. var maxX = docRect.width - rect.width;
  548. var left = rect.left;
  549. var top = rect.top;
  550. left = Math.min(left, maxX);
  551. left = Math.max(left, minX);
  552. top = Math.min(top, maxY);
  553. top = Math.max(top, minY);
  554. if (loc || top !== rect.top || left !== rect.left) {
  555. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  556. }
  557. }
  558. window.addEventListener("resize", function () {
  559. fixLoc();
  560. });
  561. var touchPoint = {
  562. pageY: 0,
  563. pageX: 0
  564. };
  565. var currentLoc = {
  566. top: 0,
  567. left: 0,
  568. curTop: 0,
  569. curLeft: 0
  570. };
  571. var toMove = false;
  572. var touchmove = function (e) {
  573. e.preventDefault();
  574. var point = e.changedTouches[0];
  575. var top = -touchPoint.pageY + point.pageY;
  576. var left = -touchPoint.pageX + point.pageX;
  577. if (toMove) {
  578. top += currentLoc.top;
  579. left += currentLoc.left;
  580. currentLoc.curLeft = left;
  581. currentLoc.curTop = top;
  582. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  583. } else {
  584. if (Math.abs(top) >= 5 || Math.abs(left) >= 5) {
  585. toMove = true;
  586. }
  587. }
  588. };
  589. var touchend = function () {
  590. window.removeEventListener("touchmove", touchmove, {
  591. passive: false
  592. });
  593. window.removeEventListener("touchend", touchend, {
  594. passive: false
  595. });
  596. if (toMove) {
  597. setHistory(currentLoc.curLeft, currentLoc.curTop);
  598. fixLoc();
  599. } else {
  600. //按点击处理
  601. var set = $('.control-right-img').attr("data-id")
  602. if (set == '1') {
  603. $('.control-right-img').attr({
  604. "data-id": "2"
  605. })
  606. $(".leftmains").css({
  607. "right": "0rem"
  608. })
  609. } else {
  610. $('.control-right-img').attr({
  611. "data-id": "1"
  612. })
  613. $(".leftmains").css({
  614. "right": "-4rem"
  615. })
  616. }
  617. }
  618. }
  619. btnMuted.addEventListener("touchstart", function (e) {
  620. e.preventDefault();
  621. toMove = false;
  622. var point = e.changedTouches[0];
  623. touchPoint.pageX = point.pageX;
  624. touchPoint.pageY = point.pageY;
  625. var rect = e.target.getBoundingClientRect();
  626. currentLoc.top = rect.top;
  627. currentLoc.left = rect.left;
  628. window.addEventListener("touchmove", touchmove, {
  629. passive: false
  630. });
  631. window.addEventListener("touchend", touchend, {
  632. passive: false
  633. });
  634. }, {
  635. passive: false
  636. });
  637. var history = getHistory();
  638. if (history) {
  639. fixLoc(history);
  640. }
  641. btnMuted.classList.remove("hide");
  642. })();
  643. $("#upload").on("click", function () {
  644. decodeWoker.postMessage('close');
  645. decodeWoker.terminate();
  646. webSocketWorker.terminate();
  647. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  648. tt.miniProgram.switchTab({
  649. url: '/pages/home/home'
  650. })
  651. } else if (window.__wxjs_environment === 'miniprogram') {
  652. wx.miniProgram.switchTab({
  653. url: '/pages/home/home'
  654. })
  655. } else {
  656. document.addEventListener('UniAppJSBridgeReady', function () {
  657. uni.webView.navigateTo({
  658. url: '/pages/index/index'
  659. });
  660. })
  661. }
  662. })
  663. function handleClose() {
  664. $('.mask').hide();
  665. }
  666. var decodeCount = 1;
  667. var isFinish = false;
  668. var player = new PCMPlayer({
  669. encoding: '16bitInt',
  670. channels: 2,
  671. sampleRate: 44100,
  672. flushingTime: 22,
  673. debug: false
  674. });
  675. Module = {};
  676. Module.onRuntimeInitialized = function () {
  677. isFinish = true;
  678. }
  679. function decodeAAC(data) {
  680. var retPtr = Module._malloc(4 * 5 * 1024); //接收的数据
  681. var inputPtr = Module._malloc(4 * data.length); //输入数据
  682. for (var i = 0; i < data.length; i++) {
  683. Module.HEAPU8[(inputPtr) + i] = data[i]; //转换为堆数据
  684. }
  685. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  686. if (pcmLen >= 0) {
  687. var pcmData = new Uint8Array(pcmLen);
  688. for (var i = 0; i < pcmLen; i++) {
  689. pcmData[i] = Module.HEAPU8[(retPtr) + i]
  690. }
  691. player.feed(pcmData);
  692. }
  693. decodeCount++;
  694. Module._free(inputPtr);
  695. Module._free(retPtr);
  696. }
  697. var decodeWoker = new Worker('decoder.js');
  698. var myVideo = document.getElementById("playCanvas");
  699. var logicWidth = 720;
  700. var logicHeight = 1280;
  701. decodeWoker.onmessage = function (event) {
  702. var objData = event.data;
  703. switch (objData.cmd) {
  704. case 0:
  705. break;
  706. case 1:
  707. if (logicWidth != objData.width || logicHeight != objData.height) {
  708. logicWidth = objData.width;
  709. logicHeight = objData.height;
  710. }
  711. webglPlayer.renderFrame(objData.data, logicWidth, logicHeight, logicWidth * logicHeight, (logicWidth / 2) * (logicHeight / 2));
  712. $('.weui-mask_transparent').hide()
  713. $('.weui-toast').hide()
  714. $('.loading').hide()
  715. break;
  716. case 5:
  717. var buffer = RequestIFrame();
  718. webSocketWorker.postMessage(buffer);
  719. }
  720. }
  721. var isFinish = false;
  722. var webglPlayer = new WebGLPlayer(myVideo, {
  723. preserveDrawingBuffer: false
  724. });
  725. function GetRequest() {
  726. var url = location.search; // 获取url中"?"符后的字串
  727. var obj = new Object();
  728. if (url.indexOf("?") != -1) {
  729. var str = url.substr(1);
  730. strs = str.split("&");
  731. for (var i = 0; i < strs.length; i++) {
  732. obj[strs[i].split("=")[0]] = (strs[i].split("=")[1]);
  733. }
  734. }
  735. return obj;
  736. }
  737. var ip = parameters["ip"];
  738. var appletPushAddress = parameters["appletPushAddress"];
  739. var token = parameters["cardToken"];
  740. var webSocketWorker = new Worker('websocket.js?ip=' + ip + '&appletPushAddress=' + appletPushAddress + '&token=' + token);
  741. webSocketWorker.onmessage = function (event) {
  742. var input = event.data;
  743. if (input[0] == 0xff && isAudioPlay) {
  744. decodeAAC(input);
  745. }
  746. if (input[0] == 0 && input[1] == 0 && input[2] == 0 && input[3] == 1) {
  747. var cmd = {
  748. type: "rawData",
  749. data: event.data
  750. };
  751. decodeWoker.postMessage(cmd);
  752. }
  753. if (input[0] == 0x68) {
  754. if (input[23] == 0x5c) {
  755. if (CheckVerifyCode(input)) {
  756. webSocketWorker.postMessage(ConfigChannel('RK3923C1201900139'));
  757. var checkBuffer = GetScreenState();
  758. webSocketWorker.postMessage(checkBuffer);
  759. }
  760. else {
  761. $.toast("画面异常,请重新进入", "text");
  762. decodeWoker.postMessage('close');
  763. decodeWoker.terminate();
  764. webSocketWorker.terminate();
  765. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  766. tt.miniProgram.switchTab({
  767. url: '/pages/home/home'
  768. })
  769. } else if (window.__wxjs_environment === 'miniprogram') {
  770. wx.miniProgram.switchTab({
  771. url: '/pages/home/home'
  772. })
  773. } else {
  774. document.addEventListener('UniAppJSBridgeReady', function () {
  775. uni.webView.navigateTo({
  776. url: '/pages/index/index'
  777. });
  778. })
  779. }
  780. }
  781. }
  782. if (input[23] == 0x05) { //横竖屏标识
  783. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  784. if (state == 1) {
  785. console.log("安卓卡此时竖屏");
  786. //竖屏处理
  787. resolving = 1;
  788. } else {
  789. console.log("安卓卡此时横屏");
  790. //横屏处理
  791. resolving = 0;
  792. }
  793. }
  794. if (input[23] == 0x0b) {
  795. console.log("多端登陆");
  796. }
  797. }
  798. if (event.data === 'close') {
  799. $.toast("画面异常,请重新进入", "text");
  800. decodeWoker.postMessage('close');
  801. decodeWoker.terminate();
  802. webSocketWorker.terminate();
  803. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  804. tt.miniProgram.switchTab({
  805. url: '/pages/home/home'
  806. })
  807. } else if (window.__wxjs_environment === 'miniprogram') {
  808. wx.miniProgram.switchTab({
  809. url: '/pages/home/home'
  810. })
  811. } else {
  812. document.addEventListener('UniAppJSBridgeReady', function () {
  813. uni.webView.navigateTo({
  814. url: '/pages/index/index'
  815. });
  816. })
  817. }
  818. }
  819. }
  820. // 激活码广告相关配置
  821. function getConfigByPhoneType() {
  822. console.log('form', form)
  823. return new Promise((resolve, reject) => {
  824. $.ajax({
  825. url: baseUrl + "/api/pay/v5/trialCodeConfig/getConfigByPhoneType",
  826. headers: {
  827. 'Authorization': form.token
  828. },
  829. data: {
  830. userCardId: form.userCardId,
  831. phoneType: form.mealType
  832. },
  833. type: 'get',
  834. dataType: 'json',
  835. success: function (res) {
  836. console.log(res)
  837. let obj = res.data;
  838. if (res.status === 0) {
  839. resolve(obj)
  840. } else {
  841. $.toast(res.msg, "text");
  842. }
  843. }
  844. })
  845. })
  846. }
  847. //列表
  848. function getSetmealList() {
  849. return new Promise((resolve, reject) => {
  850. $.ajax({
  851. url: baseUrl + "/api/resources/v4/freetrial/setmeal/list",
  852. headers: {
  853. 'Authorization': form.token
  854. },
  855. type: 'get',
  856. dataType: 'json',
  857. success: function (res) {
  858. if (res.status === 0) {
  859. let list = res.data;
  860. list.map((item) => {
  861. if (item.phoneType === parameters['mealType']) {
  862. resolve(item)
  863. }
  864. })
  865. } else {
  866. $.toast(res.msg, "text");
  867. }
  868. }
  869. })
  870. })
  871. }
  872. //广告信息
  873. function adInit() {
  874. sourceType = parameters['sourceType'];
  875. if (sourceType == 1) {
  876. getSetmealList().then((res) => {
  877. if (res.pushFlowAdvert === 1) {
  878. getAdList(15);
  879. }
  880. if (res.intervalSwitch === 1) {
  881. let time = res.intervalAdvertDuration * 60 * 1000;
  882. setInterval(() => {
  883. $('.try-use-wrap').eq(0).hide();
  884. getAdList(16);
  885. }, time);
  886. }
  887. })
  888. } else if (sourceType == 2) {
  889. getConfigByPhoneType().then((res) => {
  890. if (res.isDisconnectionTime === 1) {
  891. let time = res.disconnectionTime * 60 * 1000;
  892. setTimeout(() => {
  893. disconnectionFlag = true;
  894. $('.buy-phone-wrap').eq(0).show();
  895. }, time);
  896. }
  897. if (res.isShowAd === 1) {
  898. getAdList(15);
  899. }
  900. if (res.isIntervalPlayAd === 1) {
  901. let time = res.intervalPlayAdTime * 60 * 1000;
  902. setInterval(() => {
  903. $('.try-use-wrap').eq(0).hide();
  904. getAdList(16);
  905. }, time);
  906. }
  907. })
  908. }
  909. }
  910. // 广告接口
  911. function getAdList(type) {
  912. adType = type;
  913. $.ajax({
  914. url: baseUrl + "/api/public/v5/advertising/getAdInfoByAdPlace",
  915. headers: {
  916. 'Authorization': form.token
  917. },
  918. data: JSON.stringify({
  919. adPlace: type,
  920. os: 0
  921. }),
  922. type: 'POST',
  923. dataType: 'json',
  924. contentType: "application/json;charset=UTF-8",
  925. success: function (res) {
  926. if (res.status === 0) {
  927. let list = res.data;
  928. let indexs = Math.floor(Math.random() * list.length);
  929. videoTime = list[indexs].forcedTime;
  930. // $('#source').src = list[0].adVideoBase.videoUrl;
  931. $("#source").attr("src", list[indexs].adVideoBase.videoUrl);//更新url
  932. $("#source").attr("autoplay", "true");//直接播放
  933. videoTimer = setInterval(() => {
  934. if (videoTime > 0) {
  935. videoTime--;
  936. $('.time-node').eq(0).text(videoTime + 's');
  937. } else {
  938. clearInterval(videoTimer);
  939. $('.time-node').eq(0).text('');
  940. }
  941. }, 1000)
  942. if (adType === 16 && sourceType == 1) { // 间隔广告和试用才上报
  943. report(0);
  944. }
  945. $('.try-use-wrap').eq(0).show();
  946. } else {
  947. $.toast(res.msg, "text");
  948. }
  949. }
  950. })
  951. }
  952. //间隔广告上报
  953. function report(type) {
  954. $.ajax({
  955. url: baseUrl + "/api/resources/v1/trial/report",
  956. headers: {
  957. 'Authorization': form.token
  958. },
  959. data: JSON.stringify({
  960. userCardId: form.userCardId,
  961. reportType: type
  962. }),
  963. type: 'POST',
  964. dataType: 'json',
  965. contentType: "application/json;charset=UTF-8",
  966. success: function (res) { }
  967. })
  968. }
  969. //关闭广告
  970. $('.time-close-wrap')[0].addEventListener('click', () => {
  971. $('.buy-phone-wrap').eq(0).show();
  972. })
  973. // 点击取消
  974. $('.cannel-btn')[0].addEventListener('click', () => {
  975. $('.buy-phone-wrap').eq(0).hide();
  976. if (disconnectionFlag || getDate) {//设置了断线时间,取消直接退出
  977. systemBuriedPoint('激活码-断线-取消');
  978. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  979. tt.miniProgram.switchTab({
  980. url: '/pages/home/home'
  981. })
  982. } else if (window.__wxjs_environment === 'miniprogram') {
  983. wx.miniProgram.switchTab({
  984. url: '/pages/home/home'
  985. })
  986. } else {
  987. document.addEventListener('UniAppJSBridgeReady', function () {
  988. uni.webView.navigateTo({
  989. url: '/pages/index/index'
  990. });
  991. })
  992. }
  993. return
  994. }
  995. let pointName = '';
  996. if (sourceType == 1) {
  997. pointName = videoTime == 0 ? '免费试用-关闭-取消' : '免费试用-强制关闭-取消';
  998. } else {
  999. pointName = videoTime == 0 ? '激活码-关闭-取消' : '激活码-强制关闭-取消';
  1000. }
  1001. systemBuriedPoint(pointName);
  1002. if (videoTime == 0) {
  1003. if (adType === 16 && sourceType == 1) {
  1004. report(1);
  1005. }
  1006. $('.try-use-wrap').eq(0).hide();
  1007. return
  1008. }
  1009. $('.look-wrap').eq(0).show();
  1010. })
  1011. // 点击去购买
  1012. $('.go-bug')[0].addEventListener('click', () => {
  1013. let pointName = '';
  1014. if (disconnectionFlag) {
  1015. pointName = '激活码-断线-去购买';
  1016. } else if (sourceType == 1) {
  1017. pointName = videoTime == 0 ? '免费试用-关闭-去购买' : '免费试用-强制关闭-去购买';
  1018. } else {
  1019. pointName = videoTime == 0 ? '激活码-关闭-去购买' : '激活码-强制关闭-去购买';
  1020. }
  1021. systemBuriedPoint(pointName);
  1022. if (getDate) {
  1023. wx.miniProgram.navigateTo({
  1024. url: '/packageA/order/buy/index'
  1025. })
  1026. } else {
  1027. wx.miniProgram.navigateTo({
  1028. url: '/packageA/order/renew/index?record=' + form.userCardId
  1029. })
  1030. }
  1031. })
  1032. // 放弃
  1033. $('.cannel-ad-btn')[0].addEventListener('click', () => {
  1034. if (sourceType == 1) {
  1035. systemBuriedPoint('免费试用-强制关闭-放弃');
  1036. } else {
  1037. systemBuriedPoint('激活码-强制关闭-放弃');
  1038. }
  1039. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  1040. tt.miniProgram.switchTab({
  1041. url: '/pages/home/home'
  1042. })
  1043. } else if (window.__wxjs_environment === 'miniprogram') {
  1044. wx.miniProgram.switchTab({
  1045. url: '/pages/home/home'
  1046. })
  1047. } else {
  1048. document.addEventListener('UniAppJSBridgeReady', function () {
  1049. uni.webView.navigateTo({
  1050. url: '/pages/index/index'
  1051. });
  1052. })
  1053. }
  1054. })
  1055. // 继续观看
  1056. $('.looking')[0].addEventListener('click', () => {
  1057. $('.look-wrap').eq(0).hide();
  1058. if (sourceType == 1) {
  1059. systemBuriedPoint('免费试用-强制关闭-继续观看');
  1060. } else {
  1061. systemBuriedPoint('激活码-强制关闭-继续观看');
  1062. }
  1063. })
  1064. // 埋点
  1065. function systemBuriedPoint(pointName) {
  1066. $.ajax({
  1067. url: baseUrl + "/api/public/v1/systemBuriedPoint/stat",
  1068. headers: {
  1069. 'Authorization': form.token
  1070. },
  1071. type: 'post',
  1072. data: JSON.stringify({
  1073. pointName: pointName
  1074. }),
  1075. contentType: "application/json",
  1076. dataType: 'json',
  1077. success: function (res) { }
  1078. })
  1079. }
  1080. function Close() { // webworker 关闭,清理
  1081. var cmd = {
  1082. cmd: 0
  1083. };
  1084. decodeWoker.postMessage(cmd);
  1085. decodeWoker.terminate();
  1086. webSocketWorker.postMessage(cmd);
  1087. webSocketWorker.terminate();
  1088. }
  1089. var isDrag = false;
  1090. myVideo.onkeydown = function (event) {
  1091. ExexuteKeyDown(e.keyCode);
  1092. }
  1093. var level = 2;
  1094. function switchSharpness() {
  1095. var cmd = {
  1096. type: "switchSharpness",
  1097. };
  1098. decodeWoker.postMessage(cmd);//通知解码器worker切换分辨率
  1099. var buffer = makeSharpness(level);
  1100. webSocketWorker.postMessage(buffer);
  1101. if (level < 4) {
  1102. level++;
  1103. } else {
  1104. level = 0;
  1105. }
  1106. }
  1107. var hidden, visibilityChange;
  1108. if (typeof document.hidden !== "undefined") { // Opera 12.10 and Firefox 18 and later support
  1109. hidden = "hidden";
  1110. visibilityChange = "visibilitychange";
  1111. } else if (typeof document.msHidden !== "undefined") {
  1112. hidden = "msHidden";
  1113. visibilityChange = "msvisibilitychange";
  1114. } else if (typeof document.webkitHidden !== "undefined") {
  1115. hidden = "webkitHidden";
  1116. visibilityChange = "webkitvisibilitychange";
  1117. }
  1118. // 处理页面可见属性的改变
  1119. document.addEventListener("visibilitychange", function () {
  1120. if (document[hidden]) {
  1121. if (navigator.userAgent.toLowerCase().includes('toutiaomicroapp')) {
  1122. tt.miniProgram.switchTab({
  1123. url: '/pages/home/home'
  1124. })
  1125. } else if (window.__wxjs_environment === 'miniprogram') {
  1126. wx.miniProgram.switchTab({
  1127. url: '/pages/home/home'
  1128. })
  1129. } else {
  1130. document.addEventListener('UniAppJSBridgeReady', function () {
  1131. uni.webView.navigateTo({
  1132. url: '/pages/index/index'
  1133. });
  1134. })
  1135. }
  1136. }
  1137. }, false);
  1138. window.onbeforeunload = function () {
  1139. wsss.close();
  1140. decodeWoker.postMessage('close');
  1141. decodeWoker.terminate();
  1142. webSocketWorker.terminate();
  1143. }
  1144. </script>
  1145. <script type="text/javascript" src="aac.js"></script>
  1146. </body>
  1147. </html>