mediaPlayer.html 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="mobile-web-app-capable" content="yes">
  5. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  6. <meta charset="UTF-8">
  7. <link rel="stylesheet" href="../../script/semantic/semantic.min.css">
  8. <script src="../../script/jquery.min.js"></script>
  9. <script src="../../script/semantic/semantic.min.js"></script>
  10. <script src="../../script/ao_module.js"></script>
  11. <title>ArOZ Media Player</title>
  12. <style>
  13. html, body{
  14. height:100%;
  15. width:100%;
  16. padding: 0px;
  17. margin:0px;
  18. }
  19. body{
  20. background-color:rgba(10,10,10,1);
  21. overflow:hidden;
  22. }
  23. video{
  24. height:100%;
  25. width:100%;
  26. }
  27. .videoWrapper{
  28. width:100%;
  29. height:calc(100%);
  30. }
  31. .playerMenu{
  32. height:28px;
  33. width: 100%;
  34. padding:3px;
  35. color:white;
  36. position:absolute;
  37. }
  38. #videocover{
  39. width:100%;
  40. height:100%;
  41. top:0px;
  42. left:0px;
  43. position:absolute;
  44. z-index:99;
  45. display:none;
  46. }
  47. .blur{
  48. filter: blur(2px);
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <div class="playerMenu">
  54. <div style="cursor:pointer;" onclick="showMenu();">
  55. <i class="large content icon"></i>
  56. </div>
  57. </div>
  58. <dib id="videocover" onclick="hideMenu();"></dib>
  59. <div class="videoWrapper">
  60. <video id="player" autoplay controls></video>
  61. </div>
  62. <div id="mainmenu" class="ui left fixed inverted vertical menu" style="overflow-y:auto; width:220px;">
  63. <div id="playerIcon" class="item">
  64. <img class="ui mini middle aligned image" src="img/mediaPlayer.png" style="margin-right:12px;">
  65. <span>ArOZ Media Player</span>
  66. </div>
  67. <a class="item" onclick="hideMenu();"><i class="caret left icon"></i> Hide Menu</a>
  68. </div>
  69. </div>
  70. <script>
  71. var fileList = ao_module_loadInputFiles();
  72. var vid = document.getElementById("player");
  73. var currentPlaying = 0;
  74. var targetVol = 0.7;
  75. if (localStorage.getItem("global_volume") !== null && localStorage.getItem("global_volume") !== undefined){
  76. targetVol = localStorage.getItem("global_volume");
  77. }
  78. if (fileList !== null){
  79. playFile(fileList[0]);
  80. ao_module_setWindowTitle(fileList[0].filename);
  81. }
  82. $(".file.item").remove();
  83. fileList = fileList.reverse();
  84. for (var i =0; i < fileList.length; i++){
  85. $("#playerIcon").after(`<a class="file item" onclick="playFileByID(${i});">${fileList[i].filename}</a>`);
  86. }
  87. function playFileByID(id){
  88. playFile(fileList[id]);
  89. ao_module_setWindowTitle(fileList[id].filename);
  90. hideMenu();
  91. }
  92. function showMenu(){
  93. $('.menu').show();
  94. $('#videocover').show();
  95. $(".videoWrapper").addClass("blur");
  96. }
  97. function playFile(fileObject){
  98. $("#player").attr('src',"../../media?file=" + encodeURIComponent(fileObject.filepath));
  99. vid.volume = parseFloat(targetVol);
  100. }
  101. function hideMenu(){
  102. $('.menu').hide();
  103. $('#videocover').hide();
  104. $(".videoWrapper").removeClass("blur");
  105. }
  106. hideMenu();
  107. </script>
  108. </body>
  109. </html>