@symbiote-native/video-thumbnails 0.1.0
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/LICENSE +21 -0
- package/README.md +106 -0
- package/build/angular/index.d.ts +1 -0
- package/build/angular/index.js +2 -0
- package/build/core/index.d.ts +2 -0
- package/build/core/index.js +1 -0
- package/build/core/native-module.d.ts +5 -0
- package/build/core/native-module.js +3 -0
- package/build/core/types.d.ts +13 -0
- package/build/core/types.js +1 -0
- package/build/core/video-thumbnails.d.ts +3 -0
- package/build/core/video-thumbnails.js +5 -0
- package/build-ngc/angular/index.d.ts +1 -0
- package/build-ngc/angular/index.js +3 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/core/index.d.ts +2 -0
- package/build-ngc/core/index.js +2 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/native-module.d.ts +5 -0
- package/build-ngc/core/native-module.js +4 -0
- package/build-ngc/core/native-module.js.map +1 -0
- package/build-ngc/core/types.d.ts +13 -0
- package/build-ngc/core/types.js +2 -0
- package/build-ngc/core/types.js.map +1 -0
- package/build-ngc/core/video-thumbnails.d.ts +3 -0
- package/build-ngc/core/video-thumbnails.js +6 -0
- package/build-ngc/core/video-thumbnails.js.map +1 -0
- package/native-link.json +12 -0
- package/package.json +150 -0
- package/src/angular/index.ts +2 -0
- package/src/core/index.ts +2 -0
- package/src/core/native-module.ts +16 -0
- package/src/core/types.ts +14 -0
- package/src/core/video-thumbnails.ts +10 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 A. Prokopenko
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# @symbiote-native/video-thumbnails
|
|
2
|
+
|
|
3
|
+
Show a preview image for a video without playing it: pick a moment, get a file. One API for every
|
|
4
|
+
[SymbioteNative](../../README.md) adapter (React, Vue, Svelte, Solid and Angular).
|
|
5
|
+
|
|
6
|
+
> **Deprecated upstream.** Expo replaced
|
|
7
|
+
> [`expo-video-thumbnails`](https://github.com/expo/expo/tree/main/packages/expo-video-thumbnails)
|
|
8
|
+
> with `generateThumbnailsAsync` in `expo-video` and ships no further patches. It is ported here for
|
|
9
|
+
> parity with the rest of the Expo surface.
|
|
10
|
+
|
|
11
|
+
Built the same way as [`@symbiote-native/print`](../print): an `expo-modules-core`-based wrapper
|
|
12
|
+
(see the `symbiote-expo-native-module` project skill for the full mechanism).
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
**New app:**
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @symbiote-native/cli new my-app --video-thumbnails
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
**Existing SymbioteNative app:**
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx @symbiote-native/cli add --video-thumbnails
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Either way: installs `@symbiote-native/video-thumbnails` and wires the native autolinking
|
|
29
|
+
automatically - see [`@symbiote-native/cli`](../cli).
|
|
30
|
+
|
|
31
|
+
<details>
|
|
32
|
+
<summary>Manual install (no CLI - installing and wiring native autolinking by hand)</summary>
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @symbiote-native/video-thumbnails
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`expo-video-thumbnails` and `expo-modules-core` come along as regular, pinned dependencies -
|
|
39
|
+
never install either yourself, and never add the `expo` meta-package to this project.
|
|
40
|
+
|
|
41
|
+
### Required one-time step: native autolinking wiring
|
|
42
|
+
|
|
43
|
+
Same one-time app wiring every `expo-modules-core` package shares - see
|
|
44
|
+
[`@symbiote-native/print`'s README](../print/README.md#required-one-time-step-native-autolinking-wiring)
|
|
45
|
+
for the full table; nothing package-specific here.
|
|
46
|
+
|
|
47
|
+
### No permissions, no config plugin
|
|
48
|
+
|
|
49
|
+
- **No runtime permission on either platform.** The module only ever reads a URI the caller
|
|
50
|
+
already has access to.
|
|
51
|
+
- **No manifest edit.** `expo-video-thumbnails`'s own `AndroidManifest.xml` declares nothing.
|
|
52
|
+
- **No config plugin.** Upstream ships none.
|
|
53
|
+
|
|
54
|
+
</details>
|
|
55
|
+
|
|
56
|
+
## Shape
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
src/core/ the whole API: getThumbnailAsync. native-module.ts resolves
|
|
60
|
+
ExpoVideoThumbnails through expo-modules-core's requireNativeModule.
|
|
61
|
+
src/angular/ @symbiote-native/video-thumbnails/angular
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`./react`, `./vue`, `./svelte`, and `./solid` are `exports`-map aliases straight onto `src/core/` -
|
|
65
|
+
the whole export surface is one stateless async function, nothing to wrap in a hook/composable.
|
|
66
|
+
|
|
67
|
+
## Use it
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
import { getThumbnailAsync } from '@symbiote-native/video-thumbnails';
|
|
71
|
+
|
|
72
|
+
const { uri, width, height } = await getThumbnailAsync('file:///video.mp4', {
|
|
73
|
+
time: 2000,
|
|
74
|
+
quality: 0.8,
|
|
75
|
+
});
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## API
|
|
79
|
+
|
|
80
|
+
| Export | Signature | Notes |
|
|
81
|
+
| -------------------- | ------------------------------------------------------------------------ | --------------------------------------------- |
|
|
82
|
+
| `getThumbnailAsync` | `(sourceFilename: string, options?: IVideoThumbnailsOptions) => Promise<IVideoThumbnailsResult>` | `time` in ms, `quality` `0.0`-`1.0`, optional remote `headers`. |
|
|
83
|
+
|
|
84
|
+
## Common questions
|
|
85
|
+
|
|
86
|
+
- **New code?** No: deprecated upstream in favor of `generateThumbnailsAsync` in `expo-video`.
|
|
87
|
+
- **Never resolves, or fails on some Android devices.** The most reported upstream problem, mostly
|
|
88
|
+
certain codecs and `.mov` files on older Android. Test with your real videos and handle failure.
|
|
89
|
+
- **Two thumbnails close together look the same.** Nearby `time` values can return the same frame;
|
|
90
|
+
space them further apart.
|
|
91
|
+
- **Remote video.** Pass the URL (and `headers` if needed); a local file is more reliable.
|
|
92
|
+
|
|
93
|
+
Sources: [Expo docs: VideoThumbnails](https://docs.expo.dev/versions/latest/sdk/video-thumbnails/),
|
|
94
|
+
[expo/expo#7832](https://github.com/expo/expo/issues/7832),
|
|
95
|
+
[expo/expo#19165](https://github.com/expo/expo/issues/19165),
|
|
96
|
+
[expo/expo#12429](https://github.com/expo/expo/issues/12429).
|
|
97
|
+
|
|
98
|
+
## Test it
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
pnpm vitest run packages/video-thumbnails
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Upstream ships no test suite of its own (`expo-video-thumbnails`'s `src/` has no `__tests__`), so
|
|
105
|
+
nothing to port - every test here is net-new coverage of the ported logic (option defaulting,
|
|
106
|
+
argument forwarding, result passthrough).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { getThumbnailAsync } from './video-thumbnails.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IVideoThumbnailsOptions, IVideoThumbnailsResult } from './types';
|
|
2
|
+
export type INativeVideoThumbnailsModule = {
|
|
3
|
+
getThumbnail(sourceFilename: string, options: IVideoThumbnailsOptions): Promise<IVideoThumbnailsResult>;
|
|
4
|
+
};
|
|
5
|
+
export declare const expoVideoThumbnails: INativeVideoThumbnailsModule;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type IVideoThumbnailsResult = {
|
|
2
|
+
uri: string;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export type IVideoThumbnailsOptions = {
|
|
7
|
+
/** `0.0`-`1.0`. `1` is no compression (highest quality). */
|
|
8
|
+
quality?: number;
|
|
9
|
+
/** Milliseconds into the video to grab the frame from. */
|
|
10
|
+
time?: number;
|
|
11
|
+
/** Sent with the network request when `sourceFilename` is a remote URI. */
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IVideoThumbnailsOptions, IVideoThumbnailsResult } from './types';
|
|
2
|
+
/** Grabs a still frame from `sourceFilename` (local or remote) as a new image file. */
|
|
3
|
+
export declare function getThumbnailAsync(sourceFilename: string, options?: IVideoThumbnailsOptions): Promise<IVideoThumbnailsResult>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { expoVideoThumbnails } from './native-module.js';
|
|
2
|
+
/** Grabs a still frame from `sourceFilename` (local or remote) as a new image file. */
|
|
3
|
+
export async function getThumbnailAsync(sourceFilename, options = {}) {
|
|
4
|
+
return await expoVideoThumbnails.getThumbnail(sourceFilename, options);
|
|
5
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../core';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/angular/index.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IVideoThumbnailsOptions, IVideoThumbnailsResult } from './types';
|
|
2
|
+
export type INativeVideoThumbnailsModule = {
|
|
3
|
+
getThumbnail(sourceFilename: string, options: IVideoThumbnailsOptions): Promise<IVideoThumbnailsResult>;
|
|
4
|
+
};
|
|
5
|
+
export declare const expoVideoThumbnails: INativeVideoThumbnailsModule;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-module.js","sourceRoot":"","sources":["../../src/core/native-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGxD,MAAM,iCAAiC,GAAG,qBAAqB,CAAC;AAShE,MAAM,CAAC,MAAM,mBAAmB,GAC9B,mBAAmB,CACjB,iCAAiC,CAClC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type IVideoThumbnailsResult = {
|
|
2
|
+
uri: string;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
export type IVideoThumbnailsOptions = {
|
|
7
|
+
/** `0.0`-`1.0`. `1` is no compression (highest quality). */
|
|
8
|
+
quality?: number;
|
|
9
|
+
/** Milliseconds into the video to grab the frame from. */
|
|
10
|
+
time?: number;
|
|
11
|
+
/** Sent with the network request when `sourceFilename` is a remote URI. */
|
|
12
|
+
headers?: Record<string, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IVideoThumbnailsOptions, IVideoThumbnailsResult } from './types';
|
|
2
|
+
/** Grabs a still frame from `sourceFilename` (local or remote) as a new image file. */
|
|
3
|
+
export declare function getThumbnailAsync(sourceFilename: string, options?: IVideoThumbnailsOptions): Promise<IVideoThumbnailsResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { expoVideoThumbnails } from './native-module';
|
|
2
|
+
/** Grabs a still frame from `sourceFilename` (local or remote) as a new image file. */
|
|
3
|
+
export async function getThumbnailAsync(sourceFilename, options = {}) {
|
|
4
|
+
return await expoVideoThumbnails.getThumbnail(sourceFilename, options);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=video-thumbnails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-thumbnails.js","sourceRoot":"","sources":["../../src/core/video-thumbnails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD,uFAAuF;AACvF,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,cAAsB,EACtB,UAAmC,EAAE;IAErC,OAAO,MAAM,mBAAmB,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AACzE,CAAC"}
|
package/native-link.json
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@symbiote-native/video-thumbnails",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "expo-video-thumbnails wrapped for SymbioteNative — one framework-agnostic core, built once and reachable from the React, Vue, Svelte, Solid, and Angular adapters. Creates an image thumbnail from a local or remote video.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"react-native",
|
|
8
|
+
"symbiote-native",
|
|
9
|
+
"expo-video-thumbnails",
|
|
10
|
+
"react",
|
|
11
|
+
"vue",
|
|
12
|
+
"svelte",
|
|
13
|
+
"solid",
|
|
14
|
+
"angular",
|
|
15
|
+
"video",
|
|
16
|
+
"thumbnail"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/OneEyed1366/symbiote-native.git",
|
|
21
|
+
"directory": "packages/video-thumbnails"
|
|
22
|
+
},
|
|
23
|
+
"homepage": "https://github.com/OneEyed1366/symbiote-native/tree/master/packages/video-thumbnails#readme",
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/OneEyed1366/symbiote-native/issues"
|
|
26
|
+
},
|
|
27
|
+
"author": "Andrey Prokopenko <psevdoproger@gmail.com>",
|
|
28
|
+
"type": "module",
|
|
29
|
+
"main": "./build/core/index.js",
|
|
30
|
+
"module": "./build/core/index.js",
|
|
31
|
+
"types": "./build/core/index.d.ts",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./build/core/index.d.ts",
|
|
35
|
+
"default": "./build/core/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./vue": {
|
|
38
|
+
"types": "./build/core/index.d.ts",
|
|
39
|
+
"default": "./build/core/index.js"
|
|
40
|
+
},
|
|
41
|
+
"./react": {
|
|
42
|
+
"types": "./build/core/index.d.ts",
|
|
43
|
+
"default": "./build/core/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./svelte": {
|
|
46
|
+
"types": "./build/core/index.d.ts",
|
|
47
|
+
"default": "./build/core/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./solid": {
|
|
50
|
+
"types": "./build/core/index.d.ts",
|
|
51
|
+
"default": "./build/core/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./angular": {
|
|
54
|
+
"types": "./build-ngc/angular/index.d.ts",
|
|
55
|
+
"react-native": "./build-ngc/angular/index.js",
|
|
56
|
+
"default": "./src/angular/index.ts"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"files": [
|
|
60
|
+
"src",
|
|
61
|
+
"build",
|
|
62
|
+
"build-ngc",
|
|
63
|
+
"native-link.json",
|
|
64
|
+
"!src/**/*.test.*",
|
|
65
|
+
"!src/**/*.spec.*",
|
|
66
|
+
"!src/**/*.detox.*"
|
|
67
|
+
],
|
|
68
|
+
"publishConfig": {
|
|
69
|
+
"access": "public"
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"expo-video-thumbnails": "57.0.2",
|
|
73
|
+
"expo-modules-core": "57.0.20"
|
|
74
|
+
},
|
|
75
|
+
"peerDependencies": {
|
|
76
|
+
"@angular/core": ">=20",
|
|
77
|
+
"@vue/runtime-core": "^3.5.13",
|
|
78
|
+
"react": ">=19.0.0",
|
|
79
|
+
"react-native": ">=0.86",
|
|
80
|
+
"solid-js": ">=1.9.0",
|
|
81
|
+
"svelte": ">=5.56.0",
|
|
82
|
+
"vue": ">=3.5.0",
|
|
83
|
+
"@symbiote-native/angular": "^3.1.3",
|
|
84
|
+
"@symbiote-native/react": "^3.1.0",
|
|
85
|
+
"@symbiote-native/solid": "^3.0.5",
|
|
86
|
+
"@symbiote-native/engine": "^1.4.0",
|
|
87
|
+
"@symbiote-native/vue": "^3.1.0",
|
|
88
|
+
"@symbiote-native/svelte": "^3.0.5"
|
|
89
|
+
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"@symbiote-native/angular": {
|
|
92
|
+
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@symbiote-native/react": {
|
|
95
|
+
"optional": true
|
|
96
|
+
},
|
|
97
|
+
"@symbiote-native/solid": {
|
|
98
|
+
"optional": true
|
|
99
|
+
},
|
|
100
|
+
"@symbiote-native/svelte": {
|
|
101
|
+
"optional": true
|
|
102
|
+
},
|
|
103
|
+
"@symbiote-native/vue": {
|
|
104
|
+
"optional": true
|
|
105
|
+
},
|
|
106
|
+
"@angular/core": {
|
|
107
|
+
"optional": true
|
|
108
|
+
},
|
|
109
|
+
"@vue/runtime-core": {
|
|
110
|
+
"optional": true
|
|
111
|
+
},
|
|
112
|
+
"react": {
|
|
113
|
+
"optional": true
|
|
114
|
+
},
|
|
115
|
+
"solid-js": {
|
|
116
|
+
"optional": true
|
|
117
|
+
},
|
|
118
|
+
"svelte": {
|
|
119
|
+
"optional": true
|
|
120
|
+
},
|
|
121
|
+
"vue": {
|
|
122
|
+
"optional": true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"devDependencies": {
|
|
126
|
+
"@angular/compiler": "~22.0.8",
|
|
127
|
+
"@angular/compiler-cli": "~22.0.8",
|
|
128
|
+
"@angular/core": "~22.0.8",
|
|
129
|
+
"@types/node": "^26.0.0",
|
|
130
|
+
"@types/react": "^19.2.0",
|
|
131
|
+
"@vue/runtime-core": "^3.5.13",
|
|
132
|
+
"react": "19.2.3",
|
|
133
|
+
"solid-js": "^1.9.14",
|
|
134
|
+
"svelte": "^5.56.0",
|
|
135
|
+
"typescript": "~6.0.0",
|
|
136
|
+
"@symbiote-native/angular": "3.1.3",
|
|
137
|
+
"@symbiote-native/engine": "1.4.0",
|
|
138
|
+
"@symbiote-native/react": "3.1.0",
|
|
139
|
+
"@symbiote-native/test-utils": "0.4.5",
|
|
140
|
+
"@symbiote-native/svelte": "3.0.5",
|
|
141
|
+
"@symbiote-native/solid": "3.0.5",
|
|
142
|
+
"@symbiote-native/vue": "3.1.0"
|
|
143
|
+
},
|
|
144
|
+
"scripts": {
|
|
145
|
+
"typecheck": "tsc --build",
|
|
146
|
+
"clean": "rm -rf build-ngc",
|
|
147
|
+
"ng:build": "pnpm run clean && ngc -p tsconfig.angular.json",
|
|
148
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\""
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { requireNativeModule } from 'expo-modules-core';
|
|
2
|
+
import type { IVideoThumbnailsOptions, IVideoThumbnailsResult } from './types';
|
|
3
|
+
|
|
4
|
+
const EXPO_VIDEO_THUMBNAILS_MODULE_NAME = 'ExpoVideoThumbnails';
|
|
5
|
+
|
|
6
|
+
export type INativeVideoThumbnailsModule = {
|
|
7
|
+
getThumbnail(
|
|
8
|
+
sourceFilename: string,
|
|
9
|
+
options: IVideoThumbnailsOptions,
|
|
10
|
+
): Promise<IVideoThumbnailsResult>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const expoVideoThumbnails =
|
|
14
|
+
requireNativeModule<INativeVideoThumbnailsModule>(
|
|
15
|
+
EXPO_VIDEO_THUMBNAILS_MODULE_NAME,
|
|
16
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type IVideoThumbnailsResult = {
|
|
2
|
+
uri: string;
|
|
3
|
+
width: number;
|
|
4
|
+
height: number;
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type IVideoThumbnailsOptions = {
|
|
8
|
+
/** `0.0`-`1.0`. `1` is no compression (highest quality). */
|
|
9
|
+
quality?: number;
|
|
10
|
+
/** Milliseconds into the video to grab the frame from. */
|
|
11
|
+
time?: number;
|
|
12
|
+
/** Sent with the network request when `sourceFilename` is a remote URI. */
|
|
13
|
+
headers?: Record<string, string>;
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { expoVideoThumbnails } from './native-module';
|
|
2
|
+
import type { IVideoThumbnailsOptions, IVideoThumbnailsResult } from './types';
|
|
3
|
+
|
|
4
|
+
/** Grabs a still frame from `sourceFilename` (local or remote) as a new image file. */
|
|
5
|
+
export async function getThumbnailAsync(
|
|
6
|
+
sourceFilename: string,
|
|
7
|
+
options: IVideoThumbnailsOptions = {},
|
|
8
|
+
): Promise<IVideoThumbnailsResult> {
|
|
9
|
+
return await expoVideoThumbnails.getThumbnail(sourceFilename, options);
|
|
10
|
+
}
|