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

Replace videoWidth, videoHeight with VideoResizer interface - #188

Merged
AbedElazizShe merged 8 commits into
AbedElazizShe:masterfrom
dan3988:master
Aug 15, 2024
Merged

AbedElazizShe merged 8 commits into
AbedElazizShe:masterfrom
dan3988:master

Conversation

@dan3988

@dan3988 dan3988 commented Jan 23, 2024

Copy link
Copy Markdown
Contributor

I'm using this library and wanted to set a maximum resolution for videos however that is currently not possible. When overriding the default resize function by adding videoWidth and videoHeight to the configuration, this resizes the video to those dimensions exactly. In my case this means that the video is stretched to a 1:1 aspect ratio, and lower resolution videos are upscaled.

I've added a functional interface VideoResizer that allows a custom function to calculate the desired dimension using the source video's dimensions, with some default implementations:

  • VideoResizer.auto - Matches the original behavior when not providing videoWidth and videoHeight in the configuration
  • VideoResizer.scale - Scale the dimensions by a scale factor
  • VideoResizer.limitSize - Set a maximum width and height value for the video
  • VideoResizer.matchSize - Set an exact width and height value

I've updated the Configuration class and replaced keepOriginalResolution, videoWidth and videoHeight with resizer, and added a constructor overload to match the old behaviour.

@AbedElazizShe
AbedElazizShe merged commit 28b803c into AbedElazizShe:master Aug 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants