From 8e00d6450ca38c83b366194cf9a638b3142fd783 Mon Sep 17 00:00:00 2001 From: guidoec Date: Fri, 17 Sep 2021 11:32:55 +0200 Subject: [PATCH] Fix duration on Android to work with seconds Changes multiplier value from thousand to hundred to let the plugin `duration` parameter work with seconds. --- .../kotlin/com/example/video_compress/VideoCompressPlugin.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt b/android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt index d8f43de1..b86c12b7 100644 --- a/android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt +++ b/android/src/main/kotlin/com/example/video_compress/VideoCompressPlugin.kt @@ -141,7 +141,7 @@ class VideoCompressPlugin : MethodCallHandler, FlutterPlugin { val dataSource = if (startTime != null || duration != null){ val source = UriDataSource(context, Uri.parse(path)) - TrimDataSource(source, (1000 * 1000 * (startTime ?: 0)).toLong(), (1000 * 1000 * (duration ?: 0)).toLong()) + TrimDataSource(source, (100 * 100 * (startTime ?: 0)).toLong(), (100 * 100 * (duration ?: 0)).toLong()) }else{ UriDataSource(context, Uri.parse(path)) }