Support for HTTP range requests (for FileResponse)
See original GitHub issueI’m trying to embed an mp4 file on a page using the following HTML:
<video controls width="600">
<source src="/media/video.mp4" type="video/mp4">
</video>
The video file is being served by a Starlette FileResponse
.
I’m getting this error in Safari:
It looks to me like Safari is trying to make an HTTP range request in order to stream the video - but Starlette doesn’t support that option.
I tried adding accept-ranges: none
as a response header but that didn’t seem to fix the problem.
So… it would be great if Starlette could handle range requests so you could use it to serve video files to Safari!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:8
- Comments:21 (14 by maintainers)
Top Results From Across the Web
HTTP range requests - MDN Web Docs - Mozilla
Range requests are useful for clients like media players that support random access, data tools that know they need only part of a...
Read more >Configure Nginx and Django for Byte Range Request
I am building a web API using Django and Nginx that needs to support Byte-Range requests. Currently, when making a request such as:...
Read more >http headers (content-range) wrong for static audio files ...
Hello! I hope I find you well. I'm having a bit of difficulty configuring my Django site to serve audio correctly.
Read more >Server Reference — aiohttp 3.8.3 documentation
Originating IP address of a client initiated HTTP request. ... Read-only property that returns information about Range HTTP header.
Read more >Custom Response - HTML, Stream, File, others - FastAPI
In this case, the HTTP header Content-Type will be set to application/json . And it will be documented as such in OpenAPI. Tip....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’d be disappointed to see this not land in Starlette. I’d understand if it required additional dependencies and a complex implementation, but I feel like the implementation in #1013 is small enough and clean enough that it shouldn’t add undue complexity to the project.
And supporting range requests has a whole bunch of applications beyond just getting the HTML
<video>
tag to work properly:curl -C
andwget --continue
- or the download UI in browsers like Chrome and FirefoxI think Starlette could consider adding this feature. It is not complicated and requires little extra maintenance cost.