nextcloud / talk-ios

📱😀 Video & audio calls through Nextcloud on iOS
GNU General Public License v3.0
145 stars 83 forks source link

Default to send compressed media + allow to send uncompressed media #890

Open e-caste opened 1 year ago

e-caste commented 1 year ago

Is your feature request related to a problem? Please describe. Describe the solution you'd like

Stemming from this comment and my reply to it.
It would be a better UX (faster uploads/downloads) if, instead of the current workflow:

  1. sending the full media file (photo/video) to the server
  2. waiting for the server to generate its thumbnail
  3. receiving the thumbnail
  4. tapping the media file to fully download it

the workflow would be as such:

  1. locally compress the media file
  2. send it to the server
  3. receive it from the server, opening it does not trigger an additional download

My reason for this issue is mainly that the current workflow to send and receive media with Nextcloud Talk iOS is a bit clunky, and sometimes it outright doesn't work if the network conditions aren't good enough (e.g. out hiking), while other apps (the usual names, Whatsapp, Telegram, iMessage, etc.) work in the same conditions.

Downloading the full compressed media file instead of its thumbnail would also allow to present it in a bigger and clearer fashion in the chat (see https://github.com/nextcloud/talk-ios/issues/776).

Of course, Nextcloud is first and foremost a cloud service to host files as the name says, so it would be nice if compressing a media file was the default but the user was still offered the option to send the full fat uncompressed file to preserve quality. For example Telegram solves this issue by giving a button to "Send as file" in the selection view.

Describe alternatives you've considered Nothing, just sending the uncompressed file which takes a long time (sometimes too long).

Additional context Other apps are faster, but I'd like to be able to rely on Nexctloud Talk even in direr situations.

e-caste commented 1 year ago

@SystemKeeper @Ivansss I have a couple of thoughts about this issue, I'll write them here since in the chat they may get lost.

If I understand correctly, all images are converted to JPEG and then compressed at 70% quality: https://github.com/nextcloud/talk-ios/blob/4aea12dfce3e6e7d1ba815e9e7e067e3fb220f60/ShareExtension/ShareItemController.m#L29
Instead, I can't find where the videos are compressed before sending, but I know the app does it since I always see the compression bar before sending a video.

I wanted to address a couple issues:

  1. to allow users to choose if they want to send full-quality media files or use compression, I think a toggle could be added in the top bar here, which defaults to compressed on but can be disabled for each media file. Mockup: IMG_8232
  2. in my experience, the compression used in Talk iOS is too weak: a standard iPhone photo takes around 10 MB, and compressing it to 70% takes around 7 MB (which is way too much to send on low signal networks, and at the same time does not preserve the full quality of the original image). I would suggest to either turn the compression factor up, e.g. setting the above constant to 0.4, or even better using a better compression algorithm if available and needed (I haven't done any research, but I know for a fact that a picture sent through Whatsapp does not take 7 MB so more compression can be done). I'd say the same is valid for videos, even though there may be differences in compression algorithms.
SystemKeeper commented 1 year ago

Hey @e-caste

thank you for taking a look at this one :-) I really think that would be a great improvement!

Regarding your questions:

  1. I'm not really sure about the switch. What do you think about the way mail handles this when pressing send?

  2. I don't think the algorithm is to blame here, I'm pretty sure WhatsApp & Co. are not just compressing the image but also reducing the size (height/width). So maybe we should take a look at this as well.

What do you think?

e-caste commented 1 year ago

@SystemKeeper

  1. Yeah, it may be a bit more cumbersome for the user but it allows for more options. I would use this new version of the multi-select (I don't know what it's called on iOS, here I invoked it by tapping on "Priority"): IMG_7939F3FF3EE3-1

  2. It may be a good idea to reduce the size. I've found this StackOverflow solution. I can't easily find any better compression algorithm for media on the Internet, and that API is still available even though it was introduced in iOS 2.0 so maybe it's still the way to go, my only concern was that it could have been deprecated.

I think the app should also provide the same behavior for videos, do you think it's doable?