瀏覽代碼

Add files via upload

yeungalan 5 年之前
父節點
當前提交
5d7ce45ab2
共有 7 個文件被更改,包括 70 次插入43 次删除
  1. 1 1
      RemotePlay/description.txt
  2. 3 3
      RemotePlay/embedded.php
  3. 31 10
      RemotePlay/index.php
  4. 23 23
      RemotePlay/manifest.json
  5. 2 2
      RemotePlay/mobileremote.php
  6. 8 2
      RemotePlay/opr.php
  7. 2 2
      RemotePlay/remote.php

+ 1 - 1
RemotePlay/description.txt

@@ -1 +1 @@
-Dummy module for experimental purpose. Do whatever you like with this folder.
+aCloud Remote Play. Stream media from one browser to another.

+ 3 - 3
RemotePlay/embedded.php

@@ -94,8 +94,8 @@ if(!$valid){
 	</h5>
 	<hr>
 	<p class="white">Target RemotePlay ID</p>
-	<div class="ts floating dropdown labeled icon button" style="padding: 0px;padding-right: calc(0.22em + 1em + .78571em * 2) !important;padding-left: 0em !important;background-color: black;color:white;height: 39.97px" width="100%">
-					<div class="text">
+	<div class="ts floating dropdown labeled icon button" style="padding: 0px;padding-right: calc(0.22em + 1em + .78571em * 2) !important;padding-left: 0em !important;background-color: black;color:white;height: 39.97px;width:100%">
+					<div class="text" style="width:100%">
 						<div class="ts fluid input" style="right 1px;bottom:1px">
 							<input type="text" style="border-top-right-radius: 0px;border-bottom-right-radius: 0px;background-color: black;color: white!important;border-color: white!important;border-right:0px" placeholder="RemotePlay ID" id="remoteID_tb">
 						</div>
@@ -188,4 +188,4 @@ function update(){
 	}
 	</script>
 </body>
-</html>
+</html>

+ 31 - 10
RemotePlay/index.php

@@ -39,6 +39,7 @@ $rid = rand(1000,9999);
 ?>
 <body>
 <br>
+
 </body>
 <script>
 
@@ -75,6 +76,11 @@ function check(){
 							$.get("opr.php?opr=mime&file=" + fileinfo[1],function(filetype){
 								audio.pause();
 								audio.currentTime = 0;
+								//Check if the file path is from external storage. If yes, append extDiskAccess into the path for web client access
+								if (fileinfo[1].includes("/media/") && !fileinfo[1].includes("extDiskAccess.php?file=")){
+								    fileinfo[1]  = "../SystemAOB/functions/extDiskAccess.php?file=" + fileinfo[1];
+								}
+								
 								//open the given filepath
 								if(filetype == "image"){
 									
@@ -84,7 +90,7 @@ function check(){
 									
 								}else if(filetype == "video"){
 									
-									$("body").html('<video autoplay loop id="video" style="height: 100%;display: block;margin-left: auto;margin-right: auto;width: 100%;"><source src="' + fileinfo[1] + '" type="video/mp4"></video><div class="ts snackbar"><div class="content"></div></div>');
+									$("body").html('<video autoplay loop id="video" style="height: 100%;display: block;margin-left: auto;margin-right: auto;width: 100%;"><source src="' + fileinfo[1] + '" type="video/mp4"></video><div class="ts snackbar"><div class="content"></div><a class="action"></a></div>');
 									video = document.querySelector('video');
 									var promise = video.play();
 
@@ -94,9 +100,12 @@ function check(){
 										video.muted = true;
 										video.play();
 										ts('.snackbar').snackbar({
-											content: 'Due to browser restricton, this video has been muted.',
-											action: '',
+											content: 'Due to browser policy, please click on unmute button.',
+											action: 'Unmute',
 											actionEmphasis: 'negative',
+											onAction: () => {
+												unmute();
+											}
 										});
 										
 									  });
@@ -116,22 +125,25 @@ function check(){
 									audio.src = fileinfo[1];
 									//audio.play();
 									
-									
 									var promise = audio.play();
+									
 									if (promise !== undefined) {
 									  promise.then(_ => {
 									  }).catch(error => {
-										//audio.muted = true;
-										//audio.play();
+										audio.muted = true;
+										audio.play();
 										ts('.snackbar').snackbar({
-											content: 'Due to browser restricton, audio can\'t stream to this device',
-											action: '',
+											content: 'Due to browser policy, please click on unmute button.',
+											action: 'Unmute',
 											actionEmphasis: 'negative',
+											onAction: () => {
+												unmute();
+											}
 										});
-										//alert("Error");
 									  });
 									}
 									
+									
 									currDisplay = "audio";
 									ao_module_setWindowSize(395,520);
 								}	
@@ -222,6 +234,15 @@ function check(){
 	});
 }
 
+var video=document.getElementById("video") ;   
+
+function unmute(){
+    if(video.muted){
+        video.muted = false;
+		video.volume = 0.5;
+    }
+}
+
 
 function loadScreen(){
 	$("body").html(`
@@ -251,7 +272,7 @@ function loadScreen(){
 		<a class="white active section dirModeOnly" href="../">Exit</a>
 	</div>
 </div>
-<div class="ts snackbar"><div class="content"></div></div>
+<div class="ts snackbar"><div class="content"></div><a class="action"></a></div>
 <div id="rid" style="display:none;"><?php echo $rid;?></div>
 `);
 }

+ 23 - 23
RemotePlay/manifest.json

@@ -1,23 +1,23 @@
-{
-  "name": "Remoteplay",
-  "short_name": "Remoteplay",
-  "description": "Remoteplay",
-  "scope": ".",
-  "start_url": "/AOB/RemotePlay/",
-  "display": "standalone",
-  "orientation": "portrait",
-  "theme_color": "#ffffff",
-  "background_color": "#ffffff",
-  "icons": [
-    {
-      "src": "img/android-chrome-192x192.png",
-      "sizes": "192x192",
-      "type": "image/png"
-    },
-    {
-      "src": "img/android-chrome-512x512.png",
-      "sizes": "512x512",
-      "type": "image/png"
-    }
-  ]
-}
+{
+  "name": "Remoteplay",
+  "short_name": "Remoteplay",
+  "description": "Remoteplay",
+  "scope": ".",
+  "start_url": "/AOB/RemotePlay/",
+  "display": "standalone",
+  "orientation": "portrait",
+  "theme_color": "#ffffff",
+  "background_color": "#ffffff",
+  "icons": [
+    {
+      "src": "img/android-chrome-192x192.png",
+      "sizes": "192x192",
+      "type": "image/png"
+    },
+    {
+      "src": "img/android-chrome-512x512.png",
+      "sizes": "512x512",
+      "type": "image/png"
+    }
+  ]
+}

+ 2 - 2
RemotePlay/mobileremote.php

@@ -44,8 +44,8 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
     <div class="row">
         <div class="sixteen wide column">
 			<p class="white">Target RemotePlay ID</p>
-				<div class="ts floating dropdown labeled icon button" style="padding: 0px;padding-right: calc(0.22em + 1em + .78571em * 2) !important;padding-left: 0em !important;background-color: black;color:white;height: 39.97px" width="100%">
-					<div class="text">
+				<div class="ts floating dropdown labeled icon button" style="padding: 0px;padding-right: calc(0.22em + 1em + .78571em * 2) !important;padding-left: 0em !important;background-color: black;color:white;height: 39.97px;width:100%">
+					<div class="text" style="width:100%">
 						<div class="ts fluid input" style="right 1px;bottom:1px">
 							<input type="text" style="border-top-right-radius: 0px;border-bottom-right-radius: 0px;background-color: black;color: white!important;border-color: white!important;border-right:0px" placeholder="RemotePlay ID" id="remoteID_tb">
 						</div>

+ 8 - 2
RemotePlay/opr.php

@@ -9,8 +9,14 @@ if (isset($_GET['opr'])){
 		echo json_encode($output);
 		
 	}else if($_GET["opr"] == "mime"){
-		
-		echo explode("/",mime_content_type($_GET["file"]))[0];
+		$file = $_GET["file"];
+		if (!file_exists($_GET["file"])){
+			//Check if it is a path with extDiskAccess.php
+			if (strpos($_GET["file"],"extDiskAccess.php?file=") !== false){
+				$file = array_pop(explode("=",$_GET['file']));
+			}
+		}
+		echo explode("/",mime_content_type($file))[0];
 		
 	}else{
 		

+ 2 - 2
RemotePlay/remote.php

@@ -40,8 +40,8 @@ if (isset($_GET['comm']) && isset($_GET['rid'])){
     <div class="sub white header">Control your remote player here!</div>
 </div>
 	<p class="white">Target RemotePlay ID</p>
-	<div class="ts floating dropdown labeled icon button" style="padding: 0px;padding-right: calc(0.22em + 1em + .78571em * 2) !important;padding-left: 0em !important;background-color: black;color:white;height: 39.97px" width="100%">
-		<div class="text">
+	<div class="ts floating dropdown labeled icon button" style="padding: 0px;padding-right: calc(0.22em + 1em + .78571em * 2) !important;padding-left: 0em !important;background-color: black;color:white;height: 39.97px;width:100%">
+		<div class="text" style="width:100%">
 			<div class="ts fluid input" style="right 1px;bottom:1px">
 				<input type="text" style="border-top-right-radius: 0px;border-bottom-right-radius: 0px;background-color: black;color: white!important;border-color: white!important;border-right:0px" placeholder="RemotePlay ID" id="remoteID_tb">
 			</div>