|
| 1 | +# MSC2705: Animated thumbnails |
| 2 | + |
| 3 | +Users may already upload animated media to the media repository, such as gifs, webp images, and videos. |
| 4 | +When this media is used in an event or avatar, many clients are stuck with a static thumbnail until |
| 5 | +the user clicks on it to get the full, unedited, file. Some clients however would prefer to show an |
| 6 | +animated thumbnail in certain conditions, like when the user is hovering over the message or avatar. |
| 7 | + |
| 8 | +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) |
| 9 | +endpoint, allowing clients to specifically request an animated thumbnail. |
| 10 | + |
| 11 | +## Proposal |
| 12 | + |
| 13 | +A new query parameter, `animated`, is added to the `/thumbnail` endpoint. It has the following behaviour: |
| 14 | + |
| 15 | +* When `true`: the server SHOULD return an animated thumbnail if possible/supported. |
| 16 | +* When `false`: the server MUST NOT return an animated thumbnail. |
| 17 | +* When not provided: the server SHOULD NOT return an animated thumbnail. |
| 18 | + |
| 19 | +The default case is a relaxed version of the `false` behaviour to allow server owners to customize the |
| 20 | +default behaviour when their users' clients do not support requesting animated thumbnails. |
| 21 | + |
| 22 | +Clients SHOULD respect a user's preference to [reduce motion](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion) |
| 23 | +and request non-animated thumbnails in these cases. |
| 24 | + |
| 25 | +The content types which are able to be animated is left as an implementation detail. The following |
| 26 | +SHOULD be supported at a minimum, however: |
| 27 | + |
| 28 | +* `image/gif` |
| 29 | +* `image/png` or `image/apng` ("APNG" format) |
| 30 | +* `image/webp` |
| 31 | + |
| 32 | +The returned content type for an animated thumbnail is additionally left as an implementation detail, |
| 33 | +though servers SHOULD use `image/webp` whenever possible. |
| 34 | + |
| 35 | +When media cannot be animated, such as a PDF or JPEG, the server should return a thumbnail as though |
| 36 | +`animated` was `false`. |
| 37 | + |
| 38 | +## Alternatives |
| 39 | + |
| 40 | +No significant alternatives. |
| 41 | + |
| 42 | +## Security considerations |
| 43 | + |
| 44 | +Server load could increase when the server tries to thumbnail a large file. Servers are expected to |
| 45 | +mitigate this on their own by providing an option to disable the feature or limiting how/when |
| 46 | +they will animate the media. |
| 47 | + |
| 48 | +## Unstable prefix |
| 49 | + |
| 50 | +While this proposal is not considered stable, `animated` is specified as `org.matrix.msc2705.animated` |
| 51 | +on requests. No unstable endpoints are required due to backwards compatibility being built-in to the |
| 52 | +proposal. |
0 commit comments