react-native-video-trim 2.2.0 → 2.2.2
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
|
@@ -13,8 +13,10 @@
|
|
|
13
13
|
- ✅ Check if file is valid video/audio
|
|
14
14
|
- ✅ File operations: list, clean up, delete specific file
|
|
15
15
|
|
|
16
|
+
<div align="left">
|
|
16
17
|
<img src="images/document_picker.png" width="300" />
|
|
17
18
|
<img src="images/share_sheet.png" width="300" />
|
|
19
|
+
</div>
|
|
18
20
|
|
|
19
21
|
## Installation
|
|
20
22
|
|
|
@@ -334,8 +336,10 @@ useEffect(() => {
|
|
|
334
336
|
}, []);
|
|
335
337
|
```
|
|
336
338
|
# Audio support
|
|
339
|
+
<div align="left">
|
|
337
340
|
<img src="images/audio_android.jpg" width="200" />
|
|
338
341
|
<img src="images/audio_ios.jpg" width="200" />
|
|
342
|
+
</div>
|
|
339
343
|
|
|
340
344
|
For audio only you have to pass `type=audio` and `outputExt`:
|
|
341
345
|
```ts
|
|
@@ -365,8 +369,10 @@ FFMPEGKIT_PACKAGE=https pod install
|
|
|
365
369
|
```
|
|
366
370
|
|
|
367
371
|
# Cancel trimming
|
|
372
|
+
<div align="left">
|
|
368
373
|
<img src="images/progress.jpg" width="200" />
|
|
369
374
|
<img src="images/cancel_confirm.jpg" width="200" />
|
|
375
|
+
</div>
|
|
370
376
|
|
|
371
377
|
While trimming, you can press Cancel to terminate the process.
|
|
372
378
|
|
|
@@ -379,8 +385,8 @@ If there's error while loading media, there'll be a prompt
|
|
|
379
385
|
|
|
380
386
|
Related props: `alertOnFailToLoad, alertOnFailTitle, alertOnFailMessage, alertOnFailCloseText`
|
|
381
387
|
|
|
382
|
-
# FFMPEG
|
|
383
|
-
This library uses FFMPEG-Kit Android under the hood, by default FFMPEG
|
|
388
|
+
# Customize FFMPEG version
|
|
389
|
+
This library uses FFMPEG-Kit Android under the hood, by default FFMPEG `min` is used, which gives smallest bundle size. To customize the package version please see below
|
|
384
390
|
|
|
385
391
|
## Android
|
|
386
392
|
If you ever need to use other version of FFMPEG-Kit for Android, you can do the following, in your `android/build.gradle` > `buildscript` > `ext`:
|
|
@@ -409,6 +415,55 @@ FFMPEGKIT_PACKAGE_VERSION=5.1 npx pod-install ios
|
|
|
409
415
|
FFMPEGKIT_PACKAGE=full FFMPEGKIT_PACKAGE_VERSION=5.1 npx pod-install ios
|
|
410
416
|
```
|
|
411
417
|
|
|
418
|
+
## Packages
|
|
419
|
+
|
|
420
|
+
<table>
|
|
421
|
+
<thead>
|
|
422
|
+
<tr>
|
|
423
|
+
<th align="center"></th>
|
|
424
|
+
<th align="center"><sup>min</sup></th>
|
|
425
|
+
<th align="center"><sup>min-gpl</sup></th>
|
|
426
|
+
<th align="center"><sup>https</sup></th>
|
|
427
|
+
<th align="center"><sup>https-gpl</sup></th>
|
|
428
|
+
<th align="center"><sup>audio</sup></th>
|
|
429
|
+
<th align="center"><sup>video</sup></th>
|
|
430
|
+
<th align="center"><sup>full</sup></th>
|
|
431
|
+
<th align="center"><sup>full-gpl</sup></th>
|
|
432
|
+
</tr>
|
|
433
|
+
</thead>
|
|
434
|
+
<tbody>
|
|
435
|
+
<tr>
|
|
436
|
+
<td align="center"><sup>external libraries</sup></td>
|
|
437
|
+
<td align="center">-</td>
|
|
438
|
+
<td align="center"><sup>vid.stab</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
|
|
439
|
+
<td align="center"><sup>gmp</sup><br><sup>gnutls</sup></td>
|
|
440
|
+
<td align="center"><sup>gmp</sup><br><sup>gnutls</sup><br><sup>vid.stab</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup></td>
|
|
441
|
+
<td align="center"><sup>lame</sup><br><sup>libilbc</sup><br><sup>libvorbis</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vo-amrwbenc</sup></td>
|
|
442
|
+
<td align="center"><sup>dav1d</sup><br><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>kvazaar</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libtheora</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>snappy</sup><br><sup>zimg</sup></td>
|
|
443
|
+
<td align="center"><sup>dav1d</sup><br><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>gmp</sup><br><sup>gnutls</sup><br><sup>kvazaar</sup><br><sup>lame</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libilbc</sup><br><sup>libtheora</sup><br><sup>libvorbis</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>libxml2</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>snappy</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vo-amrwbenc</sup><br><sup>zimg</sup></td>
|
|
444
|
+
<td align="center"><sup>dav1d</sup><br><sup>fontconfig</sup><br><sup>freetype</sup><br><sup>fribidi</sup><br><sup>gmp</sup><br><sup>gnutls</sup><br><sup>kvazaar</sup><br><sup>lame</sup><br><sup>libass</sup><br><sup>libiconv</sup><br><sup>libilbc</sup><br><sup>libtheora</sup><br><sup>libvorbis</sup><br><sup>libvpx</sup><br><sup>libwebp</sup><br><sup>libxml2</sup><br><sup>opencore-amr</sup><br><sup>opus</sup><br><sup>shine</sup><br><sup>snappy</sup><br><sup>soxr</sup><br><sup>speex</sup><br><sup>twolame</sup><br><sup>vid.stab</sup><br><sup>vo-amrwbenc</sup><br><sup>x264</sup><br><sup>x265</sup><br><sup>xvidcore</sup><br><sup>zimg</sup></td>
|
|
445
|
+
</tr>
|
|
446
|
+
<tr>
|
|
447
|
+
<td align="center"><sup>android system libraries</sup></td>
|
|
448
|
+
<td align="center" colspan=8><sup>zlib</sup><br><sup>MediaCodec</sup></td>
|
|
449
|
+
</tr>
|
|
450
|
+
<tr>
|
|
451
|
+
<td align="center"><sup>ios system libraries</sup></td>
|
|
452
|
+
<td align="center" colspan=8><sup>bzip2</sup><br><sup>AudioToolbox</sup><br><sup>AVFoundation</sup><br><sup>iconv</sup><br><sup>VideoToolbox</sup><br><sup>zlib</sup></td>
|
|
453
|
+
</tr>
|
|
454
|
+
<tr>
|
|
455
|
+
<tr>
|
|
456
|
+
<td align="center"><sup>macos system libraries</sup></td>
|
|
457
|
+
<td align="center" colspan=8><sup>bzip2</sup><br><sup>AudioToolbox</sup><br><sup>AVFoundation</sup><br><sup>Core Image</sup><br><sup>iconv</sup><br><sup>OpenCL</sup><br><sup>OpenGL</sup><br><sup>VideoToolbox</sup><br><sup>zlib</sup></td>
|
|
458
|
+
</tr>
|
|
459
|
+
<tr>
|
|
460
|
+
<td align="center"><sup>tvos system libraries</sup></td>
|
|
461
|
+
<td align="center" colspan=8><sup>bzip2</sup><br><sup>AudioToolbox</sup><br><sup>iconv</sup><br><sup>VideoToolbox</sup><br><sup>zlib</sup></td>
|
|
462
|
+
</tr>
|
|
463
|
+
</tbody>
|
|
464
|
+
</table>
|
|
465
|
+
|
|
466
|
+
|
|
412
467
|
# Android: update SDK version
|
|
413
468
|
You can override sdk version to use any version in your `android/build.gradle` > `buildscript` > `ext`
|
|
414
469
|
```gradle
|
|
@@ -421,6 +476,13 @@ buildscript {
|
|
|
421
476
|
}
|
|
422
477
|
```
|
|
423
478
|
|
|
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.
|
|
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)
|
|
483
|
+
|
|
484
|
+
When you know the package name + version, simply follow the section [Customize FFMPEG version](#customize-ffmpeg-version) in this doc
|
|
485
|
+
|
|
424
486
|
# Thanks
|
|
425
487
|
- Android part is created by modified + fix bugs from: https://github.com/iknow4/Android-Video-Trimmer
|
|
426
488
|
- iOS UI is created from: https://github.com/AndreasVerhoeven/VideoTrimmerControl
|
|
@@ -316,6 +316,8 @@ public class VideoTrimModule extends ReactContextBaseJavaModule implements Video
|
|
|
316
316
|
} else if (openShareSheetOnFinish) {
|
|
317
317
|
hideDialog(closeWhenFinish);
|
|
318
318
|
shareFile(getReactApplicationContext(), new File(in));
|
|
319
|
+
} else {
|
|
320
|
+
hideDialog(closeWhenFinish);
|
|
319
321
|
}
|
|
320
322
|
}
|
|
321
323
|
|
|
@@ -467,7 +469,10 @@ public class VideoTrimModule extends ReactContextBaseJavaModule implements Video
|
|
|
467
469
|
builder.setTitle(cancelTrimmingDialogTitle);
|
|
468
470
|
builder.setCancelable(false);
|
|
469
471
|
builder.setPositiveButton(cancelTrimmingDialogConfirmText, (dialog, which) -> {
|
|
470
|
-
trimmerView
|
|
472
|
+
if (trimmerView != null) {
|
|
473
|
+
// prevent trimmerView is null in some rare cases
|
|
474
|
+
trimmerView.onCancelTrimClicked();
|
|
475
|
+
}
|
|
471
476
|
|
|
472
477
|
if (mProgressDialog != null && mProgressDialog.isShowing()) {
|
|
473
478
|
mProgressDialog.dismiss();
|
|
@@ -479,7 +484,11 @@ public class VideoTrimModule extends ReactContextBaseJavaModule implements Video
|
|
|
479
484
|
cancelTrimmingConfirmDialog = builder.create();
|
|
480
485
|
cancelTrimmingConfirmDialog.show();
|
|
481
486
|
} else {
|
|
482
|
-
trimmerView
|
|
487
|
+
if (trimmerView != null) {
|
|
488
|
+
// prevent trimmerView is null in some rare cases
|
|
489
|
+
trimmerView.onCancelTrimClicked();
|
|
490
|
+
}
|
|
491
|
+
|
|
483
492
|
if (mProgressDialog != null && mProgressDialog.isShowing()) {
|
|
484
493
|
mProgressDialog.dismiss();
|
|
485
494
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-video-trim",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "Video trimmer for your React Native app",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -158,5 +158,6 @@
|
|
|
158
158
|
}
|
|
159
159
|
]
|
|
160
160
|
]
|
|
161
|
-
}
|
|
161
|
+
},
|
|
162
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
162
163
|
}
|