react-native-video-trim 2.2.9 → 2.2.11

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 CHANGED
@@ -477,11 +477,18 @@ buildscript {
477
477
  ```
478
478
 
479
479
  # Naming conflict with `ffmpeg-kit-react-native`
480
- This issue is due to this package and `ffmpeg-kit-react-native` share FFMPEG Kit under the hood. To fix it we need to synchronize the FFMPEG Kit version of the 2 packages.
480
+ This issue is due to this package and `ffmpeg-kit-react-native` have same ffmpegkit class name under the hood:
481
481
 
482
- First find out exactly FFMPEG Kit version that `ffmpeg-kit-react-native` is using. By default (if you don't change), the ffmpeg package is `https` ([check here](https://github.com/arthenica/ffmpeg-kit/blob/main/react-native/ffmpeg-kit-react-native.podspec#L19)) and version is `version` in [package.json](https://github.com/arthenica/ffmpeg-kit/blob/main/react-native/package.json#L3)
482
+ <img src="images/error_conflict_name.png"/>
483
483
 
484
- When you know the package name + version, simply follow the section [Customize FFMPEG version](#customize-ffmpeg-version) in this doc
484
+ To fix it we need to synchronize the FFMPEG Kit version of the 2 packages. For example: as shown in the image above, `ffmpeg-kit-react-native` uses `https`, version `6.0`, hence we need to run this:
485
+ ```
486
+ FFMPEGKIT_PACKAGE=https FFMPEG_KIT_PACKAGE_VERSION=6.0 pod install
487
+ ```
488
+
489
+ Another way to find out exactly FFMPEG Kit version that `ffmpeg-kit-react-native` using is to ([check here for package name](https://github.com/arthenica/ffmpeg-kit/blob/main/react-native/ffmpeg-kit-react-native.podspec#L19)) and package version is `version` in [package.json](https://github.com/arthenica/ffmpeg-kit/blob/main/react-native/package.json#L3)
490
+
491
+ When you know the package name + version, simply run `pod install` with `FFMPEGKIT_PACKAGE` and `FFMPEG_KIT_PACKAGE_VERSION` like above
485
492
 
486
493
  # Thanks
487
494
  - Android part is created by modified + fix bugs from: https://github.com/iknow4/Android-Video-Trimmer
@@ -37,6 +37,7 @@ public class VideoTrimmerUtil {
37
37
  // public static final int THUMB_WIDTH = (SCREEN_WIDTH_FULL - RECYCLER_VIEW_PADDING * 2) / VIDEO_MAX_TIME;
38
38
  public static int mThumbWidth = 0; // make it automatic
39
39
  public static final int THUMB_HEIGHT = UnitConverter.dpToPx(50); // x2 for better resolution
40
+ public static final int THUMB_WIDTH = UnitConverter.dpToPx(25); // x2 for better resolution
40
41
  private static final int THUMB_RESOLUTION_RES = 2; // double thumb resolution for better quality
41
42
 
42
43
  public static FFmpegSession trim(String inputFile, String outputFile, int videoDuration, long startMs, long endMs, final VideoTrimListener callback) {
@@ -258,7 +258,9 @@ public class VideoTrimmerView extends FrameLayout implements IVideoTrimmerView {
258
258
  Bitmap bitmap = mediaMetadataRetriever.getFrameAtTime(0, MediaMetadataRetriever.OPTION_CLOSEST_SYNC);
259
259
 
260
260
  if (bitmap != null) {
261
- VideoTrimmerUtil.mThumbWidth = VideoTrimmerUtil.THUMB_HEIGHT * bitmap.getWidth() / bitmap.getHeight();
261
+ int bitmapHeight = bitmap.getHeight() > 0 ? bitmap.getHeight() : VideoTrimmerUtil.THUMB_HEIGHT;
262
+ int bitmapWidth = bitmap.getWidth() > 0 ? bitmap.getWidth() : VideoTrimmerUtil.THUMB_WIDTH;
263
+ VideoTrimmerUtil.mThumbWidth = VideoTrimmerUtil.THUMB_HEIGHT * bitmapWidth / bitmapHeight;
262
264
  }
263
265
 
264
266
  VideoTrimmerUtil.SCREEN_WIDTH_FULL = this.getScreenWidthInPortraitMode();
@@ -640,6 +642,7 @@ public class VideoTrimmerView extends FrameLayout implements IVideoTrimmerView {
640
642
 
641
643
  private void setHandleTouchListener(View handle, boolean isLeading) {
642
644
  handle.setOnTouchListener((view, event) -> {
645
+ boolean draggingDisabled = mDuration < mMinDuration; // if the video is shorter than the minimum duration, disable dragging
643
646
  switch (event.getAction()) {
644
647
  case MotionEvent.ACTION_DOWN:
645
648
  currentSelectedhandle = handle;
@@ -650,6 +653,10 @@ public class VideoTrimmerView extends FrameLayout implements IVideoTrimmerView {
650
653
  playHapticFeedback(true);
651
654
  break;
652
655
  case MotionEvent.ACTION_MOVE:
656
+ if (draggingDisabled) {
657
+ return false;
658
+ }
659
+
653
660
  boolean didClamp = false;
654
661
  float newX = event.getRawX() - ((float) view.getWidth() / 2);
655
662
  if (isLeading) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-video-trim",
3
- "version": "2.2.9",
3
+ "version": "2.2.11",
4
4
  "description": "Video trimmer for your React Native app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",