remote.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. include_once '../auth.php';
  3. if(!file_exists("data")){
  4. mkdir("data",0777,true);
  5. }
  6. if (isset($_GET['comm']) && isset($_GET['rid'])){
  7. $rid = $_GET['rid'];
  8. $rid = explode(",",$rid)[0];
  9. file_put_contents("data/" . $rid . ".inf",$_GET['comm']);
  10. echo "DONE";
  11. exit(0);
  12. }
  13. ?>
  14. <html>
  15. <head>
  16. <link rel="stylesheet" href="../script/tocas/tocas.css">
  17. <script src="../script/tocas/tocas.js"></script>
  18. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  19. <script src="../script/jquery.min.js"></script>
  20. <script src="../script/ao_module.js"></script>
  21. <style>
  22. body{
  23. background-color:#0c0c0c;
  24. color:white;
  25. }
  26. .white{
  27. color:white !important;
  28. }
  29. </style>
  30. </head>
  31. <body>
  32. <br>
  33. <div class="ts container">
  34. <div class="ts white header">
  35. <i class="options icon"></i>RemotePlay Remote
  36. <div class="sub white header">Control your remote player here!</div>
  37. </div>
  38. <p class="white">Target RemotePlay ID</p>
  39. <div class="ts basic mini fluid input">
  40. <input id="remoteID" class="white" type="text">
  41. </div>
  42. <p class="white">Volume Control (Min <--> Max)</p>
  43. <div class="ts slider">
  44. <input id="vol" type="range" min="0" max="1" step="0.05" value="0">
  45. </div>
  46. <br>
  47. <div class="ts separated mini buttons">
  48. <button class="ts basic white button" onClick="play();"><i class="play icon"></i>Play</button>
  49. <button class="ts basic white button" onClick="pause();"><i class="pause icon"></i>Pause</button>
  50. <button class="ts basic white button" onClick="bwd();"><i class="play icon"></i>Back forward</button>
  51. <button class="ts basic white button" onClick="fwd();"><i class="play icon"></i>Fast forward</button>
  52. <button class="ts basic white button" onClick="speedincrease();"><i class="play icon"></i>Speed increase</button>
  53. <button class="ts basic white button" onClick="stop();"><i class="stop icon"></i>Stop</button>
  54. <button class="ts basic white button" onClick="mute();"><i class="volume off icon"></i>Mute</button>
  55. <button class="ts basic white button" onClick="reset();"><i class="stop icon"></i>Reset</button>
  56. </div>
  57. </div>
  58. <script>
  59. var rid = "";
  60. ao_module_setWindowSize(500,320);
  61. $("#vol").on("change",function(){
  62. sendCommand("setVol",$(this).val());
  63. });
  64. $("#remoteID").on("change",function(){
  65. ao_module_saveStorage("remoteplay","remoteID",$(this).val());
  66. rid = $(this).val();
  67. });
  68. function play(){
  69. sendCommand("play","");
  70. }
  71. function pause(){
  72. sendCommand("pause","");
  73. }
  74. function fwd(){
  75. sendCommand("fwd","");
  76. }
  77. var speedincreaseing = false;
  78. function speedincrease(){
  79. if(speedincreaseing){
  80. clearInterval(timer_1);
  81. speedincreaseing = false;
  82. }else{
  83. timer_1 = setInterval(fwd, 1000);
  84. speedincreaseing = true;
  85. }
  86. }
  87. function bwd(){
  88. sendCommand("bwd","");
  89. }
  90. function stop(){
  91. sendCommand("stop","");
  92. }
  93. function mute(){
  94. sendCommand("setVol","0");
  95. $("#vol").val(0);
  96. }
  97. function reset(){
  98. sendCommand("reset","");
  99. }
  100. function sendCommand(comm,value){
  101. var fullcomm = comm + "," + value;
  102. $.get("remote.php?comm=" + fullcomm + "&rid=" + rid,function(data){
  103. if (data.includes("ERROR")){
  104. }
  105. });
  106. }
  107. $(document).ready(function(){
  108. var previousRemoteID = ao_module_getStorage("remoteplay","remoteID");
  109. if (previousRemoteID !== undefined){
  110. $("#remoteID").val(previousRemoteID);
  111. rid = previousRemoteID;
  112. }
  113. });
  114. </script>
  115. </body>
  116. </html>