1
Fork 0
mirror of https://github.com/diced/zipline.git synced 2025-04-11 23:31:17 -05:00

fix: audio & video scrubbing (#576)

* fix video scrubbing

* fix scrubbing for audio as well
This commit is contained in:
astrid 2024-07-19 21:40:52 +02:00 committed by GitHub
parent 974e9f7fa2
commit 317c7365f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -21,6 +21,11 @@ function dbFileDecorator(fastify: FastifyInstance, _, done) {
this.header('Content-Length', size);
this.header('Content-Type', download ? 'application/octet-stream' : file.mimetype);
this.header('Content-Disposition', `inline; filename="${encodeURI(file.originalName || file.name)}"`);
if (file.mimetype.startsWith('video/') || file.mimetype.startsWith('audio/')) {
this.header('Accept-Ranges', 'bytes');
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
this.header('Content-Range', `bytes 0-${size - 1}/${size}`);
}
return this.send(data);
}