WXtrialInterface.html 28 KB

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