Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,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, (1000 * (startTime ?: 0)).toLong(), (1000 * (duration ?: 0)).toLong())
}else{
UriDataSource(context, Uri.parse(path))
}
Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/SwiftVideoCompressPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,10 @@ public class SwiftVideoCompressPlugin: NSObject, FlutterPlugin {
Utility.getPathUrl("\(Utility.basePath())/\(Utility.getFileName(path))\(uuid.uuidString).\(sourceVideoType)")

let timescale = sourceVideoAsset.duration.timescale
let minStartTime = Double(startTime ?? 0)
let minStartTime = Double(startTime ?? 0) / 1000.0

let videoDuration = sourceVideoAsset.duration.seconds
let minDuration = Double(duration ?? videoDuration)
let minDuration = Double(duration != nil ? ((duration ?? 0) / 1000.0) : videoDuration)
let maxDurationTime = minStartTime + minDuration < videoDuration ? minDuration : videoDuration

let cmStartTime = CMTimeMakeWithSeconds(minStartTime, preferredTimescale: timescale)
Expand Down