@loaders.gl/video 4.0.0-alpha.4 → 4.0.0-alpha.6
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/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +2147 -0
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/gif-builder.js +200 -0
- package/dist/es5/gif-builder.js.map +1 -0
- package/dist/es5/index.js +21 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/gifshot/gifshot-loader.js +67 -0
- package/dist/es5/lib/gifshot/gifshot-loader.js.map +1 -0
- package/dist/es5/lib/gifshot/gifshot.js +1924 -0
- package/dist/es5/lib/gifshot/gifshot.js.map +1 -0
- package/dist/es5/lib/parsers/parse-video.js +31 -0
- package/dist/es5/lib/parsers/parse-video.js.map +1 -0
- package/dist/es5/lib/utils/assert.js +12 -0
- package/dist/es5/lib/utils/assert.js.map +1 -0
- package/dist/es5/video-loader.js +28 -0
- package/dist/es5/video-loader.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/gif-builder.js +106 -0
- package/dist/esm/gif-builder.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/{src → dist/esm}/lib/gifshot/gifshot-loader.js +4 -8
- package/dist/esm/lib/gifshot/gifshot-loader.js.map +1 -0
- package/dist/esm/lib/gifshot/gifshot.js +1915 -0
- package/dist/esm/lib/gifshot/gifshot.js.map +1 -0
- package/dist/esm/lib/parsers/parse-video.js +7 -0
- package/dist/esm/lib/parsers/parse-video.js.map +1 -0
- package/{src → dist/esm}/lib/utils/assert.js +1 -0
- package/dist/esm/lib/utils/assert.js.map +1 -0
- package/dist/esm/video-loader.js +19 -0
- package/dist/esm/video-loader.js.map +1 -0
- package/dist/gif-builder.d.ts +53 -0
- package/dist/gif-builder.d.ts.map +1 -0
- package/dist/gif-builder.js +136 -114
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -3
- package/dist/lib/gifshot/gifshot-loader.d.ts +2 -0
- package/dist/lib/gifshot/gifshot-loader.d.ts.map +1 -0
- package/dist/lib/gifshot/gifshot-loader.js +18 -15
- package/dist/lib/gifshot/gifshot.d.ts +72 -0
- package/dist/lib/gifshot/gifshot.d.ts.map +1 -0
- package/dist/lib/gifshot/gifshot.js +2439 -0
- package/dist/lib/parsers/parse-video.d.ts +2 -0
- package/dist/lib/parsers/parse-video.d.ts.map +1 -0
- package/dist/lib/parsers/parse-video.js +12 -6
- package/dist/lib/utils/assert.d.ts +2 -0
- package/dist/lib/utils/assert.d.ts.map +1 -0
- package/dist/lib/utils/assert.js +8 -5
- package/dist/video-loader.d.ts +17 -0
- package/dist/video-loader.d.ts.map +1 -0
- package/dist/video-loader.js +22 -14
- package/package.json +8 -8
- package/src/{gif-builder.js → gif-builder.ts} +6 -6
- package/src/lib/gifshot/gifshot.ts +2416 -0
- package/dist/bundle.js.map +0 -1
- package/dist/gif-builder.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/gifshot/gifshot-loader.js.map +0 -1
- package/dist/lib/parsers/parse-video.js.map +0 -1
- package/dist/lib/utils/assert.js.map +0 -1
- package/dist/lib/utils/globals.js +0 -16
- package/dist/lib/utils/globals.js.map +0 -1
- package/dist/libs/gifshot.js +0 -2826
- package/dist/video-loader.js.map +0 -1
- package/src/lib/utils/globals.js +0 -25
- package/src/libs/gifshot.js +0 -2826
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-video.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/parse-video.ts"],"names":[],"mappings":"AACA,wBAA8B,UAAU,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQ5F"}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// Parse to platform defined video type (HTMLVideoElement in browser)
|
|
4
|
+
async function parseVideo(arrayBuffer) {
|
|
5
|
+
// TODO It is probably somewhat inefficent to convert a File/Blob to ArrayBuffer and back
|
|
6
|
+
// and could perhaps cause problems for large videos.
|
|
7
|
+
// TODO MIME type is also lost from the File or Response...
|
|
8
|
+
const blob = new Blob([arrayBuffer]);
|
|
9
|
+
const video = document.createElement('video');
|
|
10
|
+
video.src = URL.createObjectURL(blob);
|
|
11
|
+
return video;
|
|
6
12
|
}
|
|
7
|
-
|
|
13
|
+
exports.default = parseVideo;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/assert.ts"],"names":[],"mappings":"AAAA,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAIhE"}
|
package/dist/lib/utils/assert.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assert = void 0;
|
|
4
|
+
function assert(condition, message) {
|
|
5
|
+
if (!condition) {
|
|
6
|
+
throw new Error(message);
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
|
-
|
|
9
|
+
exports.assert = assert;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import parseVideo from './lib/parsers/parse-video';
|
|
3
|
+
export type VideoLoaderOptions = LoaderOptions & {
|
|
4
|
+
video: {};
|
|
5
|
+
};
|
|
6
|
+
export declare const VideoLoader: {
|
|
7
|
+
name: string;
|
|
8
|
+
id: string;
|
|
9
|
+
module: string;
|
|
10
|
+
version: any;
|
|
11
|
+
extensions: string[];
|
|
12
|
+
mimeTypes: string[];
|
|
13
|
+
parse: typeof parseVideo;
|
|
14
|
+
options: VideoLoaderOptions;
|
|
15
|
+
};
|
|
16
|
+
export declare const _typecheckVideoLoader: LoaderWithParser;
|
|
17
|
+
//# sourceMappingURL=video-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video-loader.d.ts","sourceRoot":"","sources":["../src/video-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAWnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,EAAE,EAAE,CAAC;CACX,CAAC;AAMF,eAAO,MAAM,WAAW;;;;;;;;;CAYvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,gBAA8B,CAAC"}
|
package/dist/video-loader.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports._typecheckVideoLoader = exports.VideoLoader = void 0;
|
|
7
|
+
const parse_video_1 = __importDefault(require("./lib/parsers/parse-video"));
|
|
8
|
+
// __VERSION__ is injected by babel-plugin-version-inline
|
|
9
|
+
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
10
|
+
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
|
|
3
11
|
const EXTENSIONS = ['mp4'];
|
|
4
12
|
const MIME_TYPES = ['video/mp4'];
|
|
5
13
|
const DEFAULT_LOADER_OPTIONS = {
|
|
6
|
-
|
|
14
|
+
video: {}
|
|
7
15
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
exports.VideoLoader = {
|
|
17
|
+
name: 'Video',
|
|
18
|
+
id: 'video',
|
|
19
|
+
module: 'video',
|
|
20
|
+
version: VERSION,
|
|
21
|
+
extensions: EXTENSIONS,
|
|
22
|
+
mimeTypes: MIME_TYPES,
|
|
23
|
+
parse: parse_video_1.default,
|
|
24
|
+
// tests: arrayBuffer => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer))),
|
|
25
|
+
options: DEFAULT_LOADER_OPTIONS
|
|
17
26
|
};
|
|
18
|
-
|
|
19
|
-
//# sourceMappingURL=video-loader.js.map
|
|
27
|
+
exports._typecheckVideoLoader = exports.VideoLoader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/video",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
4
4
|
"description": "Framework-independent loaders and writers for video (MP4, WEBM, ...)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"point cloud",
|
|
19
19
|
"PLY"
|
|
20
20
|
],
|
|
21
|
-
"types": "
|
|
22
|
-
"main": "dist/index.js",
|
|
23
|
-
"module": "dist/index.js",
|
|
21
|
+
"types": "dist/index.d.ts",
|
|
22
|
+
"main": "dist/es5/index.js",
|
|
23
|
+
"module": "dist/esm/index.js",
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"pre-build": "npm run build-bundle",
|
|
32
|
-
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/
|
|
32
|
+
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
36
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
35
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.6",
|
|
36
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.6",
|
|
37
37
|
"gifshot": "^0.4.5"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "acc1985050dfaa0f1f0c066f8da5bce7454a046c"
|
|
40
40
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// A GIFBuilder based on the gifshot module
|
|
2
2
|
// @ts-nocheck
|
|
3
3
|
import {assert} from './lib/utils/assert';
|
|
4
|
-
import gifshot from './
|
|
4
|
+
import gifshot from './lib/gifshot/gifshot'; // TODO - load dynamically to avoid bloating
|
|
5
5
|
|
|
6
6
|
// These are gifshot module options
|
|
7
7
|
const GIF_BUILDER_OPTIONS = {
|
|
@@ -83,17 +83,17 @@ export default class GIFBuilder {
|
|
|
83
83
|
this.gifshot = gifshot;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
async initialize(options) {
|
|
86
|
+
async initialize(options): Promise<void> {
|
|
87
87
|
// Expose the gifshot module so that the full gifshot API is available to apps (Experimental)
|
|
88
88
|
// this.gifshot = await loadGifshotModule(options);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
async add(file) {
|
|
91
|
+
async add(file): void {
|
|
92
92
|
await this.initialize();
|
|
93
93
|
this.files.push(file);
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
async build() {
|
|
96
|
+
async build(): Promise<string> {
|
|
97
97
|
await this.initialize();
|
|
98
98
|
this._cleanOptions(this.options);
|
|
99
99
|
|
|
@@ -116,7 +116,7 @@ export default class GIFBuilder {
|
|
|
116
116
|
|
|
117
117
|
// PRIVATE
|
|
118
118
|
|
|
119
|
-
async _createGIF() {
|
|
119
|
+
async _createGIF(): Promise<string> {
|
|
120
120
|
return new Promise((resolve, reject) => {
|
|
121
121
|
this.gifshot.createGIF(this.options, (result) => {
|
|
122
122
|
// callback object properties
|
|
@@ -145,7 +145,7 @@ export default class GIFBuilder {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// Remove some gifshot options
|
|
148
|
-
_cleanOptions(options) {
|
|
148
|
+
_cleanOptions(options): void {
|
|
149
149
|
if (options.video || options.images || options.gifWidth || options.gifHeight) {
|
|
150
150
|
console.warn('GIFBuilder: ignoring options'); // eslint-disable-line
|
|
151
151
|
}
|