Skip to content
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

MSC2530: Body field as media caption #2530

Merged
merged 11 commits into from
Feb 19, 2024
43 changes: 43 additions & 0 deletions proposals/2530-body-as-caption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Body field as media caption

This is an alternative to [MSC2529](https://github.com/matrix-org/matrix-doc/pull/2529).

## Proposal
tulir marked this conversation as resolved.
Show resolved Hide resolved

This proposal defines a new field `filename` and allows the `format` and
`formatted_body` fields (from `m.text`) for all media msgtypes (`m.image`,
`m.audio`, `m.video`, `m.file`).

If the `filename` field is present in a media message, clients should treat
`body` as a caption instead of a file name. The `formatted_body` field should
tulir marked this conversation as resolved.
Show resolved Hide resolved
also be supported and work the same way as they do in `m.text` messages.

## Comparison to MSC2529

While this approach isn't backwards-compatible like MSC2529, it's simpler to
implement as it doesn't require handling relations.

Implementing relation-based captions would be especially difficult for bridges.
It would require either waiting a predefined amount of time for the caption to
come through, or editing the message on the target platform (if edits are
supported).

Additionally, some clients already render the body (as a file name), so the
new-style caption would already be visible in those cases.

The format proposed by MSC2529 would also make it technically possible to use
other message types without changing the format of the events, which is not
possible with this proposal.

## Potential issues

The spec for `m.file` already defines a `filename` field, but the spec also
says `body` should contain the file name. This means old `m.file` messages
could be misinterpreted to contain a caption, even though it's just the file
name. To avoid this problem, we could require that `body` and `filename` must
be different for `body` to be interpreted as a caption.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thing to note here is that body is required, so the filename is probably a reasonable fallback for body in the event that no description is given.


Like MSC2529, this would be obsoleted by [extensible events](https://github.com/matrix-org/matrix-doc/pull/1767).
In my opinion, unless extensible events are planned to be pushed through in the
near future, we shouldn't block basic features like captions on extensible
events hopefully eventually happening.