1

I am working on an application where some videos are uploaded to Amazon S3. Now a user can choose to download the video or stream it. The public url on amazon s3 is say "amazons3.com/test/file.mp4". As of now, everytime I visit the url, it streams the video. How to I append parameters to the url so that the video can be streamed or dowloaded.

Basically, original url should stream the video, and modified_url should download it.

Thank you!

Manas Paldhe
  • 766
  • 1
  • 10
  • 32
  • 1
    You will need to store the file with a content disposition header. That will force the browser to treat the file as a download. For streaming, you may want to look at a streaming distribution with cloudfront. – datasage Dec 23 '15 at 07:24
  • But in that case the file will always be downloaded. It will not stream, right? – Manas Paldhe Dec 23 '15 at 18:36
  • Correct, if accessed directly, if loaded into a video player it should not force a download and will do http streaming. If you want real streaming, you need to look at cloudfront streaming distribution. – datasage Dec 25 '15 at 20:25

1 Answers1

0

I found a very easy way. In the html file, instead of

<a href="some.s3.url" class="download">Download</a>

I used

<a href="some.s3.url" download="some.s3.url" class="download">Download</a>

Reference: href image link download on click

Community
  • 1
  • 1
Manas Paldhe
  • 766
  • 1
  • 10
  • 32