embedded.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <?php
  2. include '../auth.php';
  3. ?>
  4. <!DOCTYPE html>
  5. <meta name="mobile-web-app-capable" content="yes">
  6. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  7. <html>
  8. <head>
  9. <meta charset="UTF-8">
  10. <script src="../script/jquery.min.js"></script>
  11. <link rel="stylesheet" href="../script/tocas/tocas.css">
  12. <script type='text/javascript' src="../script/tocas/tocas.js"></script>
  13. <title>ArOZ Onlineβ</title>
  14. </head>
  15. <body style="background-color:rgba(10,10,10,1);overflow:hidden;">
  16. <div style="width:100%;" align="center">
  17. <?php
  18. if (isset($_GET['filepath']) && $_GET['filepath'] != ""){
  19. //There are given src for video attribute
  20. if (file_exists($_GET['filepath'])|| strpos($_GET['filepath'],"extDiskAccess.php")){
  21. echo '<video id="player" style="position:fixed; height:100%; max-width:100% ;top:0; left:0;" src="'.$_GET['filepath'].'" autoplay controls></video>';
  22. $filename = basename($_GET['filepath'], ".mp4");
  23. if (ctype_xdigit(str_replace("inith","",$filename)) && strlen(str_replace("inith","",$filename)) % 2 == 0) {
  24. $decodedName = hex2bin(str_replace("inith","",$filename));
  25. }else{
  26. $decodedName = $filename;
  27. }
  28. }else{
  29. die('<i class="remove icon"></i>API call error: 404 File not found.');
  30. }
  31. }else{
  32. die('<i class="remove icon"></i>API call error: src value not found.');
  33. }
  34. if (isset($_GET['filename']) && $_GET['filename'] != ""){
  35. $displayname = $_GET['filename'];
  36. }else{
  37. $displayname = $filename;
  38. }
  39. ?>
  40. </div>
  41. <?php
  42. $playlistDir = "";
  43. $playlistItem = [];
  44. if (isset($_GET['playlist']) && $_GET['playlist'] != ""){
  45. if ($_GET['playlist'] == "uploads"){
  46. $playListName = "Unsorted";
  47. }else{
  48. $playListName = "";
  49. }
  50. $playlistDir = $_GET['playlist'];
  51. echo '<div class="ts segment">';
  52. echo '<div class="ts grid">
  53. <div class="ten wide column"><div class="ts segment"><h5>Playlist >> '.$playListName.'</h5></div></div>
  54. <div class="six wide column"><div class="ts segment">
  55. <div class="ts toggle checkbox">
  56. <input type="checkbox" id="toggle">
  57. <label for="toggle">Auto Play</label>
  58. </div>
  59. </div></div>
  60. </div>';
  61. $template = '<div class="ts grid">
  62. <div class="ten wide column"><div class="ts segment">%Video Attrubute Name%</div></div>
  63. <div class="six wide column"><div class="ts segment">%Operations%</div></div>
  64. </div>';
  65. $playlist = $_GET['playlist'];
  66. $files = glob($playlist . '/*.mp4');
  67. foreach ($files as $file){
  68. array_push($playlistItem,$file);
  69. $thisfilename = basename($file,'.mp4');
  70. $thisdecodedName = hex2bin(str_replace("inith","",$thisfilename));
  71. $thisitem = str_replace('%Video Attrubute Name%',$thisdecodedName,$template);
  72. if ($thisdecodedName == $decodedName){
  73. //If the looping loop back to the playing file, make it blue
  74. $thisitem = str_replace('ts segment','ts inverted info segment',$thisitem);
  75. $thisitem = str_replace('%Operations%','PLAYING',$thisitem);
  76. }else{
  77. $viewPath = "vidPlay.php?src=$file&playlist=$playlist";
  78. $thisitem = str_replace('%Operations%','<a href="'.$viewPath.'" style="color:#1A1A1A;">View Video</a>',$thisitem);
  79. }
  80. echo $thisitem;
  81. }
  82. echo '</div>';
  83. }
  84. ?>
  85. </div>
  86. <script>
  87. //Check window resize and adjust video css
  88. var orgVidWidth = 0;
  89. var orgVidHeight = 0;
  90. var inVDI = !(!parent.isFunctionBar);
  91. var displayName = "<?php echo $displayname;?>";
  92. //Update functions called following the AOB 11-8-2018 updates
  93. //Now, the embedded windows can ask for resize properties and icon from the system
  94. if (inVDI){
  95. //If it is currently in VDI, force the current window size and resize properties
  96. var windowID = $(window.frameElement).parent().attr("id");
  97. parent.setWindowIcon(windowID + "","video");
  98. parent.changeWindowTitle(windowID + "",displayName);
  99. //parent.setGlassEffectMode(windowID + "");
  100. }
  101. $( window ).resize(function(){
  102. if(this.resizeTO) clearTimeout(this.resizeTO);
  103. this.resizeTO = setTimeout(function() {
  104. $(this).trigger('resizeEnd');
  105. }, 100);
  106. });
  107. $(window).bind('resizeEnd', function() {
  108. //adjustVidSize();
  109. adjustVidWidth();
  110. });
  111. function adjustVidWidth(){
  112. var vw = $('#player').width();
  113. var sw = $( window ).width();
  114. var center = parseInt((sw - vw) / 2);
  115. $('#player').css("left",center);
  116. }
  117. function adjustVidSize(recursion = false){
  118. if (recursion){
  119. var sw = $( window ).width() - 1;
  120. var sh = $( window ).height()- 1;
  121. }else{
  122. var sw = $( window ).width();
  123. var sh = $( window ).height();
  124. }
  125. var vw = $('#player').width();
  126. var vh = $('#player').height();
  127. var ratio = orgVidWidth / orgVidHeight;
  128. if (vh > sh){
  129. if (vw > sw){
  130. $('#player').css('height',sh);
  131. $('#player').css('width',sw);
  132. }else if (vw < sw){
  133. $('#player').css('height', sh);
  134. $('#player').css('width', sh * ratio);
  135. }
  136. }else if (vh < sh){
  137. if (vw > sw){
  138. $('#player').css('width',sw);
  139. $('#player').css('height',sw / ratio);
  140. }else if (vw < sw){
  141. $('#player').css('width','auto');
  142. $('#player').css('height','auto');
  143. }
  144. }
  145. //Make the video element center of parent
  146. //Sometime the system will bugged and gives an incorrect scaling result.
  147. //This section of code is used to perform recursion checking on the video scale.
  148. sw = $( window ).width();
  149. sh = $( window ).height();
  150. vw = $('#player').width();
  151. vh = $('#player').height();
  152. if (vw > sw || vh > sh){
  153. //The height or width might be in decimal place lead to error.
  154. adjustVidSize(true);
  155. }
  156. }
  157. //These function is for ArOZ Online System quick storage data processing
  158. function CheckStorage(id){
  159. if (typeof(Storage) !== "undefined") {
  160. return true;
  161. } else {
  162. return false;
  163. }
  164. }
  165. function GetStorage(id){
  166. //All data get are string
  167. return localStorage.getItem(id);
  168. }
  169. function SaveStorage(id,value){
  170. localStorage.setItem(id, value);
  171. return true;
  172. }
  173. //Declare global variables
  174. var globVol;
  175. var video = document.getElementById('player');
  176. var playlist = <?php echo json_encode($playlistItem); ?>;
  177. var thisVidName = <?php echo json_encode($_GET['filepath']); ?>;
  178. var playlistName = <?php echo json_encode($playlistDir); ?>;
  179. video.onvolumechange = function() {
  180. UpdateGlobalVol(video.volume);
  181. };
  182. video.onended = function() {
  183. console.log("Video ended!");
  184. if (GetStorage('VidAutoPlay') == 'true'){
  185. //Play next item in the playlist
  186. for(var i = 0;i<playlist.length;i++){
  187. //console.log(thisVidName,playlist[i]);
  188. thisVidName = thisVidName.replace("\\","/");
  189. playlist[i] = playlist[i].replace("\\","/");
  190. if (thisVidName == playlist[i]){
  191. if (i + 1 == playlist.length){
  192. //if reaching the end of the playlist
  193. if (playlistName == ""){
  194. window.location.href="vidPlay.php?src=" + playlist[0] ;
  195. }else if (playlistName != ""){
  196. window.location.href="vidPlay.php?src=" + playlist[0] + "&playlist=" + playlistName;
  197. }
  198. }else{
  199. //If it is not the last video in the play list
  200. if (playlistName == ""){
  201. window.location.href="vidPlay.php?src=" + playlist[i+1] ;
  202. }else if (playlistName != ""){
  203. window.location.href="vidPlay.php?src=" + playlist[i+1] + "&playlist=" + playlistName;
  204. }
  205. }
  206. }
  207. }
  208. }
  209. };
  210. video.onplaying = function(){
  211. adjustVidWidth();
  212. }
  213. function MobileCheck(){
  214. var check = false;
  215. (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
  216. return check;
  217. }
  218. function SetTitle(){
  219. $(document).attr("title",$('#videoName').html());
  220. }
  221. function CheckHorizontal(){
  222. screenHeight = $(window).height();
  223. screenWidth = $(window).width();
  224. if (screenWidth > screenHeight){
  225. return true;
  226. }else{
  227. return false;
  228. }
  229. }
  230. window.onresize = function(event) {
  231. if (MobileCheck() == true && CheckHorizontal() == true){
  232. $('#btmbar').hide();
  233. }
  234. if (MobileCheck() == true && CheckHorizontal() == false){
  235. $('#btmbar').show();
  236. }
  237. };
  238. function LinkFunctionalBar(){
  239. var lastvol = GetStorage('global_volume');
  240. if (lastvol != null){
  241. globVol = parseFloat(GetStorage('global_volume'));
  242. video.volume = globVol;
  243. }else{
  244. //no previous volume info
  245. globVol = 0.6;
  246. video.volume = globVol;
  247. SaveStorage('global_volume',0.6);
  248. }
  249. $('#globVol').html('Global Volume: ' + globVol*100 + '%');
  250. }
  251. function UpdateGlobalVol(value){
  252. if (inVDI == false){
  253. value = Math.round(value / 0.1) * 10;
  254. }else{
  255. value = (value / 0.1) * 10;
  256. }
  257. value = value / 100;
  258. globVol = value;
  259. $('#globVol').html('Global Volume: ' + globVol*100 + '%');
  260. SaveStorage('global_volume',value);
  261. }
  262. $("#player").on("loadstart", function () {
  263. setTimeout(adjustVidWidth,300);
  264. });
  265. //On System ready
  266. $( document ).ready(function() {
  267. var lastvol = GetStorage('global_volume');
  268. if (lastvol != null){
  269. globVol = parseFloat(GetStorage('global_volume'));
  270. video.volume = globVol;
  271. }else{
  272. //no previous volume info
  273. globVol = 0.6;
  274. video.volume = globVol;
  275. SaveStorage('global_volume',0.6);
  276. }
  277. if (inVDI){
  278. setInterval(function() {
  279. LinkFunctionalBar();
  280. },1000);
  281. }
  282. $('#globVol').html('Global Volume: ' + globVol*100 + '%');
  283. if (GetStorage('VidAutoPlay') == 'true'){
  284. $('#toggle').prop("checked",true);
  285. }else{
  286. $('#toggle').prop("checked",false);
  287. }
  288. if (MobileCheck() == false){
  289. //This is a desktop / laptop PC, make the player size smaller!
  290. //$('#player').css('width', '70%');
  291. //$('#desktopMode').css('display',''); //Show display setting
  292. }
  293. //Set the video attribute to previous page size
  294. /*
  295. if (GetStorage('VidAttrScale') != null){
  296. $('#player').css('width', GetStorage('VidAttrScale')+ '%');
  297. }
  298. */
  299. //Check if it is in mobile horizontal mode.
  300. if (MobileCheck() == true && CheckHorizontal() == true){
  301. $('#btmbar').hide();
  302. }
  303. if (MobileCheck() == true && CheckHorizontal() == false){
  304. $('#btmbar').show();
  305. }
  306. orgVidWidth = $('#player').width();
  307. orgVidHeight = $('#player').height();
  308. SetTitle();
  309. adjustVidWidth();
  310. });
  311. $('#toggle').change(function() {
  312. if(this.checked) {
  313. SaveStorage('VidAutoPlay','true');
  314. }else{
  315. SaveStorage('VidAutoPlay','false');
  316. }
  317. });
  318. function share(){
  319. var url = window.location.href.replace("&","<and>");
  320. window.location.href = "../QuickSend/index.php?share=" + url;
  321. }
  322. function Resize(percentage){
  323. $('#player').css('width', percentage + '%');
  324. //SaveStorage('VidAttrScale',percentage);
  325. }
  326. function downlaod(){
  327. window.location.href = "download.php?download=" + thisVidName;
  328. }
  329. function volDown(){
  330. if (globVol >= 0.1){
  331. UpdateGlobalVol(globVol - 0.1);
  332. video.volume = globVol;
  333. }
  334. }
  335. function volUp(){
  336. if (globVol <= 0.9){
  337. UpdateGlobalVol(globVol + 0.1);
  338. video.volume = globVol;
  339. }
  340. }
  341. </script>
  342. </body>
  343. </html>