@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.
Files changed (72) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +2 -2
  4. package/dist/dist.min.js +2147 -0
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/gif-builder.js +200 -0
  8. package/dist/es5/gif-builder.js.map +1 -0
  9. package/dist/es5/index.js +21 -0
  10. package/dist/es5/index.js.map +1 -0
  11. package/dist/es5/lib/gifshot/gifshot-loader.js +67 -0
  12. package/dist/es5/lib/gifshot/gifshot-loader.js.map +1 -0
  13. package/dist/es5/lib/gifshot/gifshot.js +1924 -0
  14. package/dist/es5/lib/gifshot/gifshot.js.map +1 -0
  15. package/dist/es5/lib/parsers/parse-video.js +31 -0
  16. package/dist/es5/lib/parsers/parse-video.js.map +1 -0
  17. package/dist/es5/lib/utils/assert.js +12 -0
  18. package/dist/es5/lib/utils/assert.js.map +1 -0
  19. package/dist/es5/video-loader.js +28 -0
  20. package/dist/es5/video-loader.js.map +1 -0
  21. package/dist/esm/bundle.js +4 -0
  22. package/dist/esm/bundle.js.map +1 -0
  23. package/dist/esm/gif-builder.js +106 -0
  24. package/dist/esm/gif-builder.js.map +1 -0
  25. package/dist/esm/index.js +3 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/{src → dist/esm}/lib/gifshot/gifshot-loader.js +4 -8
  28. package/dist/esm/lib/gifshot/gifshot-loader.js.map +1 -0
  29. package/dist/esm/lib/gifshot/gifshot.js +1915 -0
  30. package/dist/esm/lib/gifshot/gifshot.js.map +1 -0
  31. package/dist/esm/lib/parsers/parse-video.js +7 -0
  32. package/dist/esm/lib/parsers/parse-video.js.map +1 -0
  33. package/{src → dist/esm}/lib/utils/assert.js +1 -0
  34. package/dist/esm/lib/utils/assert.js.map +1 -0
  35. package/dist/esm/video-loader.js +19 -0
  36. package/dist/esm/video-loader.js.map +1 -0
  37. package/dist/gif-builder.d.ts +53 -0
  38. package/dist/gif-builder.d.ts.map +1 -0
  39. package/dist/gif-builder.js +136 -114
  40. package/dist/index.d.ts +3 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +10 -3
  43. package/dist/lib/gifshot/gifshot-loader.d.ts +2 -0
  44. package/dist/lib/gifshot/gifshot-loader.d.ts.map +1 -0
  45. package/dist/lib/gifshot/gifshot-loader.js +18 -15
  46. package/dist/lib/gifshot/gifshot.d.ts +72 -0
  47. package/dist/lib/gifshot/gifshot.d.ts.map +1 -0
  48. package/dist/lib/gifshot/gifshot.js +2439 -0
  49. package/dist/lib/parsers/parse-video.d.ts +2 -0
  50. package/dist/lib/parsers/parse-video.d.ts.map +1 -0
  51. package/dist/lib/parsers/parse-video.js +12 -6
  52. package/dist/lib/utils/assert.d.ts +2 -0
  53. package/dist/lib/utils/assert.d.ts.map +1 -0
  54. package/dist/lib/utils/assert.js +8 -5
  55. package/dist/video-loader.d.ts +17 -0
  56. package/dist/video-loader.d.ts.map +1 -0
  57. package/dist/video-loader.js +22 -14
  58. package/package.json +8 -8
  59. package/src/{gif-builder.js → gif-builder.ts} +6 -6
  60. package/src/lib/gifshot/gifshot.ts +2416 -0
  61. package/dist/bundle.js.map +0 -1
  62. package/dist/gif-builder.js.map +0 -1
  63. package/dist/index.js.map +0 -1
  64. package/dist/lib/gifshot/gifshot-loader.js.map +0 -1
  65. package/dist/lib/parsers/parse-video.js.map +0 -1
  66. package/dist/lib/utils/assert.js.map +0 -1
  67. package/dist/lib/utils/globals.js +0 -16
  68. package/dist/lib/utils/globals.js.map +0 -1
  69. package/dist/libs/gifshot.js +0 -2826
  70. package/dist/video-loader.js.map +0 -1
  71. package/src/lib/utils/globals.js +0 -25
  72. package/src/libs/gifshot.js +0 -2826
@@ -0,0 +1,2 @@
1
+ export default function parseVideo(arrayBuffer: ArrayBuffer): Promise<HTMLVideoElement>;
2
+ //# sourceMappingURL=parse-video.d.ts.map
@@ -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
- export default async function parseVideo(arrayBuffer) {
2
- const blob = new Blob([arrayBuffer]);
3
- const video = document.createElement('video');
4
- video.src = URL.createObjectURL(blob);
5
- return video;
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
- //# sourceMappingURL=parse-video.js.map
13
+ exports.default = parseVideo;
@@ -0,0 +1,2 @@
1
+ export declare function assert(condition: unknown, message: string): void;
2
+ //# sourceMappingURL=assert.d.ts.map
@@ -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"}
@@ -1,6 +1,9 @@
1
- export function assert(condition, message) {
2
- if (!condition) {
3
- throw new Error(message);
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
- //# sourceMappingURL=assert.js.map
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"}
@@ -1,19 +1,27 @@
1
- import parseVideo from './lib/parsers/parse-video';
2
- const VERSION = typeof "4.0.0-alpha.4" !== 'undefined' ? "4.0.0-alpha.4" : 'latest';
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
- video: {}
14
+ video: {}
7
15
  };
8
- export const VideoLoader = {
9
- name: 'Video',
10
- id: 'video',
11
- module: 'video',
12
- version: VERSION,
13
- extensions: EXTENSIONS,
14
- mimeTypes: MIME_TYPES,
15
- parse: parseVideo,
16
- options: DEFAULT_LOADER_OPTIONS
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
- export const _typecheckVideoLoader = VideoLoader;
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.4",
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": "src/index.ts",
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/bundle.js"
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.4",
36
- "@loaders.gl/worker-utils": "4.0.0-alpha.4",
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": "53026061b3c8871f7e96d3a5826125cc6613bddc"
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 './libs/gifshot'; // TODO - load dynamically to avoid bloating
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
  }