react-native-compressor 1.7.1 → 1.7.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 +10 -8
- package/ios/Video/VideoCompressor.swift +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,8 +84,8 @@ yarn add react-native-compressor
|
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
### [New Architecture (Turbo Module)](https://reactnative.dev/docs/new-architecture-intro) Supported
|
|
87
|
-
you can give feedback on [Discord channel](https://discord.gg/dtYzk8sp)
|
|
88
87
|
|
|
88
|
+
you can give feedback on [Discord channel](https://discord.gg/dtYzk8sp)
|
|
89
89
|
|
|
90
90
|
### Managed Expo
|
|
91
91
|
|
|
@@ -163,10 +163,10 @@ import { Image } from 'react-native-compressor';
|
|
|
163
163
|
|
|
164
164
|
const result = await Image.compress('file://path_of_file/image.jpg');
|
|
165
165
|
// OR
|
|
166
|
-
const result = await Image.compress('https://path_of_file/image.jpg',{
|
|
166
|
+
const result = await Image.compress('https://path_of_file/image.jpg', {
|
|
167
167
|
downloadProgress: (progress) => {
|
|
168
168
|
console.log('downloadProgress: ', progress);
|
|
169
|
-
}
|
|
169
|
+
},
|
|
170
170
|
});
|
|
171
171
|
```
|
|
172
172
|
|
|
@@ -195,7 +195,7 @@ const result = await Video.compress(
|
|
|
195
195
|
'file://path_of_file/BigBuckBunny.mp4',
|
|
196
196
|
{},
|
|
197
197
|
(progress) => {
|
|
198
|
-
|
|
198
|
+
console.log('Compression Progress: ', progress);
|
|
199
199
|
}
|
|
200
200
|
);
|
|
201
201
|
|
|
@@ -206,10 +206,10 @@ const result = await Video.compress(
|
|
|
206
206
|
{
|
|
207
207
|
downloadProgress: (progress) => {
|
|
208
208
|
console.log('downloadProgress: ', progress);
|
|
209
|
-
}
|
|
209
|
+
},
|
|
210
210
|
},
|
|
211
211
|
(progress) => {
|
|
212
|
-
|
|
212
|
+
console.log('Compression Progress: ', progress);
|
|
213
213
|
}
|
|
214
214
|
);
|
|
215
215
|
```
|
|
@@ -227,7 +227,7 @@ const result = await Video.compress(
|
|
|
227
227
|
compressionMethod: 'manual',
|
|
228
228
|
},
|
|
229
229
|
(progress) => {
|
|
230
|
-
|
|
230
|
+
console.log('Compression Progress: ', progress);
|
|
231
231
|
}
|
|
232
232
|
);
|
|
233
233
|
```
|
|
@@ -305,6 +305,7 @@ const uploadResult = await backgroundUpload(
|
|
|
305
305
|
if you want to compress images like **whatsapp** then make this prop `auto`. Can be either `manual` or `auto`, defines the Compression Method.
|
|
306
306
|
|
|
307
307
|
- ##### `downloadProgress?: (progress: number) => void;`
|
|
308
|
+
|
|
308
309
|
it is callback, only trigger when we pass image url from server
|
|
309
310
|
|
|
310
311
|
- ###### `maxWidth: number` (default: 1280)
|
|
@@ -344,13 +345,14 @@ const uploadResult = await backgroundUpload(
|
|
|
344
345
|
if you want to compress videos like **whatsapp** then make this prop `auto`. Can be either `manual` or `auto`, defines the Compression Method.
|
|
345
346
|
|
|
346
347
|
- ##### `downloadProgress?: (progress: number) => void;`
|
|
348
|
+
|
|
347
349
|
it is callback, only trigger when we pass image url from server
|
|
348
350
|
|
|
349
351
|
- ###### `maxSize: number` (default: 640)
|
|
350
352
|
|
|
351
353
|
The maximum size can be height in case of portrait video or can be width in case of landscape video.
|
|
352
354
|
|
|
353
|
-
- ###### `bitrate:
|
|
355
|
+
- ###### `bitrate: number`
|
|
354
356
|
|
|
355
357
|
bitrate of video which reduce or increase video size. if compressionMethod will auto then this prop will not work
|
|
356
358
|
|
|
@@ -223,7 +223,7 @@ func makeValidUri(filePath: String) -> String {
|
|
|
223
223
|
}
|
|
224
224
|
if(fileSize>minimumFileSizeForCompress)
|
|
225
225
|
{
|
|
226
|
-
if(options["compressionMethod"] as! String=="
|
|
226
|
+
if(options["compressionMethod"] as! String=="auto")
|
|
227
227
|
{
|
|
228
228
|
self.autoCompressionHelper(url: videoURL!, options:options) { progress in
|
|
229
229
|
onProgress(progress)
|