Light weight version of Android-Video-Trimmer. It uses LiTr library as transcoder
For a working implementation, please have a look at the Sample Project
- Include the library as local library project.
- Add the dependency to your app
build.gradle
file
dependencies {
implementation 'com.github.a914-gowtham:android-video-trimmer-litr:1.5.11'
}
- Add to project's root
build.gradle
file:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
- Add the code for opening Trim Activity.
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);
- Override
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** { *; }
- Library - Android Kitkat 4.4+ (API 19)
- Sample - Android Kitkat 4.4+ (API 19)
- Write permission removed
- First version
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.