react-native-video-trim 1.0.19 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,11 @@ import com.arthenica.ffmpegkit.FFmpegKit;
|
|
|
8
8
|
import com.arthenica.ffmpegkit.ReturnCode;
|
|
9
9
|
import com.arthenica.ffmpegkit.SessionState;
|
|
10
10
|
import com.videotrim.interfaces.VideoTrimListener;
|
|
11
|
+
|
|
12
|
+
import java.text.SimpleDateFormat;
|
|
13
|
+
import java.util.Date;
|
|
14
|
+
import java.util.TimeZone;
|
|
15
|
+
|
|
11
16
|
import iknow.android.utils.DeviceUtil;
|
|
12
17
|
import iknow.android.utils.UnitConverter;
|
|
13
18
|
import iknow.android.utils.callback.SingleCallback;
|
|
@@ -31,7 +36,19 @@ public class VideoTrimmerUtil {
|
|
|
31
36
|
private static final int THUMB_RESOLUTION_RES = 2; // double thumb resolution for better quality
|
|
32
37
|
|
|
33
38
|
public static void trim(String inputFile, String outputFile, int videoDuration, long startMs, long endMs, final VideoTrimListener callback) {
|
|
34
|
-
|
|
39
|
+
// Get the current date and time
|
|
40
|
+
Date currentDate = new Date();
|
|
41
|
+
|
|
42
|
+
// Create a SimpleDateFormat object with the desired format
|
|
43
|
+
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
|
44
|
+
|
|
45
|
+
// Set the timezone to UTC
|
|
46
|
+
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
47
|
+
|
|
48
|
+
// Format the current date and time
|
|
49
|
+
String formattedDateTime = dateFormat.format(currentDate);
|
|
50
|
+
|
|
51
|
+
String cmd = "-ss " + startMs + "ms" + " -to " + endMs + "ms -i " + inputFile + " -c copy -metadata creation_time=" + formattedDateTime + " " + outputFile;
|
|
35
52
|
callback.onStartTrim();
|
|
36
53
|
FFmpegKit.executeAsync(cmd, session -> {
|
|
37
54
|
SessionState state = session.getState();
|
|
@@ -169,13 +169,13 @@ public class VideoTrimmerView extends FrameLayout implements IVideoTrimmerView {
|
|
|
169
169
|
int videoWidth = mp.getVideoWidth();
|
|
170
170
|
int videoHeight = mp.getVideoHeight();
|
|
171
171
|
|
|
172
|
-
float videoProportion = (float) videoWidth / (float) videoHeight;
|
|
173
172
|
int screenWidth = mLinearVideo.getWidth();
|
|
174
173
|
int screenHeight = mLinearVideo.getHeight();
|
|
175
174
|
|
|
176
175
|
if (videoHeight > videoWidth) {
|
|
177
|
-
lp.width = screenWidth;
|
|
178
176
|
lp.height = screenHeight;
|
|
177
|
+
float r = videoWidth / (float) videoHeight;
|
|
178
|
+
lp.width = (int) (lp.height * r);
|
|
179
179
|
} else {
|
|
180
180
|
lp.width = screenWidth;
|
|
181
181
|
float r = videoHeight / (float) videoWidth;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-video-trim",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "Video trimmer for your React Native app",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"engines": {
|
|
87
87
|
"node": ">= 16.0.0"
|
|
88
88
|
},
|
|
89
|
-
"packageManager": "^yarn@1.22.15",
|
|
90
89
|
"jest": {
|
|
91
90
|
"preset": "react-native",
|
|
92
91
|
"modulePathIgnorePatterns": [
|