Add media upload setting.
Compress media regarding the settings. Image compression change quality to 78% Video compression change size to 720 x 48
This commit is contained in:
parent
01e7986347
commit
846dbc2b18
22 changed files with 162 additions and 29 deletions
|
|
@ -36,7 +36,7 @@ class ImageCompressor @Inject constructor(
|
|||
resizeMode: ResizeMode,
|
||||
format: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG,
|
||||
orientation: Int = ExifInterface.ORIENTATION_UNDEFINED,
|
||||
desiredQuality: Int = 80,
|
||||
desiredQuality: Int = 78,
|
||||
): Result<ImageCompressionResult> = withContext(dispatchers.io) {
|
||||
runCatching {
|
||||
val compressedBitmap = compressToBitmap(inputStreamProvider, resizeMode, orientation).getOrThrow()
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
.build()
|
||||
)
|
||||
.addDataSource(context, uri)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue