WXtrialInterface.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title></title>
  6. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  7. <meta name="viewport" content="initial-scale=1,maximum-scale=1, minimum-scale=1,user-scalable=no">
  8. <meta name="x5-orientation" content="portrait" />
  9. <meta name="screen-orientation" content="portrait" />
  10. <meta name="viewport" content="width=device-width, minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
  11. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  12. <meta name="apple-mobile-web-app-capable" content="yes">
  13. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  14. <meta name="format-detection" content="telephone=no, email=no">
  15. <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
  16. <meta name="apple-mobile-web-app-capable" content="yes">
  17. <!-- 删除苹果默认的工具栏和菜单栏 -->
  18. <meta name="apple-mobile-web-app-status-bar-style" content="black">
  19. <!-- 设置苹果工具栏颜��? -->
  20. <meta name="format-detection" content="telphone=no, email=no">
  21. <!-- 忽略页面中的数字识别为电话,忽略email识别 -->
  22. <!-- 启用360浏览器的极速模��?(webkit) -->
  23. <meta name="renderer" content="webkit">
  24. <!-- 避免IE使用兼容模式 -->
  25. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  26. <!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑��? -->
  27. <meta name="HandheldFriendly" content="true">
  28. <!-- 微软的老式浏览��? -->
  29. <meta name="MobileOptimized" content="320">
  30. <!-- uc强制竖屏 -->
  31. <!-- <meta name="screen-orientation" content="portrait"> -->
  32. <!-- QQ强制竖屏 -->
  33. <!-- <meta name="x5-orientation" content="portrait"> -->
  34. <!-- 不能旋转,问题出在这 -->
  35. <!-- UC强制全屏 -->
  36. <meta name="full-screen" content="yes">
  37. <!-- QQ强制全屏 -->
  38. <meta name="x5-fullscreen" content="true">
  39. <!-- UC应用模式 -->
  40. <meta name="browsermode" content="application">
  41. <!-- QQ应用模式 -->
  42. <meta name="x5-page-mode" content="app">
  43. <!-- windows phone 点击无高��? -->
  44. <meta name="msapplication-tap-highlight" content="no">
  45. <title></title>
  46. <link rel="stylesheet" type="text/css" href="css/WXtrialInterface.css" />
  47. <script async defer src="https://buttons.github.io/buttons.js"></script>
  48. </head>
  49. <body class="scroll h-player" style="overscroll-behavior: contain;">
  50. <div class="container" id="player">
  51. <div class="muted" id="btnMuted">
  52. <div class="control-right-img" data-id="1">
  53. <img src="../static/img/xuanfu_icon.png">
  54. </div>
  55. </div>
  56. <div id="wine">
  57. <!-- <video id="video1" muted="muted" x5-video-orientation="landscape" playsinline="true" autoplay="true"
  58. webkit-playsinline="true" x5-playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="false" style="pointer-events: none;"></video> -->
  59. <!-- <div id="box"> -->
  60. <video muted="muted" x5-video-orientation="landscape" playsinline="true" autoplay="true" webkit-playsinline="true"
  61. x5-playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="false" style="pointer-events: none;width: 100%;height:100%"
  62. disablePictureInPicture="true" autoplay poster="images/loader-thumb.jpg" id="playerVideo"></video>
  63. <div id="box"></div>
  64. <audio preload="auto" autoplay controls poster="images/loader-thumb.jpg" id="audioPlayer" style="position: absolute;top: 0;width: 0;height: 0;"></audio>
  65. </div>
  66. <div class="leftmains">
  67. <div class="PictureQualityMain">
  68. <div class="PictureQuality " data-id="3072000">高清</div>
  69. <div class="PictureQuality avit" data-id="2243000">标清</div>
  70. <div class="PictureQuality" data-id="400000">极速</div>
  71. <div class="PictureQuality" data-id="400000">自动</div>
  72. </div>
  73. <div class="operation">
  74. <div class="upload" id="showsuss" data-text="uploads">
  75. <img src="../static/img/wx/shangchuan_icon.png">
  76. <div>上传</div>
  77. </div>
  78. <div class="upload" onclick="cp(document.getElementById('user_ref_id'));" data-text="Shearplate">
  79. <img src="../static/img/wx/jianqieban_icon.png">
  80. <div>剪切板</div>
  81. </div>
  82. <div class="upload" id="upload" data-text="Signout">
  83. <img src="../static/img/wx/tuichu_icon.png">
  84. <div>退出</div>
  85. </div>
  86. </div>
  87. </div>
  88. <div class="bottommains">
  89. <div class="botmat1">
  90. <div class="botmat1img" data-text="gengduo">
  91. <img src="../static/img/wx/gengduo_icon.png">
  92. </div>
  93. </div>
  94. <div class="botmat1">
  95. <div class="botmat1img" data-text="home">
  96. <img src="../static/img/wx/home_icon.png">
  97. </div>
  98. </div>
  99. <div class="botmat1">
  100. <div class="botmat1img" data-text="return">
  101. <img src="../static/img/wx/fanhui_icon.png">
  102. </div>
  103. </div>
  104. </div>
  105. <div class="mainbox" style="display: none;">
  106. <div class="boxTitle">提示</div>
  107. <div class="boxText">
  108. <div>由于小程序的功能限制,此功能暂时</div>
  109. <div>无法使用,请下载APP使用更多功能</div>
  110. </div>
  111. <div class="boxbt" onclick="cp(document.getElementById('user_ref_id'));">立即前往下载</div>
  112. <div class="boximg"><img src="../static/img/wx/guanbi_icon.png"></div>
  113. </div>
  114. <div class="sbox" style="display: none;">
  115. <div class="sboxText">下载地址已复制到剪切板</div>
  116. <div class="sboxbu">确定</div>
  117. </div>
  118. </div>
  119. <body oncontextmenu="Back()">
  120. </body>
  121. <div id="copy-txt" style="position: absolute;opacity: 0;">
  122. <span id="user_ref_id">www.androidsCloud.com</span>
  123. </div>
  124. <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
  125. <script src="../static/js/jquery-1.11.0.min.js"></script>
  126. <script src="helper.js"></script>
  127. <!-- 音频
  128. <!-- <script src="../static/js/classlist.js"></script>
  129. <script src="../static/js/players.js"></script>
  130. <script src="../static/js/auroraplayer.js"></script>
  131. <script src="../static/js/aurora.js"></script>
  132. <script src="../static/js/aac.js"></script>
  133. <script src="../static/js/web.js?id=101"></script> -->
  134. <!-- <script src="../static/js/webapk.js"></script> -->
  135. <!-- 视频-->
  136. <!-- <script type="text/javascript" src="../static/js/Decoder.js"></script>
  137. <script type="text/javascript" src="../static/js/YUVCanvas.js"></script>
  138. <script type="text/javascript" src="../static/js/Player.js"></script> -->
  139. <!-- <script type="text/javascript" src="jmuxer.js"></script> -->
  140. <script src="https://cdn.bootcss.com/vConsole/3.2.0/vconsole.min.js"></script>
  141. <script src="WXdraw.js?id=105"></script>
  142. <script>
  143. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  144. $('#wine').css({
  145. "width": window.screen.width,
  146. "height": window.screen.height - topwinHeight - 20,
  147. "position": "absolute",
  148. })
  149. var winese = document.createElement("wine");
  150. wine.style.top = "-" + winese + 'px';
  151. //隐藏控件 controls
  152. var fpsCount = 0;
  153. var requestCount = 0;
  154. var timeCount = 0;
  155. var isVisuable = true;
  156. var isFeed = true;
  157. var isDrag = false;
  158. var shoudDrop = false;
  159. var isEnough = true;
  160. var ifCanPlay = false;
  161. var isFinish = false;
  162. var delayTime = new Date().getTime();
  163. var feedTime = new Date().getTime();
  164. var readyTime = new Date().getTime();
  165. var requestTime = new Date().getTime();
  166. var curTime = new Date().getTime();
  167. var requestTime = new Date().getTime(); //记录离开时间
  168. var myVideo = document.getElementById("playerVideo");
  169. $("#wine").click(function() {
  170. console.log("9999999999")
  171. });
  172. var myAudio = document.getElementById("audioPlayer");
  173. var audioBuffer = [];
  174. var audioBack = [];
  175. Module = {};
  176. Module.onRuntimeInitialized = function() {
  177. console.log("Wasm 加载成功!")
  178. isFinish = true;
  179. }
  180. document.addEventListener("visibilitychange", () => {
  181. if (document.visibilityState == "visible") {
  182. console.log("页面可见,继续喂视频");
  183. //requestTime = new Date().getTime();
  184. isVisuable = true;
  185. } else {
  186. isVisuable = false;
  187. isFeed = false;
  188. myVideo.pause();
  189. }
  190. });
  191. myVideo.play();
  192. myVideo.addEventListener('pause', function() {
  193. //console.log("视频播放暂停");
  194. isFeed = false;
  195. });
  196. // myAudio.addEventListener('canplay', function() {
  197. // console.log("缓冲区大小 %f", myAudio.buffered.end(0) - myAudio.buffered.start(0));
  198. // });
  199. /*function decodeAAC(data)
  200. {
  201. var retPtr = Module._malloc(4 * 5 * 1024);//接收的数据
  202. var inputPtr = Module._malloc(4 * data.length);//输入数据
  203. for( i =0;i < data.length;i++)
  204. {
  205. Module.HEAPU8[(inputPtr)+i] = data[i];//转换为堆数据
  206. }
  207. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  208. if(pcmLen > 0)
  209. {
  210. //console.log("%d帧 aac 解码成功, %d", decodeCount, pcmLen);
  211. var pcmData = new Uint8Array(pcmLen);
  212. for(i = 0;i < pcmLen;i++)
  213. {
  214. pcmData[i] = Module.HEAPU8[(retPtr)+i]
  215. }
  216. player.feed(pcmData);
  217. }
  218. else
  219. {
  220. console.log("%d帧 aac 解码失败, %d", decodeCount, pcmLen);
  221. }
  222. decodeCount++;
  223. Module._free(inputPtr);
  224. Module._free(retPtr);
  225. } */
  226. //解协议
  227. function ParseProto(data) {
  228. var temp = "";
  229. var input = new Uint8Array(data),
  230. duration,
  231. video,
  232. audio;
  233. if (input[0] == 0 && input[1] == 0 && input[2] == 0 && input[3] == 1) {
  234. // debugger
  235. video = input;
  236. duration = 24;
  237. var nalType = input[4] & 0x1f; //nalType == 0x07|| nalType == 0x08 || nalType == 0x05
  238. if (!isFeed) {
  239. if (nalType == 0x05) {
  240. console.log("发现I帧");
  241. }
  242. if (nalType == 0x05 && isVisuable) {
  243. console.log("检测到I帧 %d,重新渲染, 耗时 %d ms", nalType, new Date().getTime() - requestTime);
  244. isFeed = true;
  245. }
  246. }
  247. } else if (input[0] == 0xff) {
  248. if (!isEnough) {
  249. requestCount++;
  250. //audioBuffer.push(input);
  251. }
  252. audio = input;
  253. if (new Date().getTime() - curTime > 100) {
  254. delayTime = new Date().getTime();
  255. console.log("接收时间 %d ms", new Date().getTime() - curTime);
  256. }
  257. curTime = new Date().getTime();
  258. duration = 24;
  259. //console.log("duration %d", duration);
  260. } else if (input[0] == 0x68) {
  261. if (input[23] == 0x05) //横竖屏标识
  262. {
  263. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  264. if (state == 1) {
  265. console.log("安卓卡此时竖屏");
  266. //竖屏处理
  267. } else {
  268. console.log("安卓卡此时横屏");
  269. //横屏处理
  270. }
  271. }
  272. if (input[23] == 0x0b) {
  273. console.log("多端登陆");
  274. }
  275. //console.log("屏幕旋转 %s", PrintArry(input));
  276. }
  277. return {
  278. audio: audio,
  279. video: video,
  280. duration: duration
  281. };
  282. }
  283. window.onload = function() {
  284. // var socketURL = 'wss://jmuxer-demo-server.herokuapp.com';
  285. //socketURL = "ws://127.0.0.1:8080"
  286. // socketURL = "ws://192.168.11.233:8080"
  287. //socketURL = "ws://14.215.128.98:14112";
  288. // var socketURL = "ws://192.168.11.66:9101";
  289. var socketURL = "ws://192.168.198.11:9101"
  290. // socketURL = "ws://14.215.128.98:14077";
  291. //socketURL = "wss://192.168.11.242:9104";
  292. var jmuxer = new JMuxer({
  293. node: 'playerVideo',
  294. flushingTime: 15,
  295. fps: 30,
  296. mode: 'video',
  297. debug: false
  298. });
  299. var audioMuxer = new JMuxer({
  300. node: 'audioPlayer',
  301. flushingTime: 15,
  302. clearBuffer: true,
  303. fps: 60, //可以不选,原先43
  304. mode: 'audio',
  305. debug: false
  306. });
  307. curTime = new Date().getTime();
  308. var ws = new WebSocket(socketURL);
  309. ws.binaryType = 'arraybuffer';
  310. //断开检测
  311. ws.onclose = function(e) {
  312. alert("websocket连接断开");
  313. console.log('websocket 断开: ' + e.code + ' ' + e.reason + ' ' + e.wasClean);
  314. console.log(e);
  315. }
  316. ws.addEventListener('open', function(event) {
  317. console.log("发送配置帧");
  318. // ws.send(ConfigChannel("RK3923C1201900139"));
  319. });
  320. ws.addEventListener('error', function(event) {
  321. console.log("连接失败");
  322. });
  323. ws.addEventListener('message', function(event) {
  324. var data = ParseProto(event.data); //JAVA服务器转发
  325. //console.log("收到数据");
  326. var audioData = {
  327. audio: data.audio,
  328. video: null,
  329. duration: data.duration
  330. };
  331. var videoData = {
  332. audio: null,
  333. video: data.video,
  334. duration: data.duration
  335. };
  336. if (myAudio.readyState == 2) {
  337. requestTime = new Date().getTime();
  338. isEnough = false;
  339. console.log("数据存储不够,出现声音停止,时间差 %f", myAudio.buffered.end(0));
  340. myAudio.pause();
  341. //myAudio.playbackRate = 2;
  342. } else if (myAudio.readyState == 4 && isEnough == false) {
  343. myAudio.play();
  344. var time = new Date().getTime();
  345. isEnough = true;
  346. console.log("填满耗时 %d ms, 填充帧数 %d, 填充延迟 %d ms", time - requestTime, requestCount, requestCount * 23);
  347. console.log("----接收到启动 %d ms, 缓冲区 %f---", time - delayTime, myAudio.buffered.end(0) - myAudio.played.end(0));
  348. }
  349. if (data.audio != null) //喂音频
  350. {
  351. if (myAudio.buffered.length > 0 && myAudio.played.length > 0) {
  352. var bufferTime = myAudio.buffered.end(0) - myAudio.played.end(0);
  353. //console.log(" bufferTime %d", bufferTime);
  354. if (bufferTime > 1) {
  355. //console.log("丢掉一些包");
  356. //return;
  357. }
  358. }
  359. audioMuxer.feed(audioData);
  360. }
  361. if (data.video != null) //喂视频
  362. {
  363. if (isFeed) {
  364. jmuxer.feed(data);
  365. }
  366. //jmuxer.feed(videoData);
  367. }
  368. });
  369. var myPlay = document.getElementById("wine");
  370. myPlay.onmousedown = function(event) {
  371. console.log('5555555555')
  372. if (event.button == 0) {
  373. var posX = event.offsetX * 720 * 1.0 / myVideo.clientWidth;
  374. var posY = event.offsetY * 1280 * 1.0 / myVideo.clientHeight;
  375. var buffer = ExexuteMouseDown(posX.toString(), posY.toString());
  376. // console.log('posX=======posY', posX, posY)
  377. // console.log('buffer=======', buffer)
  378. ws.send(buffer);
  379. console.log('ws', ws)
  380. isDrag = true;
  381. }
  382. }
  383. myPlay.onmousemove = function(event) {
  384. console.log('5555555555', isDrag, event.button)
  385. if (isDrag && event.button == 0) {
  386. var posX = event.offsetX * 720 * 1.0 / myVideo.clientWidth;
  387. var posY = event.offsetY * 1280 * 1.0 / myVideo.clientHeight;
  388. var buffer = ExexuteMouseMove(posX.toString(), posY.toString());
  389. ws.send(buffer);
  390. console.log("移动位置 %d, %d", posX, posY);
  391. }
  392. }
  393. myPlay.onmouseup = function(event) {
  394. console.log('5555555555')
  395. isDrag = false;
  396. var posX = event.offsetX * 720 * 1.0 / myVideo.clientWidth;
  397. var posY = event.offsetY * 1280 * 1.0 / myVideo.clientHeight;
  398. var buffer = ExexuteMouseUp(posX.toString(), posY.toString());
  399. ws.send(buffer);
  400. }
  401. myPlay.onkeydown = function(event) {
  402. console.log('5555555555')
  403. ExexuteKeyDown(e.keyCode);
  404. }
  405. }
  406. function Back() {
  407. if (event.button == 2) {
  408. //ExexuteKeyDown(4);
  409. }
  410. ExexuteKeyDown(4);
  411. window.event.returnValue = false;
  412. return false;
  413. }
  414. var url = window.location.href;
  415. url = url.split('/')
  416. // var baseUrl = window.location.href; //"http://192.168.31.20"
  417. // var baseUrl = 'https://'+url[2] //url[2] //'http://192.168.31.159'//'http://' + url[2]
  418. var query = window.location.search.substring(1);
  419. // query = "clientType=1&cardIp=14.215.128.96&port=2012&sn=RK3930C2301900012&demoTime=3600&id=377&diskName=SC93mBww"
  420. var vars = query.split("&");
  421. console.log(vars)
  422. // var baseUrl = 'http://192.168.31.20'
  423. var baseUrl = 'test.androidscloud.com'
  424. var data = {}
  425. // 审核
  426. $.ajax({
  427. url: baseUrl + "/api/user/v1/config/download/isShow",
  428. data: {},
  429. type: 'get',
  430. dataType: 'json',
  431. success: function(data) {
  432. if (data.data) {
  433. $("#showsuss").show()
  434. } else {
  435. $("#showsuss").hide()
  436. }
  437. //
  438. }
  439. })
  440. var clientType = vars.find(e => {
  441. return e.startsWith('clientType')
  442. }) || ''
  443. // console.log(clientType)
  444. data.clientType = clientType.substring(11, clientType.length)
  445. // 小程序直接进入
  446. var diskName = vars.find(e => {
  447. return e.startsWith('diskName')
  448. }) || ''
  449. data.diskName = diskName.substring(9, diskName.length)
  450. // document.title = decodeURI(data.diskName)
  451. if (data.clientType == 1) {
  452. var cardIp = vars.find(e => {
  453. return e.startsWith('cardIp')
  454. }) || ''
  455. var port = vars.find(e => {
  456. return e.startsWith('port')
  457. }) || ''
  458. var sn = vars.find(e => {
  459. return e.startsWith('sn')
  460. }) || ''
  461. var demoTime = vars.find(e => {
  462. return e.startsWith('demoTime')
  463. }) || ''
  464. var id = vars.find(e => {
  465. return e.startsWith('id')
  466. }) || ''
  467. data.clientType = clientType.substring(11, clientType.length)
  468. data.cardIp = cardIp.substring(7, cardIp.length)
  469. data.port = port.substring(5, port.length)
  470. data.sn = sn.substring(3, sn.length)
  471. data.demoTime = demoTime.substring(9, demoTime.length)
  472. data.id = id.substring(3, id.length)
  473. } else if (data.clientType == 2) { //分享屏幕
  474. console.log("走到分享屏幕里面啦==========", data.clientTypes);
  475. $(".leftmains").css({
  476. "right": "-4rem"
  477. })
  478. $('.leftmains').hide()
  479. $('.bottommains').hide()
  480. $('#btnMuted').hide()
  481. let ip = vars.find(e => {
  482. return e.startsWith('ip')
  483. }) || ''
  484. var username = vars.find(e => {
  485. return e.startsWith('username')
  486. }) || ''
  487. var id = vars.find(e => {
  488. return e.startsWith('id')
  489. }) || ''
  490. var userCardId = vars.find(e => {
  491. return e.startsWith('userCardId')
  492. }) || ''
  493. data.id = id.substring(3, id.length)
  494. data.username = username.substring(9, username.length)
  495. data.ip = ip.substring(3, ip.length)
  496. data.userCardId = userCardId.substring(11, userCardId.length)
  497. } else {
  498. // $(".leftmains").css({
  499. // "right":"-4rem"
  500. // })
  501. // $('.leftmains').hide()
  502. // $('.bottommains').hide()
  503. // $('#btnMuted').hide()
  504. var username = vars.find(e => {
  505. return e.startsWith('username')
  506. }) || ''
  507. var userCardId = vars.find(e => {
  508. return e.startsWith('userCardId')
  509. }) || ''
  510. data.username = username.substring(9, username.length)
  511. data.userCardId = userCardId.substring(11, userCardId.length)
  512. console.log(data.ip)
  513. }
  514. // 心跳
  515. // var time = 1000 * 30;
  516. // var interval;
  517. // fun()
  518. //
  519. // function run() {
  520. //
  521. // interval = setInterval(fun, time);
  522. // }
  523. //
  524. // function fun() {
  525. // $.ajax({
  526. // url: baseUrl + "/api/game/v1/cloudGame/dev/get/cardSn",
  527. // data: {
  528. // sn: data.sn
  529. // },
  530. // type: 'get',
  531. // dataType: 'json',
  532. // success: function(data) {
  533. //
  534. // }
  535. // })
  536. //
  537. // };
  538. // run();
  539. // data.clientType=1
  540. // data.sn="RK3930C2301900044"
  541. // data.cardIp="14.215.128.96"
  542. // data.port=2044
  543. var orientation = 0 //0 竖屏,1横屏
  544. var winHeight = window.screen.height - window.innerHeight
  545. // var urlss = url[2]
  546. // var urlss='192.168.31.20'
  547. // var urlss = "14.215.128.96"
  548. var urlss = 'test.androidscloud.com'
  549. document.body.addEventListener('touchmove', function(e) {
  550. e.preventDefault()
  551. }, {
  552. passive: false
  553. })
  554. //
  555. // urlss = "14.215.128.96"
  556. // console.log()
  557. // data.clientType = 1
  558. // data.sn="RK3930C2301900044"
  559. // data.cardIp="14.215.128.96"
  560. // data.port=2044
  561. // if (data.clientType == 3) {
  562. // var players = AV.Player.fromWebSocket("wss://" + urlss + '/authVideoWebSocket?' + "clientType=" + data.clientType +
  563. // "&username=" + data.username + "&userCardId=" + data.userCardId);
  564. // } else if (data.clientType == 2) {
  565. // // var players = AV.Player.fromWebSocket("wss://" + urlss + '/shareWebSocket?' + "clientType=" + data.clientType +
  566. // // "&username=" + data.username + "&userCardId=" + data.userCardId + "&ip=" + data.ip);
  567. // var players = AV.Player.fromWebSocket(
  568. // "wss://test.androidscloud.com/videoWebSocket?clientType=1&cardIp=14.215.128.96&port=2005&sn=RK3930C2301900005");
  569. // } else {
  570. // var players = AV.Player.fromWebSocket("wss://" + urlss + '/videoWebSocket?' + "clientType=" + data.clientType +
  571. // "&cardIp=" + data.cardIp + "&port=" + data.port + "&sn=" + data.sn);
  572. // }
  573. // // debugger
  574. // var players = AV.Player.fromWebSocket('ws://14.215.128.96/authVideoWebSocket?clientType=3&username=WqXTc1593762177&userCardId=377');
  575. // players.play();
  576. // players.volume = 100
  577. //var players = AV.Player.fromWebSocket('ws://14.215.128.96/videoWebSocket?clientType=0&cardIp=30.30.30.58&port=9100&sn=RK3930C2301900060');
  578. var warid = {
  579. id: data.id,
  580. type: 1,
  581. sn: data.sn
  582. }
  583. //结束时间 type=2
  584. var warids = {
  585. id: data.id,
  586. type: 2,
  587. sn: data.sn
  588. }
  589. // $.ajax({})
  590. // 关闭浏览器
  591. // window.onbeforeunload = function() {}
  592. //撤销的array
  593. var cancelList = new Array();
  594. //撤销的次数
  595. var cancelIndex = 0;
  596. var inputType = 0 //输入类型 0:手写,1:键盘输入
  597. //判断是否ie
  598. var IE_HACK = (/msie/i.test(navigator.userAgent) &&
  599. !/opera/i.test(navigator.userAgent));
  600. // 云手机相关逻辑
  601. // var player = new Player({
  602. // size: {
  603. // width: 1280,
  604. // height: 720
  605. // }
  606. // });
  607. // var secanv = document.getElementById("wine");
  608. // secanv.appendChild(player.canvas);
  609. // console.log("player=========>>>>", player);
  610. // console.log("secanv>>>>", secanv);
  611. // &cardIp="+data.data.extranetIp+"&port="+data.data.extranetPort+"&sn="+data.data.sn
  612. $(function() {
  613. initCanvas();
  614. });
  615. //初始化
  616. var initCanvas = function() {
  617. }
  618. $("#voew").on("click", function() {})
  619. $("#box").on("click", function() {
  620. // draw_graph('pencil', this)
  621. })
  622. console.log(player)
  623. $('#mocan').on('click', function() {
  624. draw_graph('pencil', this)
  625. })
  626. // //初始化一下就可以了,
  627. let vConsole = new VConsole();
  628. // //你打印的数据 比如
  629. console.log('test');
  630. //就可像小程序一样的看了和调试了。
  631. $('.no-ne-an').on('click', function() {
  632. //结束时间 type=2
  633. let warids = {
  634. id: data.id,
  635. type: 2,
  636. sn: data.sn
  637. }
  638. $.ajax({
  639. url: baseUrl + "/api/game/v1/cloudGame/dev/getSn",
  640. data: warid,
  641. type: 'get',
  642. dataType: 'json',
  643. success: function(data) {
  644. history.go(-1)
  645. if (data.status == 0) {
  646. } else {
  647. alert(data.msg)
  648. }
  649. //
  650. }
  651. })
  652. })
  653. var btnMuted = document.querySelector("#btnMuted");
  654. btnMuted && (function() {
  655. var setHistory = function(left, top) {
  656. try {
  657. localStorage.setItem("muted-btn-loc", JSON.stringify({
  658. left: left,
  659. top: top
  660. }));
  661. } catch (ex) {}
  662. };
  663. var getHistory = function() {
  664. try {
  665. var value = localStorage.getItem("muted-btn-loc");
  666. if (!value) return null;
  667. value = JSON.parse(value);
  668. if (!value) return null;
  669. return value;
  670. } catch (ex) {
  671. return null
  672. }
  673. };
  674. var fixLoc = function(loc) {
  675. var rect = btnMuted.getBoundingClientRect();
  676. rect = {
  677. top: rect.top,
  678. left: rect.left,
  679. width: rect.width,
  680. height: rect.height
  681. }; //部分低版本浏览器,该属性为只读
  682. if (loc) {
  683. rect.left = loc.left;
  684. rect.top = loc.top;
  685. }
  686. var minX = 0;
  687. var minY = 0;
  688. var docRect = document.documentElement.getBoundingClientRect();
  689. var maxY = docRect.height - rect.height;
  690. var maxX = docRect.width - rect.width;
  691. var left = rect.left;
  692. var top = rect.top;
  693. left = Math.min(left, maxX);
  694. left = Math.max(left, minX);
  695. top = Math.min(top, maxY);
  696. top = Math.max(top, minY);
  697. console.log(rect.top, top, loc);
  698. if (loc || top !== rect.top || left !== rect.left) {
  699. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  700. }
  701. }
  702. window.addEventListener("resize", function() {
  703. fixLoc();
  704. });
  705. var touchPoint = {
  706. pageY: 0,
  707. pageX: 0
  708. };
  709. var currentLoc = {
  710. top: 0,
  711. left: 0,
  712. curTop: 0,
  713. curLeft: 0
  714. };
  715. var toMove = false;
  716. var touchmove = function(e) {
  717. e.preventDefault();
  718. var point = e.changedTouches[0];
  719. var top = -touchPoint.pageY + point.pageY;
  720. var left = -touchPoint.pageX + point.pageX;
  721. if (toMove) {
  722. top += currentLoc.top;
  723. left += currentLoc.left;
  724. currentLoc.curLeft = left;
  725. currentLoc.curTop = top;
  726. btnMuted.style.cssText += "left:" + left + "px;top:" + top + "px;";
  727. } else {
  728. if (Math.abs(top) >= 5 || Math.abs(left) >= 5) {
  729. toMove = true;
  730. }
  731. }
  732. };
  733. var touchend = function() {
  734. window.removeEventListener("touchmove", touchmove, {
  735. passive: false
  736. });
  737. window.removeEventListener("touchend", touchend, {
  738. passive: false
  739. });
  740. if (toMove) {
  741. setHistory(currentLoc.curLeft, currentLoc.curTop);
  742. fixLoc();
  743. } else {
  744. //按点击处理
  745. var set = $('.control-right-img').attr("data-id")
  746. if (set == '1') {
  747. $('.control-right-img').attr({
  748. "data-id": "2"
  749. })
  750. // $('.control-right-img').find('img').attr({
  751. // "src": "../static/img/musicturn.png"
  752. // })
  753. // players.volume = 100
  754. $(".leftmains").css({
  755. "right": "-4rem"
  756. })
  757. // console.log(players)
  758. // players.play();
  759. } else {
  760. $('.control-right-img').attr({
  761. "data-id": "1"
  762. })
  763. $(".leftmains").css({
  764. "right": "0rem"
  765. })
  766. // $('.control-right-img').find('img').attr({
  767. // "src": "../static/img/musicfalse.png"
  768. // })
  769. // players.volume = 0
  770. // players.off('pause');
  771. // players.pause();
  772. // var embed = document.embedPlay;
  773. // console.log(players, "fdsfdsf")
  774. }
  775. }
  776. }
  777. btnMuted.addEventListener("touchstart", function(e) {
  778. e.preventDefault();
  779. toMove = false;
  780. var point = e.changedTouches[0];
  781. touchPoint.pageX = point.pageX;
  782. touchPoint.pageY = point.pageY;
  783. var rect = e.target.getBoundingClientRect();
  784. currentLoc.top = rect.top;
  785. currentLoc.left = rect.left;
  786. window.addEventListener("touchmove", touchmove, {
  787. passive: false
  788. });
  789. window.addEventListener("touchend", touchend, {
  790. passive: false
  791. });
  792. }, {
  793. passive: false
  794. });
  795. var history = getHistory();
  796. if (history) {
  797. fixLoc(history);
  798. }
  799. btnMuted.classList.remove("hide");
  800. })();
  801. $(".boximg").on("click", function() {
  802. $(".mainbox").css({
  803. "display": "none"
  804. })
  805. })
  806. // 剪切板
  807. $(".sboxbu").on("click", function() {
  808. $(".sbox").css({
  809. "display": "none"
  810. })
  811. })
  812. // 剪切板
  813. $(".uploadss").on("click", function() {
  814. $(".sbox").css({
  815. "display": "none"
  816. })
  817. })
  818. $("#upload").on("click", function() {
  819. wx.miniProgram.switchTab({
  820. url: '/pages/home/home'
  821. })
  822. })
  823. function selectText(x) {
  824. if (document.selection) {
  825. var range = document.body.createTextRange();
  826. range.moveToElementText(x);
  827. range.select();
  828. } else if (window.getSelection) {
  829. var selection = window.getSelection();
  830. var range = document.createRange();
  831. selection.removeAllRanges();
  832. range.selectNodeContents(x);
  833. selection.addRange(range);
  834. }
  835. }
  836. function cp(x) {
  837. $(".mainbox").css({
  838. "display": "none"
  839. })
  840. $(".sbox").css({
  841. "display": "block"
  842. })
  843. selectText(x);
  844. document.execCommand("copy");
  845. }
  846. </script>
  847. <script type="text/javascript" src="jmuxer.js"></script>
  848. </body>
  849. </html>