@twick/media-utils 0.14.0 → 0.14.3
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 +95 -23
- package/dist/index-BWbdE2uK.cjs +15806 -0
- package/dist/index-BWbdE2uK.cjs.map +1 -0
- package/dist/index-CXhwwSX-.js +15804 -0
- package/dist/index-CXhwwSX-.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +247 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +246 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -10
- package/LICENSE +0 -197
package/README.md
CHANGED
|
@@ -1,23 +1,95 @@
|
|
|
1
|
-
# @twick/media-utils
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
##
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
##
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
# @twick/media-utils
|
|
2
|
+
|
|
3
|
+
Core utilities for media handling and manipulation in the Twick platform.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package provides essential utilities for working with various media types including video, audio, and images. It offers functions for metadata extraction, dimension handling, caching, and file management.
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @twick/media-utils
|
|
13
|
+
# or
|
|
14
|
+
pnpm add @twick/media-utils
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Quick Start
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import {
|
|
21
|
+
getVideoMetadata,
|
|
22
|
+
getImageDimensions,
|
|
23
|
+
getAudioDuration,
|
|
24
|
+
getThumbnail
|
|
25
|
+
} from '@twick/media-utils';
|
|
26
|
+
|
|
27
|
+
// Get video metadata
|
|
28
|
+
const videoMeta = await getVideoMetadata('path/to/video.mp4');
|
|
29
|
+
console.log(videoMeta); // { width, height, duration, etc. }
|
|
30
|
+
|
|
31
|
+
// Get image dimensions
|
|
32
|
+
const dimensions = await getImageDimensions('path/to/image.jpg');
|
|
33
|
+
console.log(dimensions); // { width, height }
|
|
34
|
+
|
|
35
|
+
// Get audio duration
|
|
36
|
+
const duration = await getAudioDuration('path/to/audio.mp3');
|
|
37
|
+
console.log(duration); // duration in seconds
|
|
38
|
+
|
|
39
|
+
// Generate thumbnail
|
|
40
|
+
const thumbnail = await getThumbnail('path/to/video.mp4', 5); // 5 seconds
|
|
41
|
+
console.log(thumbnail); // base64 thumbnail
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Key Features
|
|
45
|
+
|
|
46
|
+
- **Video Metadata**: Extract width, height, duration, and other properties
|
|
47
|
+
- **Image Processing**: Get dimensions and generate thumbnails
|
|
48
|
+
- **Audio Utilities**: Extract duration and audio properties
|
|
49
|
+
- **Caching**: Built-in caching for improved performance
|
|
50
|
+
- **File Management**: URL and file path handling utilities
|
|
51
|
+
- **Dimension Handling**: Responsive dimension calculations
|
|
52
|
+
|
|
53
|
+
## API Reference
|
|
54
|
+
|
|
55
|
+
### Core Functions
|
|
56
|
+
|
|
57
|
+
- `getVideoMetadata`: Extract video metadata
|
|
58
|
+
- `getImageDimensions`: Get image dimensions
|
|
59
|
+
- `getAudioDuration`: Extract audio duration
|
|
60
|
+
- `getThumbnail`: Generate video thumbnails
|
|
61
|
+
- `limit`: Apply size and duration limits
|
|
62
|
+
- `urlHelper`: URL manipulation utilities
|
|
63
|
+
|
|
64
|
+
### Types
|
|
65
|
+
|
|
66
|
+
- `VideoMetadata`: Video metadata interface
|
|
67
|
+
- `ImageDimensions`: Image dimension interface
|
|
68
|
+
- `AudioMetadata`: Audio metadata interface
|
|
69
|
+
- `ThumbnailOptions`: Thumbnail generation options
|
|
70
|
+
|
|
71
|
+
For complete API documentation, refer to the generated documentation.
|
|
72
|
+
|
|
73
|
+
## Browser Support
|
|
74
|
+
|
|
75
|
+
This package requires a browser environment with support for:
|
|
76
|
+
- HTML5 Video and Audio elements
|
|
77
|
+
- Canvas API
|
|
78
|
+
- File API
|
|
79
|
+
- Modern JavaScript features (ES2020+)
|
|
80
|
+
|
|
81
|
+
## Documentation
|
|
82
|
+
|
|
83
|
+
For complete documentation, refer to the project documentation site.
|
|
84
|
+
|
|
85
|
+
## License
|
|
86
|
+
|
|
87
|
+
This package is licensed under the **Sustainable Use License (SUL) Version 1.0**.
|
|
88
|
+
|
|
89
|
+
- Free for use in commercial and non-commercial apps
|
|
90
|
+
- Can be modified and self-hosted
|
|
91
|
+
- Cannot be sold, rebranded, or distributed as a standalone SDK
|
|
92
|
+
|
|
93
|
+
For commercial licensing inquiries, contact: contact@kifferai.com
|
|
94
|
+
|
|
95
|
+
For full license terms, see the main LICENSE.md file in the project root.
|