0

I'm creating a SPA developed in Angular2 with a backend server developed in Laravel.

Angular2 app plays video files stored in different cloud providers (Google drive, SMB server, Dropbox, OneDrive,...) but those providers are handled by Laravel API.

This is the application architecture:enter image description here

Is there a way to serve a file stored in those providers without download the file in the Laravel server first?

Any help would be appreciated.

Thanks.

EDIT

Files are not publicly accessible. Authentication set up and working in Laravel backend.

Victor Escobar
  • 514
  • 1
  • 6
  • 15

2 Answers2

0

I presume by "download", you want to avoid the delay while the entire file is fetched before the user sees the first video frames. The only approach I can think of is to chunk the downloads using standard http chunking between Laravel and Drive, and then echo that in the http session between your Angular app and Laravel. NB I haven't tested this, but I believe chunking is supported by Drive.

pinoyyid
  • 21,499
  • 14
  • 64
  • 115
0

In general case a kind of proxy is unavoidable. You can pipe streams from the cloud to the stdout e.g. Stream FTP download to output or similar.

If a cloud support presigned urls, e.g. s3 http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html you can benefit from web server redirects, like X-Accel-Redirect in nginx https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/.

Community
  • 1
  • 1
Alex Blex
  • 34,704
  • 7
  • 48
  • 75