GET request for mp3 in an S3 bucket without downloading a file with 206 partial content?

I have an mp3 file in an S3 bucket. I am extracting this file through ajax GET request to play html5 sound. With interruptions, the receive request will not be able to download the file, and thus the track will not play. The request returns "206 partial content". Oddly enough, it will work several times before the failure, and then continue the failure.

If I disable caching in my browser (chrome), the file will load and play accordingly.

Did I configure s3 incorrectly? How can I get this mp3 file to download and play sequentially?

the specific file is here: https://s3.amazonaws.com/1m40s_dev/assets/music/walden.mp3

thanks!

+4
source share
4 answers

I solved this by adding a timestamp at the end of the mp3 url to load the page. This forced a new load of content each time and fixed a cache error.

This seems more like a job than a fix. I still don’t know the root cause of the problem, but if you have a similar problem, and you just need to move on, add a timestamp or random number as a parameter at the end of the URL

.../assets/music/walden.mp3?[timestamp] 
0
source

I found that this often refers to the MIME type installed in the hosted S3 file. Setting the correct MIME type seems to fix the situation.

On the side of the note, I struggled with one binary always breaking in IE. His MIME type was application / octet stream. I changed MIME to binary / octet stream and it seems to fix downloads from IE. I do not know why.

+2
source

use amazon cloud area solve the problem

+1
source

Another workaround I found is if you use rails, turning off turbolinks makes it go to chrome. I will add more to my answer when I learn more.

0
source

Source: https://habr.com/ru/post/1382565/


All Articles