@loaders.gl/video 3.1.0-alpha.2 → 3.1.0-beta.1

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 (83) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +2143 -5
  4. package/dist/es5/bundle.js +7 -0
  5. package/dist/es5/bundle.js.map +1 -0
  6. package/dist/es5/gif-builder.js +134 -0
  7. package/dist/es5/gif-builder.js.map +1 -0
  8. package/dist/es5/index.js +24 -0
  9. package/dist/es5/index.js.map +1 -0
  10. package/dist/es5/lib/gifshot/gifshot-loader.js +28 -0
  11. package/dist/es5/lib/gifshot/gifshot-loader.js.map +1 -0
  12. package/dist/es5/lib/gifshot/gifshot.js +2191 -0
  13. package/dist/es5/lib/gifshot/gifshot.js.map +1 -0
  14. package/dist/es5/lib/parsers/parse-video.js +14 -0
  15. package/dist/es5/lib/parsers/parse-video.js.map +1 -0
  16. package/dist/es5/lib/utils/assert.js +13 -0
  17. package/dist/es5/lib/utils/assert.js.map +1 -0
  18. package/dist/es5/lib/utils/globals.js +28 -0
  19. package/dist/es5/lib/utils/globals.js.map +1 -0
  20. package/dist/es5/video-loader.js +31 -0
  21. package/dist/es5/video-loader.js.map +1 -0
  22. package/dist/esm/bundle.js +5 -0
  23. package/dist/esm/bundle.js.map +1 -0
  24. package/dist/esm/gif-builder.js +120 -0
  25. package/dist/esm/gif-builder.js.map +1 -0
  26. package/dist/esm/index.js +3 -0
  27. package/dist/esm/index.js.map +1 -0
  28. package/dist/esm/lib/gifshot/gifshot-loader.js +19 -0
  29. package/dist/esm/lib/gifshot/gifshot-loader.js.map +1 -0
  30. package/dist/esm/lib/gifshot/gifshot.js +2184 -0
  31. package/dist/esm/lib/gifshot/gifshot.js.map +1 -0
  32. package/dist/esm/lib/parsers/parse-video.js +7 -0
  33. package/dist/esm/lib/parsers/parse-video.js.map +1 -0
  34. package/{src → dist/esm}/lib/utils/assert.js +1 -0
  35. package/dist/esm/lib/utils/assert.js.map +1 -0
  36. package/dist/esm/lib/utils/globals.js +16 -0
  37. package/dist/esm/lib/utils/globals.js.map +1 -0
  38. package/dist/esm/video-loader.js +19 -0
  39. package/dist/esm/video-loader.js.map +1 -0
  40. package/dist/gif-builder.d.ts +53 -0
  41. package/dist/gif-builder.d.ts.map +1 -0
  42. package/dist/gif-builder.js +136 -114
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.d.ts.map +1 -0
  45. package/dist/index.js +10 -3
  46. package/dist/lib/gifshot/gifshot-loader.d.ts +2 -0
  47. package/dist/lib/gifshot/gifshot-loader.d.ts.map +1 -0
  48. package/dist/lib/gifshot/gifshot-loader.js +18 -15
  49. package/dist/lib/gifshot/gifshot.d.ts +72 -0
  50. package/dist/lib/gifshot/gifshot.d.ts.map +1 -0
  51. package/dist/lib/gifshot/gifshot.js +2437 -0
  52. package/dist/lib/parsers/parse-video.d.ts +2 -0
  53. package/dist/lib/parsers/parse-video.d.ts.map +1 -0
  54. package/dist/lib/parsers/parse-video.js +12 -6
  55. package/dist/lib/utils/assert.d.ts +2 -0
  56. package/dist/lib/utils/assert.d.ts.map +1 -0
  57. package/dist/lib/utils/assert.js +8 -5
  58. package/dist/lib/utils/globals.d.ts +10 -0
  59. package/dist/lib/utils/globals.d.ts.map +1 -0
  60. package/dist/lib/utils/globals.js +19 -10
  61. package/dist/video-loader.d.ts +17 -0
  62. package/dist/video-loader.d.ts.map +1 -0
  63. package/dist/video-loader.js +22 -14
  64. package/package.json +8 -9
  65. package/src/bundle.ts +2 -3
  66. package/src/{gif-builder.js → gif-builder.ts} +7 -6
  67. package/src/lib/gifshot/{gifshot-loader.js → gifshot-loader.ts} +1 -0
  68. package/src/lib/gifshot/gifshot.ts +2415 -0
  69. package/src/lib/utils/assert.ts +5 -0
  70. package/src/lib/utils/globals.ts +25 -0
  71. package/dist/bundle.js.map +0 -1
  72. package/dist/dist.min.js +0 -2
  73. package/dist/dist.min.js.map +0 -1
  74. package/dist/gif-builder.js.map +0 -1
  75. package/dist/index.js.map +0 -1
  76. package/dist/lib/gifshot/gifshot-loader.js.map +0 -1
  77. package/dist/lib/parsers/parse-video.js.map +0 -1
  78. package/dist/lib/utils/assert.js.map +0 -1
  79. package/dist/lib/utils/globals.js.map +0 -1
  80. package/dist/libs/gifshot.js +0 -2826
  81. package/dist/video-loader.js.map +0 -1
  82. package/src/lib/utils/globals.js +0 -48
  83. 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,10 @@
1
+ /// <reference types="node" />
2
+ declare const self_: false | (Window & typeof globalThis) | (NodeJS.Global & typeof globalThis);
3
+ declare const window_: false | (Window & typeof globalThis) | (NodeJS.Global & typeof globalThis);
4
+ declare const global_: false | (Window & typeof globalThis) | (NodeJS.Global & typeof globalThis);
5
+ declare const document_: {};
6
+ export { self_ as self, window_ as window, global_ as global, document_ as document };
7
+ export declare const isBrowser: any;
8
+ export declare const isWorker: boolean;
9
+ export declare const nodeVersion: number;
10
+ //# sourceMappingURL=globals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/globals.ts"],"names":[],"mappings":";AAQA,QAAA,MAAM,KAAK,4EAAmD,CAAC;AAC/D,QAAA,MAAM,OAAO,4EAAmD,CAAC;AACjE,QAAA,MAAM,OAAO,4EAAmD,CAAC;AACjE,QAAA,MAAM,SAAS,IAAyB,CAAC;AAEzC,OAAO,EAAC,KAAK,IAAI,IAAI,EAAE,OAAO,IAAI,MAAM,EAAE,OAAO,IAAI,MAAM,EAAE,SAAS,IAAI,QAAQ,EAAC,CAAC;AAEpF,eAAO,MAAM,SAAS,KAEoE,CAAC;AAE3F,eAAO,MAAM,QAAQ,SAAsC,CAAC;AAK5D,eAAO,MAAM,WAAW,QAA2C,CAAC"}
@@ -1,16 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.nodeVersion = exports.isWorker = exports.isBrowser = exports.document = exports.global = exports.window = exports.self = void 0;
4
+ /* eslint-disable no-restricted-globals */
1
5
  const globals = {
2
- self: typeof self !== 'undefined' && self,
3
- window: typeof window !== 'undefined' && window,
4
- global: typeof global !== 'undefined' && global,
5
- document: typeof document !== 'undefined' && document
6
+ self: typeof self !== 'undefined' && self,
7
+ window: typeof window !== 'undefined' && window,
8
+ global: typeof global !== 'undefined' && global,
9
+ document: typeof document !== 'undefined' && document
6
10
  };
7
11
  const self_ = globals.self || globals.window || globals.global;
12
+ exports.self = self_;
8
13
  const window_ = globals.window || globals.self || globals.global;
14
+ exports.window = window_;
9
15
  const global_ = globals.global || globals.self || globals.window;
16
+ exports.global = global_;
10
17
  const document_ = globals.document || {};
11
- export { self_ as self, window_ as window, global_ as global, document_ as document };
12
- export const isBrowser = typeof process !== 'object' || String(process) !== '[object process]' || process.browser;
13
- export const isWorker = typeof importScripts === 'function';
14
- const matches = typeof process !== 'undefined' && process.version && process.version.match(/v([0-9]*)/);
15
- export const nodeVersion = matches && parseFloat(matches[1]) || 0;
16
- //# sourceMappingURL=globals.js.map
18
+ exports.document = document_;
19
+ exports.isBrowser =
20
+ // @ts-ignore
21
+ typeof process !== 'object' || String(process) !== '[object process]' || process.browser;
22
+ exports.isWorker = typeof importScripts === 'function';
23
+ // Extract node major version
24
+ const matches = typeof process !== 'undefined' && process.version && /v([0-9]*)/.exec(process.version);
25
+ exports.nodeVersion = (matches && parseFloat(matches[1])) || 0;
@@ -0,0 +1,17 @@
1
+ import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
2
+ import parseVideo from './lib/parsers/parse-video';
3
+ export declare 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,oBAAY,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 "3.1.0-alpha.2" !== 'undefined' ? "3.1.0-alpha.2" : '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": "3.1.0-alpha.2",
3
+ "version": "3.1.0-beta.1",
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,13 +29,12 @@
29
29
  ],
30
30
  "scripts": {
31
31
  "pre-build": "npm run build-bundle",
32
- "build-bundle": "webpack --display=minimal --config ../../scripts/webpack/bundle.js",
33
- "build-worker": "webpack --entry ./src/image-worker.js --output ./dist/image-worker.js --config ../../scripts/webpack/worker.js"
32
+ "build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/bundle.js"
34
33
  },
35
34
  "dependencies": {
36
- "@loaders.gl/loader-utils": "3.1.0-alpha.2",
37
- "@loaders.gl/worker-utils": "3.1.0-alpha.2",
35
+ "@loaders.gl/loader-utils": "3.1.0-beta.1",
36
+ "@loaders.gl/worker-utils": "3.1.0-beta.1",
38
37
  "gifshot": "^0.4.5"
39
38
  },
40
- "gitHead": "ca83b8f05a6874db93051d446266d9ea360affb2"
39
+ "gitHead": "980cdefb4e8ec9ef9c951d20c78cf77777707f49"
41
40
  }
package/src/bundle.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  // @ts-nocheck
2
2
  const moduleExports = require('./index');
3
- const _global = typeof window === 'undefined' ? global : window;
4
- _global.loaders = _global.loaders || {};
5
- module.exports = Object.assign(_global.loaders, moduleExports);
3
+ globalThis.loaders = globalThis.loaders || {};
4
+ module.exports = Object.assign(globalThis.loaders, moduleExports);
@@ -1,6 +1,7 @@
1
1
  // A GIFBuilder based on the gifshot module
2
+ // @ts-nocheck
2
3
  import {assert} from './lib/utils/assert';
3
- import gifshot from './libs/gifshot'; // TODO - load dynamically to avoid bloating
4
+ import gifshot from './lib/gifshot/gifshot'; // TODO - load dynamically to avoid bloating
4
5
 
5
6
  // These are gifshot module options
6
7
  const GIF_BUILDER_OPTIONS = {
@@ -82,17 +83,17 @@ export default class GIFBuilder {
82
83
  this.gifshot = gifshot;
83
84
  }
84
85
 
85
- async initialize(options) {
86
+ async initialize(options): void {
86
87
  // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)
87
88
  // this.gifshot = await loadGifshotModule(options);
88
89
  }
89
90
 
90
- async add(file) {
91
+ async add(file): void {
91
92
  await this.initialize();
92
93
  this.files.push(file);
93
94
  }
94
95
 
95
- async build() {
96
+ async build(): Promise<string> {
96
97
  await this.initialize();
97
98
  this._cleanOptions(this.options);
98
99
 
@@ -115,7 +116,7 @@ export default class GIFBuilder {
115
116
 
116
117
  // PRIVATE
117
118
 
118
- async _createGIF() {
119
+ async _createGIF(): Promise<string> {
119
120
  return new Promise((resolve, reject) => {
120
121
  this.gifshot.createGIF(this.options, (result) => {
121
122
  // callback object properties
@@ -144,7 +145,7 @@ export default class GIFBuilder {
144
145
  }
145
146
 
146
147
  // Remove some gifshot options
147
- _cleanOptions(options) {
148
+ _cleanOptions(options): void {
148
149
  if (options.video || options.images || options.gifWidth || options.gifHeight) {
149
150
  console.warn('GIFBuilder: ignoring options'); // eslint-disable-line
150
151
  }
@@ -1,3 +1,4 @@
1
+ // @ts-nocheck
1
2
  import {loadLibrary} from '@loaders.gl/worker-utils';
2
3
 
3
4
  let loadGifshotPromise;