Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

better telegram gif/sticker handling #6642

Closed
wants to merge 1 commit into from

Conversation

Bubu
Copy link

@Bubu Bubu commented Aug 19, 2021

Respects tg bridge info fields to loop and hide the video player
controls. If autoplay is disabled it plays on hover instead.

Flags can be seen i.e. here: mautrix/telegram@64107fa


Here's what your changelog entry will look like:

✨ Features

  • better telegram gif/sticker handling (#6642). Contributed by Bubu.

@Bubu Bubu requested a review from a team as a code owner August 19, 2021 14:26
@SimonBrandner SimonBrandner added the T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements label Aug 19, 2021
Respects tg bridge info fields to loop and hide the video player
controls. If autoplay is disabled it plays on hover instead.

Signed-off-by: Marcus Hoffmann <[email protected]>
@Bubu Bubu force-pushed the video_looping_controls branch from 47a845d to 0ffd6d0 Compare August 19, 2021 14:49
Comment on lines +243 to +244
let loop = false;
let controls = true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
let loop = false;
let controls = true;
const loop = content.info["fi.mau.loop"];
const controls = !content.info["fi.mau.hide_controls"];

Or similar feels more readable.

Also, could you please add some comment explaining why is this necessary?

Comment on lines +278 to +283
onMouseOver={!autoplay && !controls ? event => (event.target as HTMLVideoElement).play() : () => { }}
onMouseOut={!autoplay && !controls ?
event => {
(event.target as HTMLVideoElement).pause();
(event.target as HTMLVideoElement).currentTime = 0;
} : () => { }}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this would be easier to read if these were separate methods somewhere above

@Bubu
Copy link
Author

Bubu commented Aug 19, 2021

All valid points, I can add more explanation as well 👍

@turt2live
Copy link
Member

Why is the Telegram bridge sending videos as stickers :( It should be sending sticker events.

@Bubu
Copy link
Author

Bubu commented Aug 19, 2021

I think sticker events can only contain images atm?

@turt2live
Copy link
Member

They indeed only handle images at the moment, but the whole point of Matrix is that things are extensible and backwards compatible with each other. A sticker would have an image fallback (which may very well be a still image for performance reasons), but also metadata to indicate that it can be rendered as a looped video.

Extensible Events in particular would help with this, but it's not necessarily needed here.

Copy link
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

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

Clearing review request. We should support looping video stickers off of stickers, not video events.

@Bubu
Copy link
Author

Bubu commented Aug 19, 2021

Clearing review request. We should support looping video stickers off of stickers, not video events.

For stickers, maybe. Telegram also sends "gifs" as videos (they are just mp4s in the telegram world because gifs suck).Those should behave like "real" gifs for the user I think.

I won't have time to implement animated sticker events, so closing.

@Bubu Bubu closed this Aug 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Enhancement New features, changes in functionality, performance boosts, user-facing improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants