datasette-media icon indicating copy to clipboard operation
datasette-media copied to clipboard

Serve mp4 video that can be viewed in a browser

Open simonw opened this issue 4 years ago • 1 comments

I ran into problems serving mp4 files such that they could be embedded in an HTML <video> element:

<video controls width="600">
    <source src="/media/video.mp4" type="video/mp4">
</video>

I think this is due to to a lack of support for HTTP range requests. I filed a bug with Starlette here: https://github.com/encode/starlette/issues/950

simonw avatar May 17 '20 20:05 simonw

It looks like Quart may be the only current ASGI Python library with support for range requests: https://github.com/pgjones/quart/blob/49a70ed62ad1035dbdf884393dd6c70893484b14/src/quart/wrappers/response.py#L145-L210

I think Falcon has support in its upcoming version 3.0 but that hasn't been released yet (previous versions of Falcon are just WSGI - 3.0 will introduce ASGI as well): https://github.com/falconry/falcon/blob/8db254e16f343e91639bbf85f789d6f0a7cccc35/falcon/request.py#L346-L359

simonw avatar May 17 '20 20:05 simonw