react-native-compressor 1.6.4 → 1.7.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.
Files changed (192) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +41 -27
  3. package/android/build.gradle +95 -42
  4. package/android/gradle.properties +5 -0
  5. package/android/src/main/AndroidManifest.xml +0 -1
  6. package/android/src/main/AndroidManifestNew.xml +2 -0
  7. package/android/src/main/java/com/reactnativecompressor/CompressorModule.java +107 -43
  8. package/android/src/main/java/com/reactnativecompressor/CompressorPackage.java +47 -19
  9. package/android/src/main/java/com/reactnativecompressor/Image/ImageCompressor.java +28 -16
  10. package/android/src/main/java/com/reactnativecompressor/Image/utils/ImageCompressorOptions.java +5 -1
  11. package/android/src/main/java/com/reactnativecompressor/Utils/MediaCache.java +65 -0
  12. package/android/src/main/java/com/reactnativecompressor/Utils/Utils.java +162 -3
  13. package/android/src/main/java/com/reactnativecompressor/Video/VideoCompressorHelper.java +7 -4
  14. package/android/src/main/java/com/reactnativecompressor/Video/VideoModule.java +11 -22
  15. package/android/src/newarch/CompressorSpec.java +9 -0
  16. package/android/src/newarch/VideoCompressorSpec.java +9 -0
  17. package/android/src/oldarch/CompressorSpec.java +34 -0
  18. package/android/src/oldarch/VideoCompressorSpec.java +26 -0
  19. package/ios/Compressor-Bridging-Header.h +1 -0
  20. package/ios/Compressor.h +9 -1
  21. package/ios/Compressor.mm +427 -0
  22. package/ios/Compressor.xcodeproj/project.pbxproj +6 -36
  23. package/ios/Image/ImageCompressor.h +12 -7
  24. package/ios/Image/ImageCompressor.m +164 -67
  25. package/ios/Image/ImageCompressorOptions.h +1 -0
  26. package/ios/Image/ImageCompressorOptions.m +5 -1
  27. package/ios/Utils/Downloader.h +16 -0
  28. package/ios/Utils/Downloader.m +150 -0
  29. package/ios/Utils/MediaCache.h +11 -0
  30. package/ios/Utils/MediaCache.m +51 -0
  31. package/ios/Video/VideoCompressor.swift +14 -5
  32. package/lib/commonjs/Audio/index.js +13 -14
  33. package/lib/commonjs/Audio/index.js.map +1 -1
  34. package/lib/commonjs/Image/index.js +26 -7
  35. package/lib/commonjs/Image/index.js.map +1 -1
  36. package/lib/commonjs/Main.js +29 -0
  37. package/lib/commonjs/Main.js.map +1 -0
  38. package/lib/commonjs/Spec/NativeCompressor.js +10 -0
  39. package/lib/commonjs/Spec/NativeCompressor.js.map +1 -0
  40. package/lib/commonjs/Spec/NativeVideoCompressor.js +10 -0
  41. package/lib/commonjs/Spec/NativeVideoCompressor.js.map +1 -0
  42. package/lib/commonjs/Video/index.js +17 -25
  43. package/lib/commonjs/Video/index.js.map +1 -1
  44. package/lib/commonjs/expo-plugin/compressor.js +1 -4
  45. package/lib/commonjs/expo-plugin/compressor.js.map +1 -1
  46. package/lib/commonjs/index.js +21 -28
  47. package/lib/commonjs/index.js.map +1 -1
  48. package/lib/commonjs/utils/index.js +32 -51
  49. package/lib/commonjs/utils/index.js.map +1 -1
  50. package/lib/module/Audio/index.js +13 -11
  51. package/lib/module/Audio/index.js.map +1 -1
  52. package/lib/module/Image/index.js +27 -6
  53. package/lib/module/Image/index.js.map +1 -1
  54. package/lib/module/Main.js +22 -0
  55. package/lib/module/Main.js.map +1 -0
  56. package/lib/module/Spec/NativeCompressor.js +3 -0
  57. package/lib/module/Spec/NativeCompressor.js.map +1 -0
  58. package/lib/module/Spec/NativeVideoCompressor.js +3 -0
  59. package/lib/module/Spec/NativeVideoCompressor.js.map +1 -0
  60. package/lib/module/Video/index.js +18 -19
  61. package/lib/module/Video/index.js.map +1 -1
  62. package/lib/module/expo-plugin/compressor.js +1 -3
  63. package/lib/module/expo-plugin/compressor.js.map +1 -1
  64. package/lib/module/index.js +8 -5
  65. package/lib/module/index.js.map +1 -1
  66. package/lib/module/utils/index.js +26 -34
  67. package/lib/module/utils/index.js.map +1 -1
  68. package/lib/typescript/Audio/index.d.ts +2 -1
  69. package/lib/typescript/Audio/index.d.ts.map +1 -0
  70. package/lib/typescript/Image/index.d.ts +11 -6
  71. package/lib/typescript/Image/index.d.ts.map +1 -0
  72. package/lib/typescript/Main.d.ts +4 -0
  73. package/lib/typescript/Main.d.ts.map +1 -0
  74. package/lib/typescript/Spec/NativeCompressor.d.ts +14 -0
  75. package/lib/typescript/Spec/NativeCompressor.d.ts.map +1 -0
  76. package/lib/typescript/Spec/NativeVideoCompressor.d.ts +13 -0
  77. package/lib/typescript/Spec/NativeVideoCompressor.d.ts.map +1 -0
  78. package/lib/typescript/Video/index.d.ts +5 -3
  79. package/lib/typescript/Video/index.d.ts.map +1 -0
  80. package/lib/typescript/expo-plugin/compressor.d.ts +2 -3
  81. package/lib/typescript/expo-plugin/compressor.d.ts.map +1 -0
  82. package/lib/typescript/index.d.ts +7 -3
  83. package/lib/typescript/index.d.ts.map +1 -0
  84. package/lib/typescript/utils/index.d.ts +6 -4
  85. package/lib/typescript/utils/index.d.ts.map +1 -0
  86. package/package.json +62 -38
  87. package/react-native-compressor.podspec +24 -1
  88. package/src/Audio/index.tsx +6 -4
  89. package/src/Image/index.tsx +38 -5
  90. package/src/Main.tsx +41 -0
  91. package/src/Spec/NativeCompressor.ts +15 -0
  92. package/src/Spec/NativeVideoCompressor.ts +14 -0
  93. package/src/Video/index.tsx +28 -11
  94. package/src/expo-plugin/compressor.ts +2 -1
  95. package/src/index.tsx +7 -2
  96. package/src/utils/index.tsx +11 -5
  97. package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
  98. package/android/.gradle/6.9/fileChanges/last-build.bin +0 -0
  99. package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
  100. package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
  101. package/android/.gradle/6.9/gc.properties +0 -0
  102. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  103. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  104. package/android/.gradle/checksums/checksums.lock +0 -0
  105. package/android/.gradle/checksums/md5-checksums.bin +0 -0
  106. package/android/.gradle/checksums/sha1-checksums.bin +0 -0
  107. package/android/.gradle/vcs-1/gc.properties +0 -0
  108. package/android/.idea/caches/build_file_checksums.ser +0 -0
  109. package/android/.idea/compiler.xml +0 -6
  110. package/android/.idea/gradle.xml +0 -20
  111. package/android/.idea/jarRepositories.xml +0 -45
  112. package/android/.idea/libraries/Gradle__androidx_annotation_annotation_1_1_0.xml +0 -13
  113. package/android/.idea/libraries/Gradle__androidx_appcompat_appcompat_1_0_2_aar.xml +0 -24
  114. package/android/.idea/libraries/Gradle__androidx_arch_core_core_common_2_0_0.xml +0 -11
  115. package/android/.idea/libraries/Gradle__androidx_arch_core_core_runtime_2_0_0_aar.xml +0 -19
  116. package/android/.idea/libraries/Gradle__androidx_asynclayoutinflater_asynclayoutinflater_1_0_0_aar.xml +0 -19
  117. package/android/.idea/libraries/Gradle__androidx_autofill_autofill_1_1_0_aar.xml +0 -16
  118. package/android/.idea/libraries/Gradle__androidx_collection_collection_1_0_0.xml +0 -11
  119. package/android/.idea/libraries/Gradle__androidx_coordinatorlayout_coordinatorlayout_1_0_0_aar.xml +0 -24
  120. package/android/.idea/libraries/Gradle__androidx_core_core_1_1_0_aar.xml +0 -16
  121. package/android/.idea/libraries/Gradle__androidx_cursoradapter_cursoradapter_1_0_0_aar.xml +0 -19
  122. package/android/.idea/libraries/Gradle__androidx_customview_customview_1_0_0_aar.xml +0 -19
  123. package/android/.idea/libraries/Gradle__androidx_documentfile_documentfile_1_0_0_aar.xml +0 -19
  124. package/android/.idea/libraries/Gradle__androidx_drawerlayout_drawerlayout_1_0_0_aar.xml +0 -24
  125. package/android/.idea/libraries/Gradle__androidx_fragment_fragment_1_0_0_aar.xml +0 -24
  126. package/android/.idea/libraries/Gradle__androidx_interpolator_interpolator_1_0_0_aar.xml +0 -19
  127. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_ui_1_0_0_aar.xml +0 -19
  128. package/android/.idea/libraries/Gradle__androidx_legacy_legacy_support_core_utils_1_0_0_aar.xml +0 -19
  129. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_common_2_0_0.xml +0 -11
  130. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_2_0_0_aar.xml +0 -19
  131. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_livedata_core_2_0_0_aar.xml +0 -19
  132. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_runtime_2_0_0_aar.xml +0 -19
  133. package/android/.idea/libraries/Gradle__androidx_lifecycle_lifecycle_viewmodel_2_0_0_aar.xml +0 -19
  134. package/android/.idea/libraries/Gradle__androidx_loader_loader_1_0_0_aar.xml +0 -19
  135. package/android/.idea/libraries/Gradle__androidx_localbroadcastmanager_localbroadcastmanager_1_0_0_aar.xml +0 -19
  136. package/android/.idea/libraries/Gradle__androidx_print_print_1_0_0_aar.xml +0 -24
  137. package/android/.idea/libraries/Gradle__androidx_slidingpanelayout_slidingpanelayout_1_0_0_aar.xml +0 -19
  138. package/android/.idea/libraries/Gradle__androidx_swiperefreshlayout_swiperefreshlayout_1_0_0_aar.xml +0 -24
  139. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_1_0_1_aar.xml +0 -19
  140. package/android/.idea/libraries/Gradle__androidx_vectordrawable_vectordrawable_animated_1_0_0_aar.xml +0 -19
  141. package/android/.idea/libraries/Gradle__androidx_versionedparcelable_versionedparcelable_1_1_0_aar.xml +0 -13
  142. package/android/.idea/libraries/Gradle__androidx_viewpager_viewpager_1_0_0_aar.xml +0 -19
  143. package/android/.idea/libraries/Gradle__com_facebook_fbjni_fbjni_java_only_0_2_2.xml +0 -13
  144. package/android/.idea/libraries/Gradle__com_facebook_fresco_drawee_2_5_0_aar.xml +0 -15
  145. package/android/.idea/libraries/Gradle__com_facebook_fresco_fbcore_2_5_0_aar.xml +0 -18
  146. package/android/.idea/libraries/Gradle__com_facebook_fresco_fresco_2_5_0_aar.xml +0 -18
  147. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_2_5_0_aar.xml +0 -18
  148. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_base_2_5_0_aar.xml +0 -18
  149. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_native_2_5_0_aar.xml +0 -15
  150. package/android/.idea/libraries/Gradle__com_facebook_fresco_imagepipeline_okhttp3_2_5_0_aar.xml +0 -15
  151. package/android/.idea/libraries/Gradle__com_facebook_fresco_memory_type_ashmem_2_5_0_aar.xml +0 -15
  152. package/android/.idea/libraries/Gradle__com_facebook_fresco_memory_type_java_2_5_0_aar.xml +0 -15
  153. package/android/.idea/libraries/Gradle__com_facebook_fresco_memory_type_native_2_5_0_aar.xml +0 -15
  154. package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagefilters_2_5_0_aar.xml +0 -15
  155. package/android/.idea/libraries/Gradle__com_facebook_fresco_nativeimagetranscoder_2_5_0_aar.xml +0 -15
  156. package/android/.idea/libraries/Gradle__com_facebook_fresco_ui_common_2_5_0_aar.xml +0 -15
  157. package/android/.idea/libraries/Gradle__com_facebook_infer_annotation_infer_annotation_0_18_0.xml +0 -13
  158. package/android/.idea/libraries/Gradle__com_facebook_react_react_native_0_66_1_aar.xml +0 -14
  159. package/android/.idea/libraries/Gradle__com_facebook_soloader_annotation_0_10_1.xml +0 -13
  160. package/android/.idea/libraries/Gradle__com_facebook_soloader_nativeloader_0_10_1.xml +0 -13
  161. package/android/.idea/libraries/Gradle__com_facebook_soloader_soloader_0_10_1_aar.xml +0 -15
  162. package/android/.idea/libraries/Gradle__com_facebook_yoga_proguard_annotations_1_19_0.xml +0 -13
  163. package/android/.idea/libraries/Gradle__com_google_code_findbugs_jsr305_3_0_2.xml +0 -13
  164. package/android/.idea/libraries/Gradle__com_googlecode_mp4parser_isoparser_1_0_6.xml +0 -13
  165. package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_4_9_1.xml +0 -13
  166. package/android/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_urlconnection_4_9_1.xml +0 -13
  167. package/android/.idea/libraries/Gradle__com_squareup_okio_okio_2_9_0.xml +0 -13
  168. package/android/.idea/libraries/Gradle__io_github_lizhangqu_coreprogress_1_0_2_aar.xml +0 -18
  169. package/android/.idea/libraries/Gradle__javax_inject_javax_inject_1.xml +0 -13
  170. package/android/.idea/libraries/Gradle__org_aspectj_aspectjrt_1_8_2.xml +0 -13
  171. package/android/.idea/libraries/Gradle__org_jetbrains_annotations_13_0.xml +0 -13
  172. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_annotations_jvm_1_3_72.xml +0 -13
  173. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_4_10.xml +0 -13
  174. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_common_1_4_10.xml +0 -13
  175. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk7_1_4_10.xml +0 -13
  176. package/android/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_jdk8_1_4_10.xml +0 -13
  177. package/android/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_android_1_4_0.xml +0 -13
  178. package/android/.idea/libraries/Gradle__org_jetbrains_kotlinx_kotlinx_coroutines_core_jvm_1_4_0.xml +0 -13
  179. package/android/.idea/misc.xml +0 -9
  180. package/android/.idea/modules/android.iml +0 -138
  181. package/android/.idea/modules.xml +0 -8
  182. package/android/.idea/vcs.xml +0 -6
  183. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  184. package/android/gradle/wrapper/gradle-wrapper.properties +0 -5
  185. package/android/gradlew +0 -183
  186. package/android/gradlew.bat +0 -100
  187. package/android/local.properties +0 -8
  188. package/ios/Compressor.m +0 -351
  189. package/ios/Compressor.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +0 -8
  190. package/ios/Compressor.xcodeproj/project.xcworkspace/xcuserdata/apple.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  191. package/ios/Compressor.xcodeproj/xcshareddata/xcschemes/Compressor.xcscheme +0 -67
  192. package/ios/Compressor.xcodeproj/xcuserdata/apple.xcuserdatad/xcschemes/xcschememanagement.plist +0 -22
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["Video","VideoCompressorType","backgroundUpload","Audio","Image","getDetails","uuidv4","generateFilePath","getRealPath","getVideoMetaData"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,mBAAhB,EAAqCC,gBAArC,QAA6D,SAA7D;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,SACEC,UADF,EAEEC,MAFF,EAGEC,gBAHF,EAIEC,WAJF,EAKEC,gBALF,QAMO,SANP;AAQA,SACET,KADF,EAEEG,KAFF,EAGEC,KAHF,EAIEF,gBAJF,CAKE;AALF,EAMED,mBANF,EAOEI,UAPF,EAQEC,MARF,EASEC,gBATF,EAUEC,WAVF,EAWEC,gBAXF;AAaA,eAAe;AACbT,EAAAA,KADa;AAEbG,EAAAA,KAFa;AAGbC,EAAAA,KAHa;AAIbF,EAAAA,gBAJa;AAKbG,EAAAA,UALa;AAMbC,EAAAA,MANa;AAObC,EAAAA,gBAPa;AAQbC,EAAAA,WARa;AASbC,EAAAA;AATa,CAAf","sourcesContent":["import Video, { VideoCompressorType, backgroundUpload } from './Video';\nimport Audio from './Audio';\nimport Image from './Image';\nimport {\n getDetails,\n uuidv4,\n generateFilePath,\n getRealPath,\n getVideoMetaData,\n} from './utils';\n\nexport {\n Video,\n Audio,\n Image,\n backgroundUpload,\n //type\n VideoCompressorType,\n getDetails,\n uuidv4,\n generateFilePath,\n getRealPath,\n getVideoMetaData,\n};\nexport default {\n Video,\n Audio,\n Image,\n backgroundUpload,\n getDetails,\n uuidv4,\n generateFilePath,\n getRealPath,\n getVideoMetaData,\n};\n"]}
1
+ {"version":3,"names":["Video","backgroundUpload","Audio","Image","getDetails","uuidv4","generateFilePath","getRealPath","getVideoMetaData","getFileSize"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,gBAAgB,QAAQ,SAAS;AAEjD,OAAOC,KAAK,MAAM,SAAS;AAC3B,OAAOC,KAAK,MAAM,SAAS;AAC3B,SACEC,UAAU,EACVC,MAAM,EACNC,gBAAgB,EAChBC,WAAW,EACXC,gBAAgB,EAChBC,WAAW,QACN,SAAS;AAEhB,SACET,KAAK,EACLE,KAAK,EACLC,KAAK,EACLF,gBAAgB;AAChB;;AAEAG,UAAU,EACVC,MAAM,EACNC,gBAAgB,EAChBC,WAAW,EACXC,gBAAgB,EAChBC,WAAW;AAGb,eAAe;EACbT,KAAK;EACLE,KAAK;EACLC,KAAK;EACLF,gBAAgB;EAChBG,UAAU;EACVC,MAAM;EACNC,gBAAgB;EAChBC,WAAW;EACXC,gBAAgB;EAChBC;AACF,CAAC"}
@@ -1,8 +1,5 @@
1
1
  /* eslint-disable no-bitwise */
2
- import { NativeModules } from 'react-native';
3
- const {
4
- Compressor
5
- } = NativeModules;
2
+ import { Compressor } from '../Main';
6
3
  export const AUDIO_BITRATE = [256, 192, 160, 128, 96, 64, 32];
7
4
  const INCORRECT_INPUT_PATH = 'Incorrect input path. Please provide a valid one';
8
5
  const INCORRECT_OUTPUT_PATH = 'Incorrect output path. Please provide a valid one';
@@ -17,70 +14,64 @@ export const generateFilePath = extension => {
17
14
  Compressor.generateFilePath(extension).then(result => resolve('file://' + result)).catch(error => reject(error));
18
15
  });
19
16
  };
20
- export const getRealPath = (path, type = 'video') => {
17
+ export const getRealPath = function (path) {
18
+ let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'video';
21
19
  return Compressor.getRealPath(path, type);
22
20
  };
23
21
  export const getVideoMetaData = path => {
24
22
  return Compressor.getVideoMetaData(path);
25
23
  };
26
-
27
24
  const isValidUrl = url => /^(?:\w+:)?\/\/([^\s\.]+\.\S{2}|localhost[\:?\d]*)\S*$/.test(url);
28
-
29
25
  const getFullFilename = path => {
30
26
  if (typeof path === 'string') {
31
- let _path = path; // In case of remote media, check if the url would be valid one
27
+ let _path = path;
32
28
 
29
+ // In case of remote media, check if the url would be valid one
33
30
  if (path.includes('http') && !isValidUrl(path)) {
34
31
  return INCORRECT_INPUT_PATH;
35
- } // In case of url, check if it ends with "/" and do not consider it furthermore
36
-
32
+ }
37
33
 
34
+ // In case of url, check if it ends with "/" and do not consider it furthermore
38
35
  if (_path[_path.length - 1] === '/') _path = _path.substring(0, path.length - 1);
39
-
40
36
  const array = _path.split('/');
41
-
42
37
  return array.length > 1 ? array[array.length - 1] : INCORRECT_INPUT_PATH;
43
38
  }
44
-
45
39
  return INCORRECT_INPUT_PATH;
46
40
  };
47
-
48
41
  const isFileNameError = filename => {
49
42
  return filename === INCORRECT_INPUT_PATH;
50
43
  };
51
-
52
44
  const getFilename = path => {
53
45
  const fullFilename = getFullFilename(path);
54
-
55
- if (!isFileNameError(fullFilename)) {
46
+ if (fullFilename && !isFileNameError(fullFilename)) {
56
47
  const array = fullFilename.split('.');
57
48
  return array.length > 1 ? array.slice(0, -1).join('') : array.join('');
58
49
  }
59
-
60
50
  return fullFilename;
61
51
  };
62
-
63
52
  const isRemoteMedia = path => {
64
- return typeof path === 'string' ? path.split(':/')[0].includes('http') : null;
53
+ var _path$split;
54
+ return typeof path === 'string' ? path === null || path === void 0 || (_path$split = path.split(':/')) === null || _path$split === void 0 || (_path$split = _path$split[0]) === null || _path$split === void 0 ? void 0 : _path$split.includes('http') : null;
65
55
  };
66
-
67
- export const getDetails = (mediaFullPath, extesnion = 'mp3') => {
56
+ export const getDetails = function (mediaFullPath) {
57
+ let extesnion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'mp3';
68
58
  return new Promise(async (resolve, reject) => {
69
59
  try {
70
60
  // Since we used "-v error", a work around is to call first this command before the following
71
61
  const result = {};
72
-
73
62
  if (result !== 0) {
74
63
  throw new Error('Failed to execute command');
75
- } // get the output result of the command
76
- // example of output {"programs": [], "streams": [{"width": 640,"height": 360}], "format": {"size": "15804433"}}
77
-
64
+ }
78
65
 
66
+ // get the output result of the command
67
+ // example of output {"programs": [], "streams": [{"width": 640,"height": 360}], "format": {"size": "15804433"}}
79
68
  let mediaInfo = await {};
80
- mediaInfo = JSON.parse(mediaInfo); // execute second command
69
+ mediaInfo = JSON.parse(mediaInfo);
81
70
 
82
- const mediaInformation = await {}; // treat both results
71
+ // execute second command
72
+ const mediaInformation = await {};
83
73
 
74
+ // treat both results
84
75
  mediaInformation.filename = getFilename(mediaFullPath);
85
76
  mediaInformation.bitrate = mediaInformation.getMediaProperties().bit_rate;
86
77
  mediaInformation.extension = extesnion;
@@ -96,15 +87,14 @@ export const checkUrlAndOptions = async (url, options) => {
96
87
  if (!url) {
97
88
  throw new Error('Compression url is empty, please provide a url for compression.');
98
89
  }
99
-
100
90
  const defaultResult = {
101
91
  outputFilePath: '',
102
92
  isCorrect: true,
103
93
  message: ''
104
- }; // Check if output file is correct
94
+ };
105
95
 
96
+ // Check if output file is correct
106
97
  let outputFilePath;
107
-
108
98
  try {
109
99
  // use default output file
110
100
  // or use new file from cache folder
@@ -115,7 +105,6 @@ export const checkUrlAndOptions = async (url, options) => {
115
105
  outputFilePath = await generateFilePath('mp3');
116
106
  defaultResult.outputFilePath = outputFilePath;
117
107
  }
118
-
119
108
  if (outputFilePath === undefined || outputFilePath === null) {
120
109
  defaultResult.isCorrect = false;
121
110
  defaultResult.message = options.outputFilePath ? INCORRECT_OUTPUT_PATH : ERROR_OCCUR_WHILE_GENERATING_OUTPUT_FILE;
@@ -127,11 +116,14 @@ export const checkUrlAndOptions = async (url, options) => {
127
116
  return defaultResult;
128
117
  }
129
118
  };
119
+ export const getFileSize = async filePath => {
120
+ return Compressor.getFileSize(filePath);
121
+ };
130
122
  export const uuidv4 = () => {
131
123
  return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
132
124
  const r = parseFloat('0.' + Math.random().toString().replace('0.', '') + new Date().getTime()) * 16 | 0,
133
- // eslint-disable-next-line eqeqeq
134
- v = c == 'x' ? r : r & 0x3 | 0x8;
125
+ // eslint-disable-next-line eqeqeq
126
+ v = c == 'x' ? r : r & 0x3 | 0x8;
135
127
  return v.toString(16);
136
128
  });
137
129
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["index.tsx"],"names":["NativeModules","Compressor","AUDIO_BITRATE","INCORRECT_INPUT_PATH","INCORRECT_OUTPUT_PATH","ERROR_OCCUR_WHILE_GENERATING_OUTPUT_FILE","DEFAULT_COMPRESS_AUDIO_OPTIONS","bitrate","quality","outputFilePath","generateFilePath","extension","Promise","resolve","reject","then","result","catch","error","getRealPath","path","type","getVideoMetaData","isValidUrl","url","test","getFullFilename","_path","includes","length","substring","array","split","isFileNameError","filename","getFilename","fullFilename","slice","join","isRemoteMedia","getDetails","mediaFullPath","extesnion","Error","mediaInfo","JSON","parse","mediaInformation","getMediaProperties","bit_rate","size","Number","format","e","checkUrlAndOptions","options","defaultResult","isCorrect","message","undefined","uuidv4","replace","c","r","parseFloat","Math","random","toString","Date","getTime","v"],"mappings":"AAAA;AACA,SAASA,aAAT,QAA8B,cAA9B;AACA,MAAM;AAAEC,EAAAA;AAAF,IAAiBD,aAAvB;AACA,OAAO,MAAME,aAAa,GAAG,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,EAAgB,GAAhB,EAAqB,EAArB,EAAyB,EAAzB,EAA6B,EAA7B,CAAtB;AAEP,MAAMC,oBAAoB,GAAG,kDAA7B;AACA,MAAMC,qBAAqB,GACzB,mDADF;AAEA,MAAMC,wCAAwC,GAC5C,6CADF;AAcA,OAAO,MAAMC,8BAAqD,GAAG;AACnEC,EAAAA,OAAO,EAAE,EAD0D;AAEnEC,EAAAA,OAAO,EAAE,QAF0D;AAGnEC,EAAAA,cAAc,EAAE;AAHmD,CAA9D;AAUP,OAAO,MAAMC,gBAAqB,GAAIC,SAAD,IAAuB;AAC1D,SAAO,IAAIC,OAAJ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AAa,CAACC,SAAd,GAA0B,KAA1B;AACAD,MAAAA,aAAa,CAACE,OAAd,GAAwBH,OAAO,CAAC9C,cAAR,GACpBL,qBADoB,GAEpBC,wCAFJ;AAGD;AACF,GAhBD,CAgBE,OAAOgD,CAAP,EAAU;AACVG,IAAAA,aAAa,CAACC,SAAd,GAA0B,KAA1B;AACAD,IAAAA,aAAa,CAACE,OAAd,GAAwBH,OAAO,CAAC9C,cAAR,GACpBL,qBADoB,GAEpBC,wCAFJ;AAGD,GArBD,SAqBU;AACR,WAAOmD,aAAP;AACD;AACF,CAzCM;AA2CP,OAAO,MAAMI,MAAM,GAAG,MAAM;AAC1B,SAAO,uCAAuCC,OAAvC,CAA+C,OAA/C,EAAwD,UAAUC,CAAV,EAAa;AAC1E,UAAMC,CAAC,GACFC,UAAU,CACT,OACEC,IAAI,CAACC,MAAL,GAAcC,QAAd,GAAyBN,OAAzB,CAAiC,IAAjC,EAAuC,EAAvC,CADF,GAEE,IAAIO,IAAJ,GAAWC,OAAX,EAHO,CAAV,GAKC,EALF,GAMA,CAPJ;AAAA,UAQE;AACAC,IAAAA,CAAC,GAAGR,CAAC,IAAI,GAAL,GAAWC,CAAX,GAAgBA,CAAC,GAAG,GAAL,GAAY,GATjC;AAUA,WAAOO,CAAC,CAACH,QAAF,CAAW,EAAX,CAAP;AACD,GAZM,CAAP;AAaD,CAdM","sourcesContent":["/* eslint-disable no-bitwise */\nimport { NativeModules } from 'react-native';\nconst { Compressor } = NativeModules;\nexport const AUDIO_BITRATE = [256, 192, 160, 128, 96, 64, 32];\ntype qualityType = 'low' | 'medium' | 'high';\nconst INCORRECT_INPUT_PATH = 'Incorrect input path. Please provide a valid one';\nconst INCORRECT_OUTPUT_PATH =\n 'Incorrect output path. Please provide a valid one';\nconst ERROR_OCCUR_WHILE_GENERATING_OUTPUT_FILE =\n 'An error occur while generating output file';\ntype audioCompresssionType = {\n bitrate?: number;\n quality: qualityType;\n outputFilePath?: string | undefined | null;\n};\n\nexport type defaultResultType = {\n outputFilePath: string | undefined | null;\n isCorrect: boolean;\n message: string;\n};\n\nexport const DEFAULT_COMPRESS_AUDIO_OPTIONS: audioCompresssionType = {\n bitrate: 96,\n quality: 'medium',\n outputFilePath: '',\n};\n\nexport type AudioType = {\n compress(value: string, options?: audioCompresssionType): Promise<string>;\n};\n\nexport const generateFilePath: any = (extension: string) => {\n return new Promise((resolve, reject) => {\n Compressor.generateFilePath(extension)\n .then((result: any) => resolve('file://' + result))\n .catch((error: any) => reject(error));\n });\n};\n\nexport const getRealPath: any = (\n path: string,\n type: 'video' | 'imaage' = 'video'\n) => {\n return Compressor.getRealPath(path, type);\n};\n\nexport const getVideoMetaData: any = (path: string) => {\n return Compressor.getVideoMetaData(path);\n};\n\nconst isValidUrl = (url: string) =>\n /^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$/.test(url);\n\nconst getFullFilename = (path: string | null) => {\n if (typeof path === 'string') {\n let _path = path;\n\n // In case of remote media, check if the url would be valid one\n if (path.includes('http') && !isValidUrl(path)) {\n return INCORRECT_INPUT_PATH;\n }\n\n // In case of url, check if it ends with \"/\" and do not consider it furthermore\n if (_path[_path.length - 1] === '/')\n _path = _path.substring(0, path.length - 1);\n\n const array = _path.split('/');\n return array.length > 1 ? array[array.length - 1] : INCORRECT_INPUT_PATH;\n }\n return INCORRECT_INPUT_PATH;\n};\n\nconst isFileNameError = (filename: string) => {\n return filename === INCORRECT_INPUT_PATH;\n};\n\nconst getFilename = (path: string | null) => {\n const fullFilename = getFullFilename(path);\n if (!isFileNameError(fullFilename)) {\n const array = fullFilename.split('.');\n return array.length > 1 ? array.slice(0, -1).join('') : array.join('');\n }\n return fullFilename;\n};\n\nconst isRemoteMedia = (path: string | null) => {\n return typeof path === 'string' ? path.split(':/')[0].includes('http') : null;\n};\n\nexport const getDetails = (\n mediaFullPath: string,\n extesnion: 'mp3' | 'mp4' = 'mp3'\n): Promise<any | null> => {\n return new Promise(async (resolve, reject) => {\n try {\n // Since we used \"-v error\", a work around is to call first this command before the following\n const result: any = {};\n if (result !== 0) {\n throw new Error('Failed to execute command');\n }\n\n // get the output result of the command\n // example of output {\"programs\": [], \"streams\": [{\"width\": 640,\"height\": 360}], \"format\": {\"size\": \"15804433\"}}\n let mediaInfo: any = await {};\n mediaInfo = JSON.parse(mediaInfo);\n\n // execute second command\n const mediaInformation: any = await {};\n\n // treat both results\n mediaInformation.filename = getFilename(mediaFullPath);\n mediaInformation.bitrate = mediaInformation.getMediaProperties().bit_rate;\n mediaInformation.extension = extesnion;\n mediaInformation.isRemoteMedia = isRemoteMedia(mediaFullPath);\n mediaInformation.size = Number(mediaInfo.format.size);\n\n resolve(mediaInformation);\n } catch (e) {\n reject(e);\n }\n });\n};\n\nexport const checkUrlAndOptions = async (\n url: string,\n options: audioCompresssionType\n): Promise<defaultResultType> => {\n if (!url) {\n throw new Error(\n 'Compression url is empty, please provide a url for compression.'\n );\n }\n const defaultResult: defaultResultType = {\n outputFilePath: '',\n isCorrect: true,\n message: '',\n };\n\n // Check if output file is correct\n let outputFilePath: string | undefined | null;\n try {\n // use default output file\n // or use new file from cache folder\n if (options.outputFilePath) {\n outputFilePath = options.outputFilePath;\n defaultResult.outputFilePath = outputFilePath;\n } else {\n outputFilePath = await generateFilePath('mp3');\n defaultResult.outputFilePath = outputFilePath;\n }\n if (outputFilePath === undefined || outputFilePath === null) {\n defaultResult.isCorrect = false;\n defaultResult.message = options.outputFilePath\n ? INCORRECT_OUTPUT_PATH\n : ERROR_OCCUR_WHILE_GENERATING_OUTPUT_FILE;\n }\n } catch (e) {\n defaultResult.isCorrect = false;\n defaultResult.message = options.outputFilePath\n ? INCORRECT_OUTPUT_PATH\n : ERROR_OCCUR_WHILE_GENERATING_OUTPUT_FILE;\n } finally {\n return defaultResult;\n }\n};\n\nexport const uuidv4 = () => {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n const r =\n (parseFloat(\n '0.' +\n Math.random().toString().replace('0.', '') +\n new Date().getTime()\n ) *\n 16) |\n 0,\n // eslint-disable-next-line eqeqeq\n v = c == 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n};\n"]}
1
+ {"version":3,"names":["Compressor","AUDIO_BITRATE","INCORRECT_INPUT_PATH","INCORRECT_OUTPUT_PATH","ERROR_OCCUR_WHILE_GENERATING_OUTPUT_FILE","DEFAULT_COMPRESS_AUDIO_OPTIONS","bitrate","quality","outputFilePath","generateFilePath","extension","Promise","resolve","reject","then","result","catch","error","getRealPath","path","type","arguments","length","undefined","getVideoMetaData","isValidUrl","url","test","getFullFilename","_path","includes","substring","array","split","isFileNameError","filename","getFilename","fullFilename","slice","join","isRemoteMedia","_path$split","getDetails","mediaFullPath","extesnion","Error","mediaInfo","JSON","parse","mediaInformation","getMediaProperties","bit_rate","size","Number","format","e","checkUrlAndOptions","options","defaultResult","isCorrect","message","getFileSize","filePath","uuidv4","replace","c","r","parseFloat","Math","random","toString","Date","getTime","v"],"sourceRoot":"../../../src","sources":["utils/index.tsx"],"mappings":"AAAA;AACA,SAASA,UAAU,QAAQ,SAAS;AAEpC,OAAO,MAAMC,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAE7D,MAAMC,oBAAoB,GAAG,kDAAkD;AAC/E,MAAMC,qBAAqB,GACzB,mDAAmD;AACrD,MAAMC,wCAAwC,GAC5C,6CAA6C;AAa/C,OAAO,MAAMC,8BAAqD,GAAG;EACnEC,OAAO,EAAE,EAAE;EACXC,OAAO,EAAE,QAAQ;EACjBC,cAAc,EAAE;AAClB,CAAC;AAMD,OAAO,MAAMC,gBAAqB,GAAIC,SAAiB,IAAK;EAC1D,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCb,UAAU,CAACS,gBAAgB,CAACC,SAAS,CAAC,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e,SAAS,IAAIf,cAAc,KAAK,IAAI,EAAE;MAC3DkD,aAAa,CAACC,SAAS,GAAG,KAAK;MAC/BD,aAAa,CAACE,OAAO,GAAGH,OAAO,CAACjD,cAAc,GAC1CL,qBAAqB,GACrBC,wCAAwC;IAC9C;EACF,CAAC,CAAC,OAAOmD,CAAC,EAAE;IACVG,aAAa,CAACC,SAAS,GAAG,KAAK;IAC/BD,aAAa,CAACE,OAAO,GAAGH,OAAO,CAACjD,cAAc,GAC1CL,qBAAqB,GACrBC,wCAAwC;EAC9C,CAAC,SAAS;IACR,OAAOsD,aAAa;EACtB;AACF,CAAC;AAED,OAAO,MAAMG,WAAW,GAAG,MAAOC,QAAgB,IAAsB;EACtE,OAAO9D,UAAU,CAAC6D,WAAW,CAACC,QAAQ,CAAC;AACzC,CAAC;AAED,OAAO,MAAMC,MAAM,GAAGA,CAAA,KAAM;EAC1B,OAAO,sCAAsC,CAACC,OAAO,CAAC,OAAO,EAAE,UAAUC,CAAC,EAAE;IAC1E,MAAMC,CAAC,GACFC,UAAU,CACT,IAAI,GACFC,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,CAAC,CAACN,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAC1C,IAAIO,IAAI,CAAC,CAAC,CAACC,OAAO,CAAC,CACvB,CAAC,GACC,EAAE,GACJ,CAAC;MACH;MACAC,CAAC,GAAGR,CAAC,IAAI,GAAG,GAAGC,CAAC,GAAIA,CAAC,GAAG,GAAG,GAAI,GAAG;IACpC,OAAOO,CAAC,CAACH,QAAQ,CAAC,EAAE,CAAC;EACvB,CAAC,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
- import { AudioType } from '../utils';
1
+ import type { AudioType } from '../utils';
2
2
  declare const Audio: AudioType;
3
3
  export default Audio;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Audio/index.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAqB,MAAM,UAAU,CAAC;AAG7D,QAAA,MAAM,KAAK,EAAE,SAyDZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -1,8 +1,8 @@
1
- export declare type InputType = 'base64' | 'uri';
2
- export declare type OutputType = 'jpg' | 'png';
3
- export declare type ReturnableOutputType = 'uri' | 'base64';
4
- export declare type compressionMethod = 'auto' | 'manual';
5
- export declare type CompressorOptions = {
1
+ export type InputType = 'base64' | 'uri';
2
+ export type OutputType = 'jpg' | 'png';
3
+ export type ReturnableOutputType = 'uri' | 'base64';
4
+ export type compressionMethod = 'auto' | 'manual';
5
+ export type CompressorOptions = {
6
6
  /***
7
7
  * The maximum width boundary used when compressing a landscape image.
8
8
  */
@@ -31,9 +31,14 @@ export declare type CompressorOptions = {
31
31
  * The output that will return to user.
32
32
  */
33
33
  returnableOutputType?: ReturnableOutputType;
34
+ /***
35
+ * it is callback, only trigger when we pass image url from server
36
+ */
37
+ downloadProgress?: (progress: number) => void;
34
38
  };
35
- declare type ImageType = {
39
+ type ImageType = {
36
40
  compress(value: string, options?: CompressorOptions): Promise<string>;
37
41
  };
38
42
  declare const Image: ImageType;
39
43
  export default Image;
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Image/index.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,KAAK,CAAC;AAEzC,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,KAAK,CAAC;AAEvC,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,iBAAiB,GAAG;IAC9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C;;OAEG;IACH,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAMF,KAAK,SAAS,GAAG;IACf,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvE,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,SAkCZ,CAAC;AAEF,eAAe,KAAK,CAAC"}
@@ -0,0 +1,4 @@
1
+ declare const Compressor: any;
2
+ declare const VideoCompressor: any;
3
+ export { Compressor, VideoCompressor };
4
+ //# sourceMappingURL=Main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Main.d.ts","sourceRoot":"","sources":["../../src/Main.tsx"],"names":[],"mappings":"AAkBA,QAAA,MAAM,UAAU,KASX,CAAC;AAEN,QAAA,MAAM,eAAe,KAShB,CAAC;AAEN,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ image_compress(imagePath: string, optionMap: Object): Promise<string>;
4
+ compress_audio(fileUrl: string, optionMap: Object): Promise<string>;
5
+ generateFilePath(extension: string): Promise<string>;
6
+ getRealPath(path: string, type: string): Promise<string>;
7
+ getVideoMetaData(filePath: string): Promise<string>;
8
+ getFileSize(filePath: string): Promise<string>;
9
+ addListener(eventName: string): void;
10
+ removeListeners(count: number): void;
11
+ }
12
+ declare const _default: Spec;
13
+ export default _default;
14
+ //# sourceMappingURL=NativeCompressor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeCompressor.d.ts","sourceRoot":"","sources":["../../../src/Spec/NativeCompressor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtE,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpE,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACpD,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/C,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;;AAED,wBAAoE"}
@@ -0,0 +1,13 @@
1
+ import type { TurboModule } from 'react-native';
2
+ export interface Spec extends TurboModule {
3
+ compress(fileUrl: string, optionMap: Object): Promise<string>;
4
+ cancelCompression(uuid: string): void;
5
+ upload(fileUrl: string, options: Object): Promise<string>;
6
+ activateBackgroundTask(options: Object): Promise<string>;
7
+ deactivateBackgroundTask(options: Object): Promise<string>;
8
+ addListener(eventName: string): void;
9
+ removeListeners(count: number): void;
10
+ }
11
+ declare const _default: Spec;
12
+ export default _default;
13
+ //# sourceMappingURL=NativeVideoCompressor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeVideoCompressor.d.ts","sourceRoot":"","sources":["../../../src/Spec/NativeVideoCompressor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9D,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1D,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3D,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;;AAED,wBAAyE"}
@@ -3,13 +3,14 @@ export declare enum FileSystemUploadType {
3
3
  MULTIPART = 1
4
4
  }
5
5
  export declare type FileSystemAcceptedUploadHttpMethod = 'POST' | 'PUT' | 'PATCH';
6
- export declare type compressionMethod = 'auto' | 'manual';
7
- declare type videoCompresssionType = {
6
+ export type compressionMethod = 'auto' | 'manual';
7
+ type videoCompresssionType = {
8
8
  bitrate?: number;
9
9
  maxSize?: number;
10
10
  compressionMethod?: compressionMethod;
11
11
  minimumFileSizeForCompress?: number;
12
12
  getCancellationId?: (cancellationId: string) => void;
13
+ downloadProgress?: (progress: number) => void;
13
14
  };
14
15
  export declare enum FileSystemSessionType {
15
16
  BACKGROUND = 0,
@@ -32,7 +33,7 @@ export declare type FileSystemUploadOptions = ({
32
33
  httpMethod?: FileSystemAcceptedUploadHttpMethod;
33
34
  sessionType?: FileSystemSessionType;
34
35
  };
35
- export declare type VideoCompressorType = {
36
+ export type VideoCompressorType = {
36
37
  compress(fileUrl: string, options?: videoCompresssionType, onProgress?: (progress: number) => void): Promise<string>;
37
38
  cancelCompression(cancellationId: string): void;
38
39
  backgroundUpload(url: string, fileUrl: string, options: FileSystemUploadOptions, onProgress?: (writtem: number, total: number) => void): Promise<any>;
@@ -43,3 +44,4 @@ export declare const backgroundUpload: (url: string, fileUrl: string, options: F
43
44
  export declare const cancelCompression: (cancellationId: string) => any;
44
45
  declare const Video: VideoCompressorType;
45
46
  export default Video;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Video/index.tsx"],"names":[],"mappings":"AAKA,MAAM,CAAC,OAAO,MAAM,oBAAoB;IACtC,cAAc,IAAI;IAClB,SAAS,IAAI;CACd;AAED,MAAM,CAAC,OAAO,MAAM,kCAAkC,GAClD,MAAM,GACN,KAAK,GACL,OAAO,CAAC;AACZ,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAClD,KAAK,qBAAqB,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,iBAAiB,CAAC,EAAE,CAAC,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,CAAC;AAEF,MAAM,CAAC,OAAO,MAAM,qBAAqB;IACvC,UAAU,IAAI;IACd,UAAU,IAAI;CACf;AAED,MAAM,CAAC,OAAO,MAAM,YAAY,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAA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,0BACT,MAAM,SAAS,MAAM,KAAK,IAAI,kBACpD,QAAQ,GAAG,CA8Bb,CAAC;AAEF,eAAO,MAAM,iBAAiB,mBAAoB,MAAM,QAEvD,CAAC;AAEF,QAAA,MAAM,KAAK,EAAE,mBAkGW,CAAC;AAEzB,eAAe,KAAK,CAAC"}
@@ -1,4 +1,3 @@
1
- import { ConfigPlugin } from '@expo/config-plugins';
2
- declare type Props = {};
3
- declare const _default: ConfigPlugin<Props>;
1
+ declare const _default: any;
4
2
  export default _default;
3
+ //# sourceMappingURL=compressor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compressor.d.ts","sourceRoot":"","sources":["../../../src/expo-plugin/compressor.ts"],"names":[],"mappings":";AAQA,wBAA0E"}
@@ -1,8 +1,10 @@
1
- import Video, { VideoCompressorType, backgroundUpload } from './Video';
1
+ import Video, { backgroundUpload } from './Video';
2
+ import type { VideoCompressorType } from './Video';
2
3
  import Audio from './Audio';
3
4
  import Image from './Image';
4
- import { getDetails, uuidv4, generateFilePath, getRealPath, getVideoMetaData } from './utils';
5
- export { Video, Audio, Image, backgroundUpload, VideoCompressorType, getDetails, uuidv4, generateFilePath, getRealPath, getVideoMetaData, };
5
+ import { getDetails, uuidv4, generateFilePath, getRealPath, getVideoMetaData, getFileSize } from './utils';
6
+ export { Video, Audio, Image, backgroundUpload, getDetails, uuidv4, generateFilePath, getRealPath, getVideoMetaData, getFileSize, };
7
+ export type { VideoCompressorType };
6
8
  declare const _default: {
7
9
  Video: VideoCompressorType;
8
10
  Audio: import("./utils").AudioType;
@@ -15,5 +17,7 @@ declare const _default: {
15
17
  generateFilePath: any;
16
18
  getRealPath: any;
17
19
  getVideoMetaData: any;
20
+ getFileSize: (filePath: string) => Promise<string>;
18
21
  };
19
22
  export default _default;
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,KAAK,EACL,KAAK,EACL,KAAK,EACL,gBAAgB,EAGhB,UAAU,EACV,MAAM,EACN,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,WAAW,GACZ,CAAC;AACF,YAAY,EAAE,mBAAmB,EAAE,CAAC;;;;;;;;;;;;;;;AACpC,wBAWE"}
@@ -1,17 +1,17 @@
1
1
  export declare const AUDIO_BITRATE: number[];
2
- declare type qualityType = 'low' | 'medium' | 'high';
3
- declare type audioCompresssionType = {
2
+ type qualityType = 'low' | 'medium' | 'high';
3
+ type audioCompresssionType = {
4
4
  bitrate?: number;
5
5
  quality: qualityType;
6
6
  outputFilePath?: string | undefined | null;
7
7
  };
8
- export declare type defaultResultType = {
8
+ export type defaultResultType = {
9
9
  outputFilePath: string | undefined | null;
10
10
  isCorrect: boolean;
11
11
  message: string;
12
12
  };
13
13
  export declare const DEFAULT_COMPRESS_AUDIO_OPTIONS: audioCompresssionType;
14
- export declare type AudioType = {
14
+ export type AudioType = {
15
15
  compress(value: string, options?: audioCompresssionType): Promise<string>;
16
16
  };
17
17
  export declare const generateFilePath: any;
@@ -19,5 +19,7 @@ export declare const getRealPath: any;
19
19
  export declare const getVideoMetaData: any;
20
20
  export declare const getDetails: (mediaFullPath: string, extesnion?: 'mp3' | 'mp4') => Promise<any | null>;
21
21
  export declare const checkUrlAndOptions: (url: string, options: audioCompresssionType) => Promise<defaultResultType>;
22
+ export declare const getFileSize: (filePath: string) => Promise<string>;
22
23
  export declare const uuidv4: () => string;
23
24
  export {};
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,UAAmC,CAAC;AAC9D,KAAK,WAAW,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAM7C,KAAK,qBAAqB,GAAG;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,WAAW,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC;IAC1C,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,8BAA8B,EAAE,qBAI5C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3E,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,GAM9B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,GAKzB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,GAE9B,CAAC;AA2CF,eAAO,MAAM,UAAU,kBACN,MAAM,cACV,KAAK,GAAG,KAAK,KACvB,QAAQ,GAAG,GAAG,IAAI,CA6BpB,CAAC;AAEF,eAAO,MAAM,kBAAkB,QACxB,MAAM,WACF,qBAAqB,KAC7B,QAAQ,iBAAiB,CAsC3B,CAAC;AAEF,eAAO,MAAM,WAAW,aAAoB,MAAM,KAAG,QAAQ,MAAM,CAElE,CAAC;AAEF,eAAO,MAAM,MAAM,cAclB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-compressor",
3
- "version": "1.6.4",
3
+ "version": "1.7.1",
4
4
  "description": "This library compress image, video and audio",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -14,23 +14,30 @@
14
14
  "ios",
15
15
  "cpp",
16
16
  "app.plugin.js",
17
- "react-native-compressor.podspec",
17
+ "*.podspec",
18
18
  "!lib/typescript/example",
19
- "!android/build",
20
19
  "!ios/build",
20
+ "!android/build",
21
+ "!android/gradle",
22
+ "!android/gradlew",
23
+ "!android/gradlew.bat",
24
+ "!android/local.properties",
21
25
  "!**/__tests__",
22
26
  "!**/__fixtures__",
23
- "!**/__mocks__"
27
+ "!**/__mocks__",
28
+ "!**/.*"
24
29
  ],
25
30
  "scripts": {
26
31
  "test": "jest",
27
- "typescript": "tsc --noEmit",
32
+ "typecheck": "tsc --noEmit",
28
33
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
29
- "prepare": "bob build",
34
+ "prepack": "bob build",
30
35
  "release": "release-it",
31
36
  "example": "yarn --cwd example",
32
- "pods": "cd example && pod-install --quiet",
33
- "bootstrap": "yarn example && yarn && yarn pods"
37
+ "build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
38
+ "build:ios": "cd example/ios && xcodebuild -workspace CompressorExample.xcworkspace -scheme CompressorExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO",
39
+ "bootstrap": "yarn example && yarn install && yarn example pods-newarch",
40
+ "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build"
34
41
  },
35
42
  "keywords": [
36
43
  "react-native",
@@ -46,45 +53,54 @@
46
53
  "compress-videos",
47
54
  "react-native-compress",
48
55
  "react-native-compressor",
49
- "compress-audio"
56
+ "compress-audio",
57
+ "whatsapp",
58
+ "compressor"
50
59
  ],
51
- "repository": "https://github.com/Shobbak/react-native-compressor",
52
- "author": "shobbak <github@onshobbak.com> (https://github.com/Shobbak)",
60
+ "repository": "https://github.com/numandev1/react-native-compressor",
61
+ "author": "numandev1 <muhammadnuman70@gmail.com> (https://github.com/numandev1)",
53
62
  "license": "MIT",
54
63
  "bugs": {
55
- "url": "https://github.com/Shobbak/react-native-compressor/issues"
64
+ "url": "https://github.com/numandev1/react-native-compressor/issues"
56
65
  },
57
- "homepage": "https://github.com/Shobbak/react-native-compressor#readme",
66
+ "homepage": "https://github.com/numandev1/react-native-compressor#readme",
58
67
  "publishConfig": {
59
68
  "registry": "https://registry.npmjs.org/"
60
69
  },
61
70
  "devDependencies": {
62
- "@commitlint/config-conventional": "^11.0.0",
63
- "@expo/config-plugins": "^4.0.14",
64
- "@jamesacarr/eslint-formatter-github-actions": "^0.1.0",
65
- "@react-native-community/eslint-config": "^2.0.0",
66
- "@release-it/conventional-changelog": "^2.0.0",
67
- "@types/jest": "^26.0.0",
68
- "@types/react": "^17.0.8",
69
- "@types/react-native": "^0.64.7",
70
- "commitlint": "^11.0.0",
71
- "eslint": "^7.2.0",
72
- "eslint-config-prettier": "^7.0.0",
73
- "eslint-plugin-prettier": "^3.1.3",
74
- "husky": "^4.2.5",
75
- "jest": "^26.0.1",
71
+ "@commitlint/config-conventional": "^17.0.2",
72
+ "@evilmartians/lefthook": "^1.2.2",
73
+ "@react-native-community/eslint-config": "^3.0.2",
74
+ "@release-it/conventional-changelog": "^5.0.0",
75
+ "@types/jest": "^28.1.2",
76
+ "@types/react": "~17.0.21",
77
+ "@types/react-native": "0.70.0",
78
+ "commitlint": "^17.0.2",
79
+ "del-cli": "^5.0.0",
80
+ "eslint": "^8.4.1",
81
+ "eslint-config-prettier": "^8.5.0",
82
+ "eslint-plugin-prettier": "^4.0.0",
83
+ "jest": "^28.1.1",
76
84
  "pod-install": "^0.1.0",
77
85
  "prettier": "^2.0.5",
78
- "react": "^17.0.2",
79
- "react-native": "^0.66.1",
80
- "react-native-builder-bob": "^0.18.0",
81
- "release-it": "^14.2.2",
82
- "typescript": "^4.1.3"
86
+ "react": "18.2.0",
87
+ "react-native": "0.72.4",
88
+ "react-native-builder-bob": "^0.20.0",
89
+ "release-it": "^15.0.0",
90
+ "turbo": "^1.10.7",
91
+ "typescript": "^5.0.2"
92
+ },
93
+ "resolutions": {
94
+ "@types/react": "17.0.21"
83
95
  },
84
96
  "peerDependencies": {
85
97
  "react": "*",
86
98
  "react-native": "*"
87
99
  },
100
+ "engines": {
101
+ "node": ">= 16.0.0"
102
+ },
103
+ "packageManager": "^yarn@1.22.15",
88
104
  "jest": {
89
105
  "preset": "react-native",
90
106
  "modulePathIgnorePatterns": [
@@ -92,12 +108,6 @@
92
108
  "<rootDir>/lib/"
93
109
  ]
94
110
  },
95
- "husky": {
96
- "hooks": {
97
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
98
- "pre-commit": "yarn lint && yarn typescript"
99
- }
100
- },
101
111
  "commitlint": {
102
112
  "extends": [
103
113
  "@commitlint/config-conventional"
@@ -163,5 +173,19 @@
163
173
  }
164
174
  ]
165
175
  ]
176
+ },
177
+ "codegenConfig": {
178
+ "libraries": [
179
+ {
180
+ "name": "RNCompressorSpec",
181
+ "type": "modules",
182
+ "jsSrcsDir": "src"
183
+ },
184
+ {
185
+ "name": "RNVideoCompressorSpec",
186
+ "type": "modules",
187
+ "jsSrcsDir": "src"
188
+ }
189
+ ]
166
190
  }
167
191
  }
@@ -1,6 +1,7 @@
1
1
  require "json"
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
4
5
 
5
6
  Pod::Spec.new do |s|
6
7
  s.name = "react-native-compressor"
@@ -11,10 +12,32 @@ Pod::Spec.new do |s|
11
12
  s.authors = package["author"]
12
13
 
13
14
  s.platforms = { :ios => "11.0" }
14
- s.source = { :git => "https://github.com/Shobbak/react-native-compressor.git", :tag => "#{s.version}" }
15
+ s.source = { :git => "https://github.com/numandev1/react-native-compressor.git", :tag => "#{s.version}" }
15
16
 
16
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
17
18
 
18
19
  s.dependency "React-Core"
19
20
  s.dependency "NextLevelSessionExporter"
21
+ # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
+ # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
23
+ if respond_to?(:install_modules_dependencies, true)
24
+ install_modules_dependencies(s)
25
+ else
26
+ s.dependency "React-Core"
27
+
28
+ # Don't install the dependencies when we run `pod install` in the old architecture.
29
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
30
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
31
+ s.pod_target_xcconfig = {
32
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
33
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
34
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
35
+ }
36
+ s.dependency "React-Codegen"
37
+ s.dependency "RCT-Folly"
38
+ s.dependency "RCTRequired"
39
+ s.dependency "RCTTypeSafety"
40
+ s.dependency "ReactCommon/turbomodule/core"
41
+ end
42
+ end
20
43
  end