react-native-video-trim 2.2.10 → 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.
@@ -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();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-video-trim",
3
- "version": "2.2.10",
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",