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

Add setting to compress image and video #3744

Merged
merged 5 commits into from
Oct 29, 2024
Merged

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Oct 28, 2024

Content

Add a new setting in the advanced section to compress image and video. Setting is disabled by default. When enabled, the image and the video will be compressed.

Motivation and context

Closes #3651

Screenshots / GIFs

See recorded ones.

Tests

  • Send an image
  • Observe the the image is sent with the original size
  • Enable the new setting
  • Send the image again
  • Observe that the image quality is lower, but the image size is also lower.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 23
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • Pull request includes a sign off
  • You've made a self review of your PR

bmarty and others added 2 commits October 28, 2024 10:56
Compress media regarding the settings.
Image compression change quality to 78%
Video compression change size to 720 x 48
@bmarty bmarty requested a review from a team as a code owner October 28, 2024 10:39
@bmarty bmarty requested review from jmartinesp and removed request for a team October 28, 2024 10:39
Copy link
Contributor

github-actions bot commented Oct 28, 2024

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/F4hsip

Copy link
Member

@jmartinesp jmartinesp left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@@ -29,7 +29,7 @@ class VideoCompressor @Inject constructor(
val future = Transcoder.into(tmpFile.path)
.setVideoTrackStrategy(
DefaultVideoStrategy.Builder()
.addResizer(AtMostResizer(1920, 1080))
.addResizer(AtMostResizer(720, 480))
Copy link
Member

Choose a reason for hiding this comment

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

Note: the commit messages incorrectly says 720x48, at least that's what I see on GH.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes, that's a typo

Copy link

sonarcloud bot commented Oct 28, 2024

Copy link

codecov bot commented Oct 28, 2024

Codecov Report

Attention: Patch coverage is 90.90909% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.06%. Comparing base (01e7986) to head (3a6d65b).
Report is 16 commits behind head on develop.

Files with missing lines Patch % Lines
...ences/impl/store/DefaultSessionPreferencesStore.kt 0.00% 3 Missing ⚠️
...roid/libraries/mediaupload/impl/VideoCompressor.kt 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3744   +/-   ##
========================================
  Coverage    83.05%   83.06%           
========================================
  Files         1754     1754           
  Lines        43994    44022   +28     
  Branches      5142     5144    +2     
========================================
+ Hits         36539    36565   +26     
- Misses        5632     5635    +3     
+ Partials      1823     1822    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bmarty bmarty added Run-Maestro Starts a Maestro Cloud session to run integration tests PR-Change For updates to an existing feature labels Oct 28, 2024
@github-actions github-actions bot removed the Run-Maestro Starts a Maestro Cloud session to run integration tests label Oct 28, 2024
Copy link
Contributor

@frebib frebib Oct 28, 2024

Choose a reason for hiding this comment

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

I understand that this is a "product decision" but both "Media" and "Optimise for upload" are pretty vague terms. "Media" might be better clarified as "Images and videos"? The thing I have more beef with is "Optimise for upload". It really depends on your perspective and what it is you're optimising for. It'd be more accurate to say "Compress for upload". If you're optimising for transfer speed, then maybe it should say that. My take is that it'd be more optimised for my eyes if it wasn't compressed, making this option actually inverted.

One final remark is the use of simplified English here. Is it time that we added English and Simplified English to localazy, because depending on your disposition, you may consider this word misspelt.

Copy link
Member Author

Choose a reason for hiding this comment

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

@bmarty bmarty merged commit 870ae5f into develop Oct 29, 2024
33 checks passed
@bmarty bmarty deleted the feature/bma/resizeMedia branch October 29, 2024 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Change For updates to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Resize media before sending
4 participants