Deepan tizisdeepan
- Chennai, Tamil Nadu, India
- Sign in to view email
- www.linkedin.com/in/tizisdeepan
View VideoCropper.kt
videoCropper.setVideoURI(Uri.parse(path)) | |
.setOnCropVideoListener(this) | |
.setMinMaxRatios(0.3f, 3f) | |
.setDestinationPath(Environment.getExternalStorageDirectory().toString() + File.separator + "temp" + File.separator + "Videos" + File.separator) |
View VideoCropper
<com.video.trimmer.view.VideoCropper | |
android:id="@+id/videoCropper" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@+id/header"/> |
View VideoTrimmer.kt
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) |
View VideoTrimmer
<com.video.trimmer.view.VideoTrimmer | |
android:id="@+id/videoTrimmer" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:layout_below="@+id/header"/> |
View OnCropVideoListener.kt
class MainActivity : AppCompatActivity(), OnTrimVideoListener { | |
... | |
override fun onCropStarted(){ | |
} | |
override fun getResult(uri: Uri){ | |
} | |
override fun cancelAction(){ | |
} | |
override fun onError(message: String){ | |
} |
View OnTrimVideoListener.kt
class MainActivity : AppCompatActivity(), OnTrimVideoListener { | |
... | |
override fun onTrimStarted(){ | |
} | |
override fun getResult(uri: Uri){ | |
} | |
override fun cancelAction(){ | |
} | |
override fun onError(message: String){ | |
} |
View VideoCompression.kt
val command = arrayOf("-i", inputPath, "-vf", "scale=$width:$height", outputPath) //iw:ih |
View TimeLineView.kt
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) |
View CropRect.kt
val rect = cropFrame.cropRect | |
val width = abs(rect.left - rect.right) | |
val height = abs(rect.top - rect.bottom) | |
val x = rect.left | |
val y = rect.top |
View StringForTime.kt
fun stringForTime(timeMs: Float): String { | |
val totalSeconds = (timeMs / 1000).toInt() | |
val seconds = totalSeconds % 60 | |
val minutes = totalSeconds / 60 % 60 | |
val hours = totalSeconds / 3600 | |
val mFormatter = Formatter() | |
return if (hours > 0) { | |
mFormatter.format("%d:%02d:%02d", hours, minutes, seconds).toString() | |
} else { | |
mFormatter.format("%02d:%02d", minutes, seconds).toString() |
NewerOlder