File tree Expand file tree Collapse file tree
airpsx/service/filesystem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ import airpsx.service.pkg.InstallPackageService;
5757import airpsx .command .ServePackageCommand ;
5858import airpsx .command .KillServePackageCommand ;
5959import uuid .Uuid ;
60+ import airpsx .service .filesystem .FileSystemStreamService ;
6061using hx .well .tools .RouteElementTools ;
6162
6263class Boot extends BaseBoot {
@@ -188,6 +189,10 @@ class Boot extends BaseBoot {
188189 .handler (new FileSystemUploadService ())
189190 .setStream (true )
190191 .where (" path" , " .*" );
192+
193+ Route .get (" /stream/{path}" )
194+ .handler (new FileSystemStreamService ())
195+ .where (" path" , " .*" );
191196 });
192197
193198 #if orbis
Original file line number Diff line number Diff line change 1+ package airpsx .service .filesystem ;
2+ import hx .well .http .Request ;
3+ class FileSystemStreamService extends AbstractHttpFileStreamService {
4+ public function filePath (request : Request ): String {
5+ return request .route (" path" );
6+ }
7+
8+ public function bufferSize (): Int {
9+ return 1024 * 10 ;
10+ }
11+
12+ public function contentType (request : Request ): String {
13+ var extension = request .path .substring (request .path .lastIndexOf (" ." ));
14+ switch (extension ) {
15+ case " .mp4" :
16+ return " video/mp4" ;
17+ case " .webm" :
18+ return " video/webm" ;
19+ default :
20+ return ' ${extension } undefined' ;
21+ }
22+ }
23+
24+ public function isDownloadRequest (request : Request ): Bool {
25+ return false ;
26+ }
27+
28+ public function basePath (): Null <String > {
29+ return null ;
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments