Skip to content

Instantly share code, notes, and snippets.

View tizisdeepan's full-sized avatar
🎯
Focusing

Deepan tizisdeepan

🎯
Focusing
View GitHub Profile
android {
flavorDimensions "version"
productFlavors {
demo {
dimension "version"
firebaseAppDistribution {
releaseNotes="Release notes for demo version"
testers="demo@testers.com"
}
}
@tizisdeepan
tizisdeepan / build.gradle
Last active May 2, 2020 03:09
Firebase App Distribution gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.appdistribution'
buildscript {
repositories {
google()
}
dependencies {
classpath 'com.google.firebase:firebase-appdistribution-gradle:1.4.0'
}
}
videoCropper.setVideoURI(Uri.parse(path))
.setOnCropVideoListener(this)
.setMinMaxRatios(0.3f, 3f)
.setDestinationPath(Environment.getExternalStorageDirectory().toString() + File.separator + "temp" + File.separator + "Videos" + File.separator)
<com.video.trimmer.view.VideoCropper
android:id="@+id/videoCropper"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/header"/>
videoTrimmer.setTextTimeSelectionTypeface(FontsHelper[this, FontsConstants.SEMI_BOLD])
.setOnTrimVideoListener(this)
.setOnVideoListener(this)
.setVideoURI(Uri.parse(path))
.setVideoInformationVisibility(true)
.setMaxDuration(10)
.setMinDuration(2)
.setDestinationPath(Environment.getExternalStorageDirectory().toString() + File.separator + "temp" + File.separator + "Videos" + File.separator)
<com.video.trimmer.view.VideoTrimmer
android:id="@+id/videoTrimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/header"/>
class MainActivity : AppCompatActivity(), OnTrimVideoListener {
...
override fun onCropStarted(){
}
override fun getResult(uri: Uri){
}
override fun cancelAction(){
}
override fun onError(message: String){
}
class MainActivity : AppCompatActivity(), OnTrimVideoListener {
...
override fun onTrimStarted(){
}
override fun getResult(uri: Uri){
}
override fun cancelAction(){
}
override fun onError(message: String){
}
val command = arrayOf("-i", inputPath, "-vf", "scale=$width:$height", outputPath) //iw:ih
BackgroundExecutor.execute(object : BackgroundExecutor.Task("", 0L, "") {
override fun execute() {
try {
val threshold = 11
val thumbnailList = LongSparseArray<Bitmap>()
val mediaMetadataRetriever = MediaMetadataRetriever()
mediaMetadataRetriever.setDataSource(context, mVideoUri)
val videoLengthInMs = (Integer.parseInt(mediaMetadataRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION)) * 1000).toLong()
val frameHeight = mHeightView
val initialBitmap = mediaMetadataRetriever.getFrameAtTime(0, MediaMetadataRetriever.OPTION_CLOSEST_SYNC)