Skip to content

Commit

Permalink
Add blurhash MSC
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Feb 27, 2020
1 parent 0ce8e5a commit 9466acc
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
Binary file added proposals/images/2445-blurhash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added proposals/images/2445-current-state.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added proposals/images/2445-loaded-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
54 changes: 54 additions & 0 deletions proposals/xxxx-blurhash-for-media.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# MSC2445: Using BlurHash in Media Events

[BlurHash](https://blurha.sh) is a compact representation of a placeholder
for an image (or the frame of a video). Currently in Matrix, clients must
display a placeholder image in the message timeline while a piece of media is
loading. Some clients, such as Riot, simply display an empty space.

While thumbnails exist to combat this to some degree, they still need to be
downloaded from a homeserver, which is not instantaneous.

Instead, a blurhash can be sent inside the `m.room.message` event, which upon
receipt other clients can render for a pretty preview while the actual
thumbnail downloads.

## Proposal

A new field is added in `m.room.message`'s `content` called `blurhash`. It
is a BlurHash of the original piece of media. Clients could then render this
using [one of the available BlurHash
implementations](https://github.com/woltapp/blurhash).

This would be displayed while the thumbnail of the media is loaded in parallel.

This is beneficial as it's an extremely efficient way to give someone a quick
idea of what a piece of media contains before any requests are made to a
media repository.

To be clear: This does not replace thumbnails - it will be shown before they
are downloaded.

## Visualisation

Viewing an image message that is loading:

![blurhashed preview](images/2445-blurhash.png)

Once the image loads:

![the image has loaded](images/2445-loaded-image.png)

For reference, the current state of things in Riot is:

![boo, sad](images/2445-current-state.png)

## Alternatives

We could include a base64 thumbnail of the image in the event, but blurhash
produces much more efficient textual representations.

## Backwards compatibility

Older clients would ignore the new `blurhash` parameter.

Newer clients would only show it if it exists.

0 comments on commit 9466acc

Please sign in to comment.