bug: Video Playback not working on Safari
Created by: vel
💡 Summary
(I don't know if this affects S3 storage as well) Starting playback of any video hosted in /files does not work in Safari or any browser on iOS/iPadOS. This also affects Safari on macOS. Safari requires Byte-Range support for video playback, see the Safari Web Content Guide. Setting some headers is not enough, since Safari actually first sends a request for bytes 0-1 and then checks the response.
Here is another writeup of this behaviour, although there are many others.
I've been able to deploy a workaround on my server by using varnish for /files with this configuration:
vcl 4.0;
backend default {
.host = "sharkey-web";
.port = "3000";
}
sub vcl_recv {
# Forward requests to the backend
set req.backend_hint = default;
# Unset the cookie sent by the client, otherwise cache will be bypassed
unset req.http.Cookie;
}
sub vcl_backend_response {
# Allow caching of the complete object
set beresp.do_stream = true;
}
This has been fixed in Firefish a few months ago as well.
🥰 Expected Behavior
Sharkey should respond with 206 Partial-Content to a range request for a video file.
🤬 Actual Behavior
Sharkey responds with 200 and sends the whole file.
📝 Steps to Reproduce
- Open a note or a /file URL with a video directly in Safari (macOS/iOS/iPadOS, maybe others?)
💻 Frontend Environment
* Model and OS of the device(s): iPhone 15, iOS 17.2.1
* Browser: Safari / AppleWebKit 605.1.15
* Server URL: gib.schmus.is (I've deployed the workaround described above on this server, please use another to replicate the bug)
* Sharkey: 2023.12.0
🛰 Backend Environment (for server admin)
* Installation Method or Hosting Service: docker compose
* Sharkey: 2023.12.0
* Node: 21.4.0-alpine3.18
* PostgreSQL: 15-alpine
* Redis: 7-alpine
* OS and Architecture: Ubuntu 22.04.3 LTS
* Webserver: Linuxserver.io SWAG (nginx) reverse proxy
(Now also using varnish as a workaround)
Do you want to address this bug yourself?
- Yes, I will patch the bug myself and send a pull request