react-native-video-trim 3.0.0 → 3.0.1
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.
|
@@ -69,7 +69,7 @@ public class VideoTrimmerUtil {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
public static TrimSession trim(String inputFile, String outputFile, int videoDuration, long startMs, long endMs, final VideoTrimListener callback, float progressUpdateInterval) {
|
|
72
|
+
public static TrimSession trim(String inputFile, String outputFile, int videoDuration, long startMs, long endMs, final VideoTrimListener callback, float progressUpdateInterval, MediaMetadataRetriever retriever) {
|
|
73
73
|
// Format creation time
|
|
74
74
|
@SuppressLint("SimpleDateFormat") SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
|
|
75
75
|
dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
|
|
@@ -83,6 +83,12 @@ public class VideoTrimmerUtil {
|
|
|
83
83
|
TrimSession session = new TrimSession(Thread.currentThread());
|
|
84
84
|
|
|
85
85
|
try {
|
|
86
|
+
// Get rotation metadata from input file
|
|
87
|
+
retriever.setDataSource(inputFile);
|
|
88
|
+
String rotationStr = retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);
|
|
89
|
+
int rotation = rotationStr != null ? Integer.parseInt(rotationStr) : 0;
|
|
90
|
+
retriever.release();
|
|
91
|
+
|
|
86
92
|
extractor = new MediaExtractor();
|
|
87
93
|
extractor.setDataSource(inputFile);
|
|
88
94
|
|
|
@@ -100,6 +106,9 @@ public class VideoTrimmerUtil {
|
|
|
100
106
|
extractor.selectTrack(i);
|
|
101
107
|
}
|
|
102
108
|
|
|
109
|
+
// Set rotation metadata on muxer
|
|
110
|
+
muxer.setOrientationHint(rotation);
|
|
111
|
+
|
|
103
112
|
// Seek to start time
|
|
104
113
|
long startUs = startMs * 1000; // Convert ms to μs
|
|
105
114
|
long endUs = endMs * 1000;
|