-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSC2705: Animated thumbnails for media #2705
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
29e1f99
Proposal to support animated thumbnails
turt2live 1506eb8
add implementation note
turt2live 3a59367
Apply suggestions from code review
turt2live c07158d
Clean up the MSC
turt2live c18ef41
Appease the keepers of mimetypes
turt2live File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# MSC2705: Animated thumbnails | ||
|
||
Users may already upload animated media to the media repository, such as gifs, webp images, and videos. | ||
When this media is used in an event or avatar, many clients are stuck with a static thumbnail until | ||
the user clicks on it to get the full, unedited, file. Some clients however would prefer to show an | ||
animated thumbnail in certain conditions, like when the user is hovering over the message or avatar. | ||
|
||
This proposal introduces a new query parameter to the [`GET /_matrix/media/v3/thumbnail`](https://spec.matrix.org/v1.9/client-server-api/#get_matrixmediav3thumbnailservernamemediaid) | ||
endpoint, allowing clients to specifically request an animated thumbnail. | ||
|
||
## Proposal | ||
|
||
A new query parameter, `animated`, is added to the `/thumbnail` endpoint. It has the following behaviour: | ||
|
||
* When `true`: the server SHOULD return an animated thumbnail if possible/supported. | ||
* When `false`: the server MUST NOT return an animated thumbnail. | ||
* When not provided: the server SHOULD NOT return an animated thumbnail. | ||
|
||
The default case is a relaxed version of the `false` behaviour to allow server owners to customize the | ||
default behaviour when their users' clients do not support requesting animated thumbnails. | ||
|
||
Clients SHOULD respect a user's preference to [reduce motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) | ||
and request non-animated thumbnails in these cases. | ||
|
||
The content types which are able to be animated is left as an implementation detail. The following | ||
SHOULD be supported at a minimum, however: | ||
|
||
* `image/gif` | ||
* `image/png` or `image/apng` ("APNG" format) | ||
* `image/webp` | ||
|
||
The returned content type for an animated thumbnail is additionally left as an implementation detail, | ||
though servers SHOULD use `image/webp` whenever possible. | ||
|
||
When media cannot be animated, such as a PDF or JPEG, the server should return a thumbnail as though | ||
`animated` was `false`. | ||
|
||
## Alternatives | ||
|
||
No significant alternatives. | ||
|
||
## Security considerations | ||
|
||
Server load could increase when the server tries to thumbnail a large file. Servers are expected to | ||
mitigate this on their own by providing an option to disable the feature or limiting how/when | ||
they will animate the media. | ||
|
||
## Unstable prefix | ||
|
||
While this proposal is not considered stable, `animated` is specified as `org.matrix.msc2705.animated` | ||
on requests. No unstable endpoints are required due to backwards compatibility being built-in to the | ||
proposal. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personally, I'd just leave the content type completely up to the implementation, but [shrug]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, #4011 improves this significantly.