-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Media handler does not support HTTP range requests #4780
Comments
I had issues with my WebKit based web browsers (mainly Gnome's Epiphany) that GStreamer failed to play any videos because Synapse returns HTTP response 200 (OK) when the client performs Range request (the return code should be 206 if Range functionality is supported):
But for now, as a workaround I configured my Apache (which acts as a frontend / reverse proxy in the front of the actual Synapse instance) to interrupt the media downloads, and by using mod_rewrite it serves the static media files directly from /var/lib/matrix-synapse/media/local_content directory (so those queries won't reach Synapse at all and Apache handles the Range requests properly). (Please note that this is just PoC and needs to be modified if used with Nginx e.g.):
With that configuration applied I'm able to play videos in Epiphany and the seeking is working properly too. Please note that this most probably breaks the correct mime type reported by the Apache, because the files under local_content directory do not have any extension. So the mime type will be always some generic, like application/octet-stream. This could be an issue if you embed the Synapse download URLs somewhere, but my web based Element, macOS Electron Element or Android Element app work just fine: I'm able to watch and download video and photos files. |
Ive re-tried adding this, following the code in #2909 somewhat. However, unfortunately, synapse's architecture has become drastically more complicated since 2018, now all calls go to
The This basically delegates the "oh, select the bytes" bit to the media repo. Changing this to "oh, respond with only this range of bytes" would require a breakage in the media repo API, which might be a tad difficult at the moment. Some hacks could be implemented where it seeks the first X bytes and then only writes the next Y bytes, discarding the rest, but ultimately that's an ugly hack. |
Alright everyone, I've implemented this into nginx following @wapsi's post. It should emulate the native Synapse media server and supports MIME types (Content-Type) and filenames (Content-Disposition) via fetching them from the database. https://gist.github.com/Cyberes/4ee247bf78b38aa1073bc5b58c5afdd9 It needs Lua so just use OpenResty. Don't forget to do |
FWIW, an MSC exists to try to mandate this on media endpoints: matrix-org/matrix-spec-proposals#3469 |
Presently, Synapse does not support HTTP range requests, which prevents users from seeking through audio/video media in many browsers. element-hq/element-web#2909 sought to fix this, though as that PR has been closed, I figured I should open another issue. This issue is the root cause of matrix-org/riot-web#4265.
The text was updated successfully, but these errors were encountered: