Byte-Range Support

I’m serving audio for a podcast using Active Storage’s proxy feature with AWS’s S3. But the audio on iOS devices aren’t playing because Apple appears to (sometimes?) require byte range support.

Here’s a related issue, but I think the best solution would be to bake the support into Active Storage.

I found an example implementation of supporting it (that might be a bit old) on stack overflow:

I’d definitely be willing to create a PR but I wanted to start a discussion here to see if it’d be a welcomed addition. Let me know if I’m missing anything, or if there’s an easier way to add this support to my app.

For reference, here’s the related code: rails/proxy_controller.rb at master · rails/rails · GitHub

And in my case uses this: rails/s3_service.rb at 72d30056a429f243c0454a94167229e4d03c7b3e · rails/rails · GitHub

1 Like

Although I did not get to it yet, we are definitely looking forward to serve audio files using ActiveStorage in a secure and performant manner, also to iOS devices (here is another PR waiting on the topic). As Rails 6.2 development has started not long ago maybe now could be a good time to submit a PR.

1 Like

I went ahead and created a small branch where I think I have it working. I’m going to play around with it in a test application next.

If anyone has any feedback on it, let me know.

1 Like