WXtrialInterface.html 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976
  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. <!-- <video width="70%" disablePictureInPicture="true" autoplay poster="images/loader-thumb.jpg" id="playerVideo"></video> -->
  57. <!-- <div id="wine"> -->
  58. <!-- <video id="video1" muted="muted" x5-video-orientation="landscape" playsinline="true" autoplay="true"
  59. webkit-playsinline="true" x5-playsinline="true" x5-video-player-type="h5" x5-video-player-fullscreen="false" style="pointer-events: none;"></video> -->
  60. <!-- <div id="box"> -->
  61. <video style="pointer-events: none;object-fit: fill;width: 100%;" disablePictureInPicture="true" autoplay poster="images/loader-thumb.jpg"
  62. id="playerVideo"></video>
  63. <audio preload="auto" autoplay controls poster="images/loader-thumb.jpg" id="audioPlayer"></audio>
  64. <!-- </div> -->
  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="../static/distss/WXdraw.js?id=105"></script> -->
  142. <script>
  143. //隐藏控件 controls
  144. var fpsCount = 0;
  145. var requestCount = 0;
  146. var timeCount = 0;
  147. var isVisuable = true;
  148. var isFeed = true;
  149. var isDrag = false;
  150. var shoudDrop = false;
  151. var isEnough = true;
  152. var ifCanPlay = false;
  153. var isFinish = false;
  154. var delayTime = new Date().getTime();
  155. var feedTime = new Date().getTime();
  156. var readyTime = new Date().getTime();
  157. var requestTime = new Date().getTime();
  158. var curTime = new Date().getTime();
  159. var requestTime = new Date().getTime(); //记录离开时间
  160. var myVideo = document.getElementById("playerVideo");
  161. $("#wine").click(function() {
  162. console.log("9999999999")
  163. });
  164. var myAudio = document.getElementById("audioPlayer");
  165. var audioBuffer = [];
  166. var audioBack = [];
  167. Module = {};
  168. Module.onRuntimeInitialized = function() {
  169. console.log("Wasm 加载成功!")
  170. isFinish = true;
  171. }
  172. document.addEventListener("visibilitychange", () => {
  173. if (document.visibilityState == "visible") {
  174. console.log("页面可见,继续喂视频");
  175. //requestTime = new Date().getTime();
  176. isVisuable = true;
  177. } else {
  178. isVisuable = false;
  179. isFeed = false;
  180. myVideo.pause();
  181. }
  182. });
  183. myVideo.play();
  184. myVideo.addEventListener('pause', function() {
  185. //console.log("视频播放暂停");
  186. isFeed = false;
  187. });
  188. myAudio.addEventListener('canplay', function() {
  189. console.log("缓冲区大小 %f", myAudio.buffered.end(0) - myAudio.buffered.start(0));
  190. });
  191. /*function decodeAAC(data)
  192. {
  193. var retPtr = Module._malloc(4 * 5 * 1024);//接收的数据
  194. var inputPtr = Module._malloc(4 * data.length);//输入数据
  195. for( i =0;i < data.length;i++)
  196. {
  197. Module.HEAPU8[(inputPtr)+i] = data[i];//转换为堆数据
  198. }
  199. var pcmLen = Module._feedData(retPtr, inputPtr, data.length);
  200. if(pcmLen > 0)
  201. {
  202. //console.log("%d帧 aac 解码成功, %d", decodeCount, pcmLen);
  203. var pcmData = new Uint8Array(pcmLen);
  204. for(i = 0;i < pcmLen;i++)
  205. {
  206. pcmData[i] = Module.HEAPU8[(retPtr)+i]
  207. }
  208. player.feed(pcmData);
  209. }
  210. else
  211. {
  212. console.log("%d帧 aac 解码失败, %d", decodeCount, pcmLen);
  213. }
  214. decodeCount++;
  215. Module._free(inputPtr);
  216. Module._free(retPtr);
  217. } */
  218. //解协议
  219. function ParseProto(data) {
  220. var temp = "";
  221. var input = new Uint8Array(data),
  222. duration,
  223. video,
  224. audio;
  225. if (input[0] == 0 && input[1] == 0 && input[2] == 0 && input[3] == 1) {
  226. // debugger
  227. video = input;
  228. duration = 24;
  229. var nalType = input[4] & 0x1f; //nalType == 0x07|| nalType == 0x08 || nalType == 0x05
  230. if (!isFeed) {
  231. if (nalType == 0x05) {
  232. console.log("发现I帧");
  233. }
  234. if (nalType == 0x05 && isVisuable) {
  235. console.log("检测到I帧 %d,重新渲染, 耗时 %d ms", nalType, new Date().getTime() - requestTime);
  236. isFeed = true;
  237. }
  238. }
  239. } else if (input[0] == 0xff) {
  240. if (!isEnough) {
  241. requestCount++;
  242. //audioBuffer.push(input);
  243. }
  244. audio = input;
  245. if (new Date().getTime() - curTime > 100) {
  246. delayTime = new Date().getTime();
  247. console.log("接收时间 %d ms", new Date().getTime() - curTime);
  248. }
  249. curTime = new Date().getTime();
  250. duration = 24;
  251. //console.log("duration %d", duration);
  252. } else if (input[0] == 0x68) {
  253. if (input[23] == 0x05) //横竖屏标识
  254. {
  255. var state = CheckScreenDirection(input.slice(24, 24 + 8));
  256. if (state == 1) {
  257. console.log("安卓卡此时竖屏");
  258. //竖屏处理
  259. } else {
  260. console.log("安卓卡此时横屏");
  261. //横屏处理
  262. }
  263. }
  264. if (input[23] == 0x0b) {
  265. console.log("多端登陆");
  266. }
  267. //console.log("屏幕旋转 %s", PrintArry(input));
  268. }
  269. return {
  270. audio: audio,
  271. video: video,
  272. duration: duration
  273. };
  274. }
  275. window.onload = function() {
  276. // var socketURL = 'wss://jmuxer-demo-server.herokuapp.com';
  277. //socketURL = "ws://127.0.0.1:8080"
  278. // socketURL = "ws://192.168.11.233:8080"
  279. //socketURL = "ws://14.215.128.98:14112";
  280. // var socketURL = "ws://192.168.11.66:9101";
  281. var socketURL = "ws://192.168.198.11:9101"
  282. // socketURL = "ws://14.215.128.98:14077";
  283. //socketURL = "wss://192.168.11.242:9104";
  284. var jmuxer = new JMuxer({
  285. node: 'playerVideo',
  286. flushingTime: 15,
  287. fps: 30,
  288. mode: 'video',
  289. debug: false
  290. });
  291. var audioMuxer = new JMuxer({
  292. node: 'audioPlayer',
  293. flushingTime: 15,
  294. clearBuffer: true,
  295. fps: 60, //可以不选,原先43
  296. mode: 'audio',
  297. debug: false
  298. });
  299. curTime = new Date().getTime();
  300. var ws = new WebSocket(socketURL);
  301. ws.binaryType = 'arraybuffer';
  302. //断开检测
  303. ws.onclose = function(e) {
  304. alert("websocket连接断开");
  305. console.log('websocket 断开: ' + e.code + ' ' + e.reason + ' ' + e.wasClean);
  306. console.log(e);
  307. }
  308. ws.addEventListener('open', function(event) {
  309. console.log("发送配置帧");
  310. // ws.send(ConfigChannel("RK3923C1201900139"));
  311. });
  312. ws.addEventListener('error', function(event) {
  313. console.log("连接失败");
  314. });
  315. ws.addEventListener('message', function(event) {
  316. var data = ParseProto(event.data); //JAVA服务器转发
  317. //console.log("收到数据");
  318. var audioData = {
  319. audio: data.audio,
  320. video: null,
  321. duration: data.duration
  322. };
  323. var videoData = {
  324. audio: null,
  325. video: data.video,
  326. duration: data.duration
  327. };
  328. if (myAudio.readyState == 2) {
  329. requestTime = new Date().getTime();
  330. isEnough = false;
  331. console.log("数据存储不够,出现声音停止,时间差 %f", myAudio.buffered.end(0));
  332. myAudio.pause();
  333. //myAudio.playbackRate = 2;
  334. } else if (myAudio.readyState == 4 && isEnough == false) {
  335. myAudio.play();
  336. var time = new Date().getTime();
  337. isEnough = true;
  338. console.log("填满耗时 %d ms, 填充帧数 %d, 填充延迟 %d ms", time - requestTime, requestCount, requestCount * 23);
  339. console.log("----接收到启动 %d ms, 缓冲区 %f---", time - delayTime, myAudio.buffered.end(0) - myAudio.played.end(0));
  340. }
  341. if (data.audio != null) //喂音频
  342. {
  343. if (myAudio.buffered.length > 0 && myAudio.played.length > 0) {
  344. var bufferTime = myAudio.buffered.end(0) - myAudio.played.end(0);
  345. //console.log(" bufferTime %d", bufferTime);
  346. if (bufferTime > 1) {
  347. //console.log("丢掉一些包");
  348. //return;
  349. }
  350. }
  351. audioMuxer.feed(audioData);
  352. }
  353. if (data.video != null) //喂视频
  354. {
  355. if (isFeed) {
  356. jmuxer.feed(data);
  357. }
  358. //jmuxer.feed(videoData);
  359. }
  360. });
  361. var myPlay = document.getElementById("player");
  362. myPlay.onmousedown = function(event) {
  363. console.log('5555555555')
  364. if (event.button == 0) {
  365. var posX = event.offsetX * 720 * 1.0 / myVideo.clientWidth;
  366. var posY = event.offsetY * 1280 * 1.0 / myVideo.clientHeight;
  367. var buffer = ExexuteMouseDown(posX.toString(), posY.toString());
  368. console.log('posX=======posY', posX, posY)
  369. console.log('buffer=======', buffer)
  370. ws.send(buffer);
  371. console.log('ws', ws)
  372. isDrag = true;
  373. }
  374. }
  375. myPlay.onmousemove = function(event) {
  376. console.log('5555555555', isDrag, event.button)
  377. if (isDrag && event.button == 0) {
  378. var posX = event.offsetX * 720 * 1.0 / myVideo.clientWidth;
  379. var posY = event.offsetY * 1280 * 1.0 / myVideo.clientHeight;
  380. var buffer = ExexuteMouseMove(posX.toString(), posY.toString());
  381. ws.send(buffer);
  382. console.log("移动位置 %d, %d", posX, posY);
  383. }
  384. }
  385. myPlay.onmouseup = function(event) {
  386. console.log('5555555555')
  387. isDrag = false;
  388. var posX = event.offsetX * 720 * 1.0 / myVideo.clientWidth;
  389. var posY = event.offsetY * 1280 * 1.0 / myVideo.clientHeight;
  390. var buffer = ExexuteMouseUp(posX.toString(), posY.toString());
  391. ws.send(buffer);
  392. }
  393. myPlay.onkeydown = function(event) {
  394. console.log('5555555555')
  395. ExexuteKeyDown(e.keyCode);
  396. }
  397. }
  398. function Back() {
  399. if (event.button == 2) {
  400. //ExexuteKeyDown(4);
  401. }
  402. ExexuteKeyDown(4);
  403. window.event.returnValue = false;
  404. return false;
  405. }
  406. var topwinHeight = window.screen.height - window.innerHeight + 30; //计算title top 头部
  407. // $('#wine').css({
  408. // "width": window.screen.width,
  409. // "height": window.screen.height - topwinHeight - 20,
  410. // "position": "absolute",
  411. // })
  412. // var winese = document.createElement("wine");
  413. // wine.style.top = "-" + winese + 'px';
  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>