react-native-video-trim 1.0.24 → 2.0.0
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.
- package/README.md +22 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/videotrim/VideoTrimModule.java +8 -1
- package/android/src/main/java/com/videotrim/interfaces/VideoTrimListener.java +4 -0
- package/android/src/main/java/com/videotrim/utils/VideoTrimmerUtil.java +21 -0
- package/android/src/main/java/com/videotrim/widgets/VideoTrimmerView.java +406 -295
- package/android/src/main/res/drawable/chevron_compact_left.xml +15 -0
- package/android/src/main/res/drawable/chevron_compact_right.xml +15 -0
- package/android/src/main/res/drawable/chevron_right_with_bg.xml +13 -0
- package/android/src/main/res/drawable/pause_fill.xml +15 -0
- package/android/src/main/res/drawable/play_fill.xml +15 -0
- package/android/src/main/res/drawable/rounded_progress_indicator.xml +16 -0
- package/android/src/main/res/drawable/rounded_yellow_left_background.xml +8 -0
- package/android/src/main/res/drawable/rounded_yellow_right_background.xml +8 -0
- package/android/src/main/res/drawable/yellow_border.xml +9 -0
- package/android/src/main/res/layout/video_trimmer_view.xml +148 -76
- package/android/src/main/res/values/colors.xml +15 -13
- package/ios/VideoTrim.swift +26 -2
- package/ios/VideoTrimmerViewController.swift +1 -1
- package/package.json +1 -1
- package/android/src/main/java/com/videotrim/adapters/VideoTrimmerAdapter.java +0 -54
- package/android/src/main/java/com/videotrim/widgets/RangeSeekBarView.java +0 -534
- package/android/src/main/java/com/videotrim/widgets/SpacesItemDecoration2.java +0 -33
- package/android/src/main/java/com/videotrim/widgets/ZVideoView.java +0 -48
- package/android/src/main/res/drawable/ic_video_pause_black.png +0 -0
- package/android/src/main/res/drawable/ic_video_play_black.png +0 -0
- package/android/src/main/res/drawable/ic_video_thumb_handle.png +0 -0
- package/android/src/main/res/drawable/icon_seek_bar.png +0 -0
- package/android/src/main/res/layout/video_thumb_item_layout.xml +0 -16
package/README.md
CHANGED
|
@@ -226,6 +226,16 @@ useEffect(() => {
|
|
|
226
226
|
console.log('onError', event);
|
|
227
227
|
break;
|
|
228
228
|
}
|
|
229
|
+
case 'onLog': {
|
|
230
|
+
// FFMPEG logs (while trimming)
|
|
231
|
+
console.log('onLog', event);
|
|
232
|
+
break;
|
|
233
|
+
}
|
|
234
|
+
case 'onStatistics': {
|
|
235
|
+
// FFMPEG stats (while trimming)
|
|
236
|
+
console.log('onStatistics', event);
|
|
237
|
+
break;
|
|
238
|
+
}
|
|
229
239
|
}
|
|
230
240
|
});
|
|
231
241
|
|
|
@@ -264,6 +274,18 @@ FFMPEGKIT_PACKAGE_VERSION=5.1 npx pod-install ios
|
|
|
264
274
|
FFMPEGKIT_PACKAGE=full FFMPEGKIT_PACKAGE_VERSION=5.1 npx pod-install ios
|
|
265
275
|
```
|
|
266
276
|
|
|
277
|
+
# Android: update SDK version
|
|
278
|
+
You can override sdk version to use any version in your `android/build.gradle` > `buildscript` > `ext`
|
|
279
|
+
```gradle
|
|
280
|
+
buildscript {
|
|
281
|
+
ext {
|
|
282
|
+
VideoTrim_compileSdkVersion = 34
|
|
283
|
+
VideoTrim_minSdkVersion = 26
|
|
284
|
+
VideoTrim_targetSdkVersion = 34
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
267
289
|
# Thanks
|
|
268
290
|
- Android part is created by modified + fix bugs from: https://github.com/iknow4/Android-Video-Trimmer
|
|
269
291
|
- iOS UI is created from: https://github.com/AndreasVerhoeven/VideoTrimmerControl
|
|
@@ -147,7 +147,6 @@ public class VideoTrimModule extends ReactContextBaseJavaModule implements Video
|
|
|
147
147
|
public void onHostPause() {
|
|
148
148
|
if (trimmerView != null) {
|
|
149
149
|
trimmerView.onVideoPause();
|
|
150
|
-
trimmerView.setRestoreState(true);
|
|
151
150
|
}
|
|
152
151
|
}
|
|
153
152
|
|
|
@@ -240,6 +239,14 @@ public class VideoTrimModule extends ReactContextBaseJavaModule implements Video
|
|
|
240
239
|
alertDialog.show();
|
|
241
240
|
}
|
|
242
241
|
|
|
242
|
+
@Override public void onLog(WritableMap log) {
|
|
243
|
+
sendEvent(getReactApplicationContext(), "onLog", log);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
@Override public void onStatistics(WritableMap statistics) {
|
|
247
|
+
sendEvent(getReactApplicationContext(), "onStatistics", statistics);
|
|
248
|
+
}
|
|
249
|
+
|
|
243
250
|
@ReactMethod
|
|
244
251
|
private void hideDialog() {
|
|
245
252
|
if (mProgressDialog != null) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package com.videotrim.interfaces;
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.bridge.WritableMap;
|
|
4
|
+
|
|
3
5
|
public interface VideoTrimListener {
|
|
4
6
|
void onStartTrim();
|
|
5
7
|
void onTrimmingProgress(int percentage);
|
|
@@ -7,4 +9,6 @@ public interface VideoTrimListener {
|
|
|
7
9
|
void onError(String errorMessage);
|
|
8
10
|
void onCancel();
|
|
9
11
|
void onSave();
|
|
12
|
+
void onLog(WritableMap log);
|
|
13
|
+
void onStatistics(WritableMap statistics);
|
|
10
14
|
}
|
|
@@ -7,6 +7,8 @@ import android.net.Uri;
|
|
|
7
7
|
import com.arthenica.ffmpegkit.FFmpegKit;
|
|
8
8
|
import com.arthenica.ffmpegkit.ReturnCode;
|
|
9
9
|
import com.arthenica.ffmpegkit.SessionState;
|
|
10
|
+
import com.facebook.react.bridge.Arguments;
|
|
11
|
+
import com.facebook.react.bridge.WritableMap;
|
|
10
12
|
import com.videotrim.interfaces.VideoTrimListener;
|
|
11
13
|
|
|
12
14
|
import java.text.SimpleDateFormat;
|
|
@@ -79,6 +81,13 @@ public class VideoTrimmerUtil {
|
|
|
79
81
|
}
|
|
80
82
|
}, log -> {
|
|
81
83
|
System.out.println("FFmpeg process started with log " + log.getMessage());
|
|
84
|
+
|
|
85
|
+
WritableMap map = Arguments.createMap();
|
|
86
|
+
map.putInt("level", log.getLevel().getValue());
|
|
87
|
+
map.putString("message", log.getMessage());
|
|
88
|
+
map.putDouble("sessionId", log.getSessionId());
|
|
89
|
+
map.putString("logStr", log.toString());
|
|
90
|
+
callback.onLog(map);
|
|
82
91
|
}, statistics -> {
|
|
83
92
|
int timeInMilliseconds = (int) statistics.getTime();
|
|
84
93
|
if (timeInMilliseconds > 0) {
|
|
@@ -86,6 +95,18 @@ public class VideoTrimmerUtil {
|
|
|
86
95
|
(timeInMilliseconds * 100) / videoDuration;
|
|
87
96
|
callback.onTrimmingProgress(Math.min(Math.max(completePercentage, 0), 100));
|
|
88
97
|
}
|
|
98
|
+
|
|
99
|
+
WritableMap map = Arguments.createMap();
|
|
100
|
+
map.putDouble("sessionId", statistics.getSessionId());
|
|
101
|
+
map.putInt("videoFrameNumber", statistics.getVideoFrameNumber());
|
|
102
|
+
map.putDouble("videoFps", statistics.getVideoFps());
|
|
103
|
+
map.putDouble("videoQuality", statistics.getVideoQuality());
|
|
104
|
+
map.putDouble("size", statistics.getSize());
|
|
105
|
+
map.putDouble("time", statistics.getTime());
|
|
106
|
+
map.putDouble("bitrate", statistics.getBitrate());
|
|
107
|
+
map.putDouble("speed", statistics.getSpeed());
|
|
108
|
+
map.putString("statisticsStr", statistics.toString());
|
|
109
|
+
callback.onStatistics(map);
|
|
89
110
|
});
|
|
90
111
|
}
|
|
91
112
|
|