expo-video-metadata 0.1.0 → 1.0.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/README.md +15 -7
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/package.json +9 -4
- package/src/index.ts +2 -2
package/README.md
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Provides a function that let you get some metadata from video files, like the duration, width, height, fps, codec, hasAudio, orientation, audioChannels, audioCodec, audioSampleRate etc. Check the exported types for more information. Web support is not available yet but it is planned.
|
|
4
4
|
|
|
5
|
+
<img src="https://raw.githubusercontent.com/hirbod/expo-video-metadata/assets/preview.png" width="500" />
|
|
6
|
+
|
|
5
7
|
# Installation in bare React Native projects
|
|
6
8
|
|
|
7
|
-
This package needs **Expo SDK 50** or **higher**, as it uses FileSystem APIs that were added in that version. This package adds native code to your project and does not work with Expo Go. Please use a custom dev client or build a standalone app.
|
|
9
|
+
This package needs **Expo SDK 50** or **higher**, as it uses FileSystem APIs that were added in that version. This package adds native code to your project and does not work with Expo Go. Please use a custom dev client or build a standalone app. Works with Fabric. Needs RN 0.73+ (Java JDK 17)
|
|
8
10
|
|
|
9
11
|
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing (SDK 50+). This just adds ~150KB to your final app size and is the easiest way to get started and it works with and without Expo projects.
|
|
10
12
|
|
|
@@ -28,14 +30,20 @@ No additional set up necessary.
|
|
|
28
30
|
import { getVideoInfoAsync } from 'expo-video-metadata';
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
|
-
*
|
|
33
|
+
* Retrieves video metadata.
|
|
34
|
+
*
|
|
32
35
|
* @param sourceFilename An URI of the video, local or remote.
|
|
33
|
-
* @
|
|
36
|
+
* @param options Pass `headers` object in case `sourceFilename` is a remote URI, e.g { headers: "Authorization": "Bearer some-token" } etc.
|
|
37
|
+
*
|
|
38
|
+
* @return Returns a promise which fulfils with [`VideoInfoResult`](#Videoinforesult).
|
|
34
39
|
*/
|
|
35
|
-
const videoInfo = await getVideoInfoAsync(sourceFileName: string): Promise<VideoInfo>;
|
|
36
40
|
|
|
41
|
+
const result = await getVideoInfoAsync(
|
|
42
|
+
sourceFilename: string,
|
|
43
|
+
options: VideoInfoOptions = {},
|
|
44
|
+
): Promise<VideoInfoResult> {
|
|
45
|
+
return await ExpoVideoMetadataModule.getVideoInfo(sourceFilename, options);
|
|
46
|
+
}
|
|
37
47
|
```
|
|
38
48
|
|
|
39
|
-
#
|
|
40
|
-
|
|
41
|
-
I am planning to add more metadata to the result object. If you need something specific, please open an issue or a PR.
|
|
49
|
+
See [VideoInfoResult](https://github.com/hirbod/expo-video-metadata/blob/b9239224eed46f455b2fb9f1b29e69ac49da6683/src/ExpoVideoMetadata.types.ts#L1) type for more information.
|
package/build/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VideoInfoOptions, VideoInfoResult } from "./ExpoVideoMetadata.types";
|
|
2
2
|
export { VideoInfoOptions, VideoInfoResult };
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Retrieves video metadata.
|
|
5
5
|
*
|
|
6
6
|
* @param sourceFilename An URI of the video, local or remote.
|
|
7
7
|
* @param options Pass `headers` object in case `sourceFilename` is a remote URI, e.g { headers: "Authorization": "Bearer some-token" } etc.
|
package/build/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import ExpoVideoMetadataModule from "./ExpoVideoMetadataModule";
|
|
|
2
2
|
// Import the native module. On web, it will be resolved to ExpoVideoMetadata.web.ts
|
|
3
3
|
// and on native platforms to ExpoVideoMetadata.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Retrieves video metadata.
|
|
6
6
|
*
|
|
7
7
|
* @param sourceFilename An URI of the video, local or remote.
|
|
8
8
|
* @param options Pass `headers` object in case `sourceFilename` is a remote URI, e.g { headers: "Authorization": "Bearer some-token" } etc.
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAIhE,oFAAoF;AACpF,kDAAkD;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,MAAM,uBAAuB,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { VideoInfoOptions, VideoInfoResult } from \"./ExpoVideoMetadata.types\";\nimport ExpoVideoMetadataModule from \"./ExpoVideoMetadataModule\";\n\nexport { VideoInfoOptions, VideoInfoResult };\n\n// Import the native module. On web, it will be resolved to ExpoVideoMetadata.web.ts\n// and on native platforms to ExpoVideoMetadata.ts\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAIhE,oFAAoF;AACpF,kDAAkD;AAElD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,cAAsB,EACtB,UAA4B,EAAE;IAE9B,OAAO,MAAM,uBAAuB,CAAC,YAAY,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["import { VideoInfoOptions, VideoInfoResult } from \"./ExpoVideoMetadata.types\";\nimport ExpoVideoMetadataModule from \"./ExpoVideoMetadataModule\";\n\nexport { VideoInfoOptions, VideoInfoResult };\n\n// Import the native module. On web, it will be resolved to ExpoVideoMetadata.web.ts\n// and on native platforms to ExpoVideoMetadata.ts\n\n/**\n * Retrieves video metadata.\n *\n * @param sourceFilename An URI of the video, local or remote.\n * @param options Pass `headers` object in case `sourceFilename` is a remote URI, e.g { headers: \"Authorization\": \"Bearer some-token\" } etc.\n *\n * @return Returns a promise which fulfils with [`VideoInfoResult`](#Videoinforesult).\n */\nexport async function getVideoInfoAsync(\n sourceFilename: string,\n options: VideoInfoOptions = {}\n): Promise<VideoInfoResult> {\n return await ExpoVideoMetadataModule.getVideoInfo(sourceFilename, options);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-video-metadata",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Module to retrieve
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Module to retrieve metadata from a video with Expo and React Native",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -19,13 +19,18 @@
|
|
|
19
19
|
"react-native",
|
|
20
20
|
"expo",
|
|
21
21
|
"expo-video-metadata",
|
|
22
|
-
"ExpoVideoMetadata"
|
|
22
|
+
"ExpoVideoMetadata",
|
|
23
|
+
"react native",
|
|
24
|
+
"video module",
|
|
25
|
+
"video metadata",
|
|
26
|
+
"video",
|
|
27
|
+
"metadata"
|
|
23
28
|
],
|
|
24
29
|
"repository": "https://github.com/hirbod/expo-video-metadata",
|
|
25
30
|
"bugs": {
|
|
26
31
|
"url": "https://github.com/hirbod/expo-video-metadata/issues"
|
|
27
32
|
},
|
|
28
|
-
"author": "Hirbod Mirjavadi
|
|
33
|
+
"author": "Hirbod Mirjavadi (https://github.com/hirbod)",
|
|
29
34
|
"license": "MIT",
|
|
30
35
|
"homepage": "https://github.com/hirbod/expo-video-metadata#readme",
|
|
31
36
|
"dependencies": {},
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { VideoInfoOptions, VideoInfoResult };
|
|
|
7
7
|
// and on native platforms to ExpoVideoMetadata.ts
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Retrieves video metadata.
|
|
11
11
|
*
|
|
12
12
|
* @param sourceFilename An URI of the video, local or remote.
|
|
13
13
|
* @param options Pass `headers` object in case `sourceFilename` is a remote URI, e.g { headers: "Authorization": "Bearer some-token" } etc.
|
|
@@ -16,7 +16,7 @@ export { VideoInfoOptions, VideoInfoResult };
|
|
|
16
16
|
*/
|
|
17
17
|
export async function getVideoInfoAsync(
|
|
18
18
|
sourceFilename: string,
|
|
19
|
-
options: VideoInfoOptions = {}
|
|
19
|
+
options: VideoInfoOptions = {}
|
|
20
20
|
): Promise<VideoInfoResult> {
|
|
21
21
|
return await ExpoVideoMetadataModule.getVideoInfo(sourceFilename, options);
|
|
22
22
|
}
|