react-native-compressor 1.10.3 → 1.10.5

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.
@@ -258,10 +258,7 @@ class Track(id: Int, format: MediaFormat, audio: Boolean) {
258
258
  }
259
259
 
260
260
  private fun AudioSampleEntry.setup(format: MediaFormat): AudioSampleEntry = apply {
261
- channelCount =
262
- if (format.getInteger(MediaFormat.KEY_CHANNEL_COUNT) == 1) 2 else format.getInteger(
263
- MediaFormat.KEY_CHANNEL_COUNT
264
- )
261
+ channelCount = format.getInteger(MediaFormat.KEY_CHANNEL_COUNT)
265
262
  sampleRate = format.getInteger(MediaFormat.KEY_SAMPLE_RATE).toLong()
266
263
  dataReferenceIndex = 1
267
264
  sampleSize = 16
@@ -110,20 +110,24 @@ class Utils {
110
110
  static func getfileSizeInBytes(forURL url: Any) -> Double {
111
111
  var fileURL: URL?
112
112
  var fileSize: Double = 0.0
113
- if (url is URL) || (url is String)
114
- {
115
- if (url is URL) {
116
- fileURL = url as? URL
117
- }
118
- else {
119
- fileURL = URL(fileURLWithPath: url as! String)
120
- }
121
- var fileSizeValue = 0.0
122
- try? fileSizeValue = (fileURL?.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).allValues.first?.value as! Double?)!
123
- if fileSizeValue > 0.0 {
124
- fileSize = Double(fileSizeValue)
125
- }
113
+
114
+ if (url is URL) {
115
+ let urlWithSlash = Utils.slashifyFilePath(path: (url as? URL)?.absoluteString)
116
+ fileURL = URL(string: urlWithSlash!)
117
+ } else if (url is String) {
118
+ let urlWithSlash = Utils.slashifyFilePath(path: url as? String)
119
+ fileURL = URL(fileURLWithPath: urlWithSlash!)
120
+ } else {
121
+ return fileSize
122
+ }
123
+
124
+ var fileSizeValue = 0.0
125
+
126
+ try? fileSizeValue = (fileURL?.resourceValues(forKeys: [URLResourceKey.fileSizeKey]).allValues.first?.value as! Double?)!
127
+ if fileSizeValue > 0.0 {
128
+ fileSize = Double(fileSizeValue)
126
129
  }
130
+
127
131
  return fileSize
128
132
  }
129
133
 
@@ -4,7 +4,7 @@ export type ReturnableOutputType = 'uri' | 'base64';
4
4
  export type compressionMethod = 'auto' | 'manual';
5
5
  export type CompressorOptions = {
6
6
  /***
7
- * The maximum width boundary used when compressing a landscape image.
7
+ * The compression method to use.
8
8
  */
9
9
  compressionMethod?: compressionMethod;
10
10
  /***
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-compressor",
3
- "version": "1.10.3",
3
+ "version": "1.10.5",
4
4
  "description": "Compress Image, Video, and Audio same like Whatsapp & Auto/Manual Compression | Background Upload | Download File | Create Video Thumbnail",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -14,7 +14,7 @@ export type compressionMethod = 'auto' | 'manual';
14
14
 
15
15
  export type CompressorOptions = {
16
16
  /***
17
- * The maximum width boundary used when compressing a landscape image.
17
+ * The compression method to use.
18
18
  */
19
19
  compressionMethod?: compressionMethod;
20
20
  /***