vidplay.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <html>
  2. <link rel="stylesheet" href="tocas.min.css">
  3. <head>
  4. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  5. <meta charset="utf-8">
  6. <title>Video</title>
  7. <script>
  8. $(document).ready(function(){
  9. var vidvol = 0.5
  10. var player = document.getElementById("videoplayer");
  11. var viddiv = document.getElementById("vidcontainer");
  12. var maxvidwidth = document.getElementById("vidcontainer").offsetWidth;
  13. var screenwidth = $(window).width();
  14. if (localStorage.getItem("systemvol") != null){
  15. vidvol = localStorage.getItem("systemvol");
  16. player.volume = localStorage.getItem("systemvol");
  17. if( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) {
  18. //Mobile
  19. viddiv.style.left = 0;
  20. viddiv.style.width= screenwidth* 0.93 + 'px';
  21. player.width = screenwidth * 0.89;
  22. }else{
  23. //Viewing on PC
  24. player.width = maxvidwidth * 0.65;
  25. }
  26. }
  27. udvol();
  28. });
  29. </script>
  30. </head>
  31. <body>
  32. <div class="ts container">
  33. <h1>IMUS Laboratory </h1>
  34. <h2>ArOZ Video Bank</h2>
  35. <div class="ts divider"></div>
  36. <div class="ts container">
  37. <?php
  38. $path = $_GET['directory'];
  39. $file = $_GET['filename'];
  40. echo '<div id="vidcontainer" class="ts basic jumbotron" style="background-color: #353535;">';
  41. $filetitle = "|| " . hex2bin(str_replace(".mp4","",str_replace("inith","",$file)));
  42. echo '<h2><font color="white">' . $filetitle . "</font></h2>";
  43. echo '<video id="videoplayer" width="480" autoplay controls>';
  44. echo '<source src="' . $path .$file.'" type="video/mp4">';
  45. echo '<script>';
  46. echo 'var video = document.currentScript.parentElement;';
  47. echo 'video.volume = vidvol;';
  48. echo '</script>';
  49. echo '</video><br>';
  50. echo '</div>';
  51. ?>
  52. <div class="ts basic jumbotron" style="outline: solid #353535">
  53. <a align="right" class="ts mini basic button" href="video.php">Back</a>
  54. <button class="ts mini basic button" onclick="Voldown()" type="button">Vol -</button>
  55. <span id="vol">[Global Volume:100]</span>
  56. <button class="ts mini basic button" onclick="Volup()" type="button">Vol +</button>
  57. <button class="ts mini basic button" onclick="cinema()" type="button">Large Screen</button>
  58. <a class="ts mini basic button" href="<?php echo $path .$file; ?>" download>Download</a>
  59. </div><br>
  60. <script>
  61. var player = document.getElementById("videoplayer");
  62. var oncinema = false;
  63. function udvol(){
  64. $('#vol').text("[Global Volume: " + parseInt(player.volume * 100) + "]");
  65. }
  66. function cinema(){
  67. var maxvidwidth = document.getElementById("vidcontainer").offsetWidth;
  68. if (oncinema == false){
  69. player.width = maxvidwidth * 0.95;
  70. oncinema = true;
  71. }else{
  72. player.width = maxvidwidth * 0.65;
  73. oncinema = false;
  74. }
  75. }
  76. function saveVol(){
  77. var systemvol = player.volume;
  78. localStorage.setItem("systemvol", systemvol);
  79. }
  80. function Voldown() {
  81. player.volume -= 0.1;
  82. saveVol();
  83. udvol();
  84. }
  85. function Volup() {
  86. player.volume += 0.1;
  87. saveVol();
  88. udvol();
  89. }
  90. </script>
  91. </body>
  92. </html>