jalik / meteor-jalik-ufs

Upload File System for Meteor **DISCONTINUED**
MIT License
100 stars 29 forks source link

audio element not work on safari, Accept-ranges not include in response #142

Open laobento opened 4 years ago

laobento commented 4 years ago

I am using HTML5 Audio element in my work and it works on ie, Firefox, chrome, but not on safari. I guess maybe the server's response does not include Accept-ranges field.

laobento commented 4 years ago

Anyone else meet this problem?

jalik commented 4 years ago

Hello @laobento. As I see you seems to be competent enough to dig into the problem. What you're looking for may be in the code below: https://github.com/jalik/meteor-jalik-ufs/blob/master/ufs-server.js#L284-L328

Support for this kind of HTTP request was asked and added by another contributor, I helped him but I am afraid I don't have time anymore, I would accept any working PR though.

jalik commented 4 years ago

Not sure if it's related, but looks like a clue: https://philna.sh/blog/2018/10/23/service-workers-beware-safaris-range-request/

laobento commented 4 years ago

@jalik Let me have a look, thank you!

laobento commented 4 years ago

@jalik I capture the packet and found that the content not ok in the response with content-range. The first response should send a content of length 2, but it only has 1 byte of data. I guess the code 'store.getReadStream(fileId, file, options);' has something wrong, and finally I tried to modify the code in ufs-gridfs.s, the code is : this.getReadStream = function (fileId, file, options) { options = _.extend({}, options); return mongoStore.openDownloadStream(fileId, { start: options.start, end: options.end+1 //I modified this line, }); };

it works!

laobento commented 4 years ago

I am not sure is it the right way, because I am a newer to WEB, JS, METEOR..., I was a C/C++ programmer before.