@honem/native-video-compressor 0.2.1 → 0.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.
Files changed (2) hide show
  1. package/README.md +17 -11
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -17,19 +17,25 @@ npx cap sync
17
17
  ```typescript
18
18
  import { VideoCompressor } from '@honem/native-video-compressor';
19
19
 
20
- // Compress a video
21
- const result = await VideoCompressor.compressVideo({
22
- inputPath: '/path/to/video.mp4',
23
- quality: 'medium',
24
- });
25
-
26
- console.log(result.outputPath); // Path to compressed file
27
- console.log(result.compressionRatio); // e.g., 3.5
28
-
29
- // Optional: delete temp file immediately after use
30
- await VideoCompressor.deleteFile({ path: result.outputPath });
20
+ try {
21
+ const result = await VideoCompressor.compressVideo({
22
+ inputPath: '/path/to/video.mp4',
23
+ quality: 'medium',
24
+ });
25
+
26
+ console.log(result.outputPath); // Path to compressed file
27
+ console.log(result.compressionRatio); // e.g., 3.5
28
+
29
+ // Optional: delete temp file immediately after use
30
+ await VideoCompressor.deleteFile({ path: result.outputPath });
31
+ } catch (error) {
32
+ // Handle error (e.g., web platform not supported)
33
+ console.error(error);
34
+ }
31
35
  ```
32
36
 
37
+ **Note:** This plugin only works on iOS and Android. Calling these functions on web will throw an error, so always wrap calls in try/catch.
38
+
33
39
  ## API
34
40
 
35
41
  ### compressVideo(options)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honem/native-video-compressor",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Capacitor plugin for video compression using native platform APIs (iOS AVFoundation, Android MediaCodec)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",