For a working implementation, please have a look at the Sample Project
build.gradle
file
dependencies {
implementation 'com.github.a914-gowtham:android-video-trimmer-litr:1.5.11'
}
build.gradle
file:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
TrimVideo.activity(String.valueOf(videoUri))
// .setCompressOption(new CompressOption()) //empty constructor for default compress option
.setHideSeekBar(true)
.setDestination("/storage/emulated/0/DCIM/TESTFOLDER") //default output path /storage/emulated/0/DOWNLOADS
.start(this);
onActivityResult
method in your activity to get trim result
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == TrimVideo.VIDEO_TRIMMER_REQ_CODE && data != null) {
Uri uri = Uri.parse(TrimVideo.getTrimmedVideoPath(data));
Log.d(TAG,"Trimmed path:: "+uri);
}
}
.setCompressOption(new CompressOption(bitRate)) //pass empty constructor for default compressoption
BitRate
Bitrate Can be between 1 to 10.Lower bitrate can reduce the quality and size of the video..setHideSeekBar(true) //default value is false
TrimVideo.activity(videoUri)
.start(this);
TrimVideo.activity(videoUri)
.setTrimType(TrimType.FIXED_DURATION)
.setFixedDuration(30) //seconds
.start(this);
TrimVideo.activity(videoUri)
.setTrimType(TrimType.MIN_DURATION)
.setMinDuration(30) //seconds
.start(this);
TrimVideo.activity(videoUri)
.setTrimType(TrimType.MIN_MAX_DURATION)
.setMinToMax(10, 30) //seconds
.start(this);
-dontwarn com.videotrimmer.library**
-keep class com.videotrimmer.library** { *; }
-keep interface com.videotrimmer.library** { *; }
Show your support by giving a star to this repository.so this can keep me motivated to make improvements
There are many ways of improving and adding more features, so feel free to collaborate with ideas, issues and/or pull requests.