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

Play gifs #1805

Closed
skjnldsv opened this issue May 10, 2019 · 21 comments · Fixed by #4472
Closed

Play gifs #1805

skjnldsv opened this issue May 10, 2019 · 21 comments · Fixed by #4472
Assignees
Labels
1. to develop enhancement feature: chat 💬 Chat and system messages feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings

Comments

@skjnldsv
Copy link
Member

skjnldsv commented May 10, 2019

When I use my reaction gifs, they stay still, defeating the purpose of my dank memes collection! 😁

Capture d’écran_2019-05-10_12-13-57

giphy

@nickvergessen
Copy link
Member

Hello Private Gump,

unluckily this is due to the fact that the server does not offer gif previews. And we use previews to prevent size troubles.

So I would either move this to the server, or someone tells me how we can savely detect the size and use the original file then instead.

yours
Lieutenant Dan

@tobiasKaminsky
Copy link
Member

Having gif preiew would also be nice for Android, as this is also requested there.

@skjnldsv
Copy link
Member Author

In the viewer if a file is a gif, we just don't use the preview but fetch the dav url directly. :)
Though, can't you access a file size from the shared file? I have no idea how the share backend works on chat rooms 🤔

@nickvergessen
Copy link
Member

Let's involve the preview expert @rullzer

@tobiasKaminsky
Copy link
Member

In the viewer if a file is a gif, we just don't use the preview but fetch the dav url directly. :)

Gif files can be quite large, having this fetched (at least on mobile) is something I do not want (e.g. Talk on mobile or files app).
For desktop/web ui this might be an option…

@rullzer
Copy link
Member

rullzer commented May 11, 2019

So for me it is still not clear what a gif preview would do. Because we can't just take every 100th frame. etc.
That is why it right now is just the still image.

Fetching the whole file is the only way I really see for animated gifs...

@skjnldsv
Copy link
Member Author

@tobiasKaminsky @rullzer imgur started converting gifs to video if they were over 1.5MB (or something). This allowed them to serve lots of data without disturbing the user experience :)

We could have a preview provider for that?

@nickvergessen
Copy link
Member

Could also have the preview with a play icon on top and if you click it we play the full thing?

@skjnldsv
Copy link
Member Author

Could also have the preview with a play icon on top and if you click it we play the full thing?

Could be nice, if a file is over xxxMB, I feel like we should not completely rule out autoplay 😁

@jospoortvliet
Copy link
Member

While encoding them to mp4 is probably gonna save a LOT of space (gifs are insanely inefficient) we don't preview videos either... a play button is probably best, and maybe (later?) auto-play when scrolling into view and pausing the scroll (like 'others' do, like twitter).

@tromlet
Copy link

tromlet commented Aug 11, 2020

Fetching the whole file is the only way I really see for animated gifs...

Couldn't you just do that, and then have a cron job that "cleans up" old gifs in talk by replacing them with just a still after, like, a month or something?

EDIT: By the way I guess I'm just commenting to bitch about features that are missing, but you guys are unbelievable rockstars. The amount of value you guys have made for people with Nextcloud is next-!@#$ing-level - mad props all around, I want to buy y'all AT LEAST some beers.

@PVince81
Copy link
Member

PVince81 commented Oct 26, 2020

As far as I can see if you enable the preview provider \OC\Preview\Movie, you can see a preview picture in the chat for a video. You still need to click it to get a lightbox with a player that automatically starts. For regular videos like mp4 I think this is enough interaction. However we could add a play button on top to make it clearer that it's a video and not a picture (could raise another ticket if we agree).
The "Movie" provider uses ffmpeg/avconv in the back to extract a picture at either 5s, 1s, or 0s (whichever worked first).

For the short term (quickfix), I propose to do the following in the Talk app:

  • add a setting in talk (config.php) for a maximum size at which a GIF is loaded in full, defaulting to 1.5MB
  • if file mime type is GIF and size is < X, render the GIF as is using the DAV URL
  • if file mime type is GIF and size is >= X, use the preview URL instead
  • if the config value is set to 0 or null, always use the preview URL
  • look into better cropping / size to make the GIF fully visible
  • raise ticket to implement a new preview provider for GIF that will convert to video. For this, the code from the "Movie" provider could be used as inspiration and modified to output a video file into the preview folders (which I'm unsure when their are cleant up, to be discussed there) => let's reuse Video streaming is sometimes slow: store transcoded videos and stream them? server#21633

Edit: added cropping

@skjnldsv
Copy link
Member Author

Also, improve the inline flow of gifs a bit, no cropping, looks more like an inline message than an attachement? :)

@PVince81
Copy link
Member

For detecting the file size:
OC.Files.getClient().getFileInfo('/Talk/VID_20200929_085746.mp4', {properties:["{DAV:}getcontentlength"]}).then((status, info) => console.log(info.size)) worked for me

Or do a HEAD call on the read file and read the Content-Length property.

@PVince81
Copy link
Member

Also, improve the inline flow of gifs a bit, no cropping, looks more like an inline message than an attachement? :)

This seems to be a general issue, also with other pictures.
As far as I can see the pictures are always in individual messages even when uploaded in bulk, so we should allow more horizontal expansion. Need to find back why the decision for square cropping was made to see if it's still valid.

@skjnldsv
Copy link
Member Author

skjnldsv commented Oct 26, 2020

OC.Files.getClient().getFileInfo('/Talk/VID_20200929_085746.mp4', {properties:["{DAV:}getcontentlength"]}).then((status, info) => console.log(info.size)) worked for me

You should already have this in the message I think.
Additional requests doesn't seems to be efficient.
Also, please do not rely on OC.Files.getClient as this will be nuked as soon as we can :)

@PVince81 PVince81 self-assigned this Oct 26, 2020
@skjnldsv
Copy link
Member Author

You should already have this in the message I think.

Apparently not, but you have data already, would need a slight api change I guess

image

@PVince81
Copy link
Member

I've implemented the cropping/ratio fix separately, see #4469

@PVince81
Copy link
Member

@PVince81
Copy link
Member

PR here that brings rendering of GIFs: #4471

@PVince81
Copy link
Member

For the server bit, I found this ticket about transcoding videos to another format in order to be able to play them in the browser: nextcloud/server#21633

The animated GIF thing would simply be an additional format that could be converted to a browser-compatible video format for playback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop enhancement feature: chat 💬 Chat and system messages feature: upload & shares & voice 📤🎙️ Sharing files into a chat and audio recordings
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants