@loaders.gl/video 4.4.2 → 5.0.0-alpha.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 (43) hide show
  1. package/dist/bundled.d.ts +3 -0
  2. package/dist/bundled.d.ts.map +1 -0
  3. package/dist/bundled.js +5 -0
  4. package/dist/bundled.js.map +1 -0
  5. package/dist/dist.dev.js +120 -51
  6. package/dist/dist.min.js +1 -1
  7. package/dist/gif-builder.d.ts +1 -1
  8. package/dist/gif-builder.js +2 -2
  9. package/dist/gif-builder.js.map +1 -1
  10. package/dist/index.cjs +118 -51
  11. package/dist/index.cjs.map +4 -4
  12. package/dist/index.d.ts +2 -0
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +1 -0
  15. package/dist/index.js.map +1 -1
  16. package/dist/lib/gifshot/gifshot.d.ts.map +1 -1
  17. package/dist/lib/gifshot/gifshot.js +40 -28
  18. package/dist/lib/gifshot/gifshot.js.map +1 -1
  19. package/dist/unbundled.d.ts +3 -0
  20. package/dist/unbundled.d.ts.map +1 -0
  21. package/dist/unbundled.js +5 -0
  22. package/dist/unbundled.js.map +1 -0
  23. package/dist/video-format.d.ts +13 -0
  24. package/dist/video-format.d.ts.map +1 -0
  25. package/dist/video-format.js +16 -0
  26. package/dist/video-format.js.map +1 -0
  27. package/dist/video-loader-with-parser.d.ts +27 -0
  28. package/dist/video-loader-with-parser.d.ts.map +1 -0
  29. package/dist/video-loader-with-parser.js +14 -0
  30. package/dist/video-loader-with-parser.js.map +1 -0
  31. package/dist/video-loader.d.ts +30 -9
  32. package/dist/video-loader.d.ts.map +1 -1
  33. package/dist/video-loader.js +10 -11
  34. package/dist/video-loader.js.map +1 -1
  35. package/package.json +13 -5
  36. package/src/bundled.ts +6 -0
  37. package/src/gif-builder.ts +2 -2
  38. package/src/index.ts +2 -0
  39. package/src/lib/gifshot/gifshot.ts +39 -28
  40. package/src/unbundled.ts +6 -0
  41. package/src/video-format.ts +18 -0
  42. package/src/video-loader-with-parser.ts +21 -0
  43. package/src/video-loader.ts +12 -12
@@ -0,0 +1,5 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ export { VideoLoader } from "./video-loader.js";
5
+ //# sourceMappingURL=unbundled.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unbundled.js","sourceRoot":"","sources":["../src/unbundled.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,WAAW,EAAC,0BAAuB"}
@@ -0,0 +1,13 @@
1
+ /** Video media format. */
2
+ export declare const VideoFormat: {
3
+ readonly name: "Video";
4
+ readonly id: "video";
5
+ readonly module: "video";
6
+ readonly encoding: "video";
7
+ readonly format: "video";
8
+ readonly extensions: ["mp4"];
9
+ readonly mimeTypes: ["video/mp4"];
10
+ readonly category: "video";
11
+ readonly binary: true;
12
+ };
13
+ //# sourceMappingURL=video-format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-format.d.ts","sourceRoot":"","sources":["../src/video-format.ts"],"names":[],"mappings":"AAMA,0BAA0B;AAC1B,eAAO,MAAM,WAAW;;;;;;;;;;CAUG,CAAC"}
@@ -0,0 +1,16 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /** Video media format. */
5
+ export const VideoFormat = {
6
+ name: 'Video',
7
+ id: 'video',
8
+ module: 'video',
9
+ encoding: 'video',
10
+ format: 'video',
11
+ extensions: ['mp4'],
12
+ mimeTypes: ['video/mp4'],
13
+ category: 'video',
14
+ binary: true
15
+ };
16
+ //# sourceMappingURL=video-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-format.js","sourceRoot":"","sources":["../src/video-format.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAIpC,0BAA0B;AAC1B,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,OAAO;IACb,EAAE,EAAE,OAAO;IACX,MAAM,EAAE,OAAO;IACf,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,OAAO;IACf,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,SAAS,EAAE,CAAC,WAAW,CAAC;IACxB,QAAQ,EAAE,OAAO;IACjB,MAAM,EAAE,IAAI;CACa,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { LoaderOptions } from '@loaders.gl/loader-utils';
2
+ import parseVideo from "./lib/parsers/parse-video.js";
3
+ export type VideoLoaderOptions = LoaderOptions & {
4
+ video: {};
5
+ };
6
+ /**
7
+ * Loads a platform-specific image type that can be used as input data to WebGL textures
8
+ */
9
+ export declare const VideoLoaderWithParser: {
10
+ readonly parse: typeof parseVideo;
11
+ readonly version: any;
12
+ readonly options: {
13
+ readonly video: {};
14
+ };
15
+ readonly name: "Video";
16
+ readonly id: "video";
17
+ readonly module: "video";
18
+ readonly encoding: "video";
19
+ readonly format: "video";
20
+ readonly extensions: ["mp4"];
21
+ readonly mimeTypes: ["video/mp4"];
22
+ readonly category: "video";
23
+ readonly binary: true;
24
+ readonly dataType: HTMLVideoElement;
25
+ readonly batchType: never;
26
+ };
27
+ //# sourceMappingURL=video-loader-with-parser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-loader-with-parser.d.ts","sourceRoot":"","sources":["../src/video-loader-with-parser.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,UAAU,qCAAkC;AAKnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,EAAE,EAAE,CAAC;CACX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;CAGgD,CAAC"}
@@ -0,0 +1,14 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ import parseVideo from "./lib/parsers/parse-video.js";
5
+ import { VideoLoader as VideoLoaderMetadata } from "./video-loader.js";
6
+ const { preload: _VideoLoaderPreload, ...VideoLoaderMetadataWithoutPreload } = VideoLoaderMetadata;
7
+ /**
8
+ * Loads a platform-specific image type that can be used as input data to WebGL textures
9
+ */
10
+ export const VideoLoaderWithParser = {
11
+ ...VideoLoaderMetadataWithoutPreload,
12
+ parse: parseVideo
13
+ };
14
+ //# sourceMappingURL=video-loader-with-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-loader-with-parser.js","sourceRoot":"","sources":["../src/video-loader-with-parser.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,UAAU,qCAAkC;AACnD,OAAO,EAAC,WAAW,IAAI,mBAAmB,EAAC,0BAAuB;AAElE,MAAM,EAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,iCAAiC,EAAC,GAAG,mBAAmB,CAAC;AAMjG;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,GAAG,iCAAiC;IACpC,KAAK,EAAE,UAAU;CAC+D,CAAC"}
@@ -1,23 +1,44 @@
1
1
  import type { LoaderOptions } from '@loaders.gl/loader-utils';
2
- import parseVideo from "./lib/parsers/parse-video.js";
3
2
  export type VideoLoaderOptions = LoaderOptions & {
4
3
  video: {};
5
4
  };
6
- /**
7
- * Loads a platform-specific image type that can be used as input data to WebGL textures
8
- */
9
- export declare const VideoLoader: {
10
- readonly dataType: HTMLVideoElement;
11
- readonly batchType: never;
5
+ /** Preloads the parser-bearing video loader implementation. */
6
+ declare function preload(): Promise<{
7
+ readonly parse: typeof import("./lib/parsers/parse-video").default;
8
+ readonly version: any;
9
+ readonly options: {
10
+ readonly video: {};
11
+ };
12
12
  readonly name: "Video";
13
13
  readonly id: "video";
14
14
  readonly module: "video";
15
- readonly version: any;
15
+ readonly encoding: "video";
16
+ readonly format: "video";
16
17
  readonly extensions: ["mp4"];
17
18
  readonly mimeTypes: ["video/mp4"];
19
+ readonly category: "video";
20
+ readonly binary: true;
21
+ readonly dataType: HTMLVideoElement;
22
+ readonly batchType: never;
23
+ }>;
24
+ /** Metadata-only loader for platform-specific video elements. */
25
+ export declare const VideoLoader: {
26
+ readonly version: any;
18
27
  readonly options: {
19
28
  readonly video: {};
20
29
  };
21
- readonly parse: typeof parseVideo;
30
+ readonly preload: typeof preload;
31
+ readonly name: "Video";
32
+ readonly id: "video";
33
+ readonly module: "video";
34
+ readonly encoding: "video";
35
+ readonly format: "video";
36
+ readonly extensions: ["mp4"];
37
+ readonly mimeTypes: ["video/mp4"];
38
+ readonly category: "video";
39
+ readonly binary: true;
40
+ readonly dataType: HTMLVideoElement;
41
+ readonly batchType: never;
22
42
  };
43
+ export {};
23
44
  //# sourceMappingURL=video-loader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"video-loader.d.ts","sourceRoot":"","sources":["../src/video-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAC9E,OAAO,UAAU,qCAAkC;AAMnD,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,EAAE,EAAE,CAAC;CACX,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW;uBACO,gBAAgB;wBAC1B,KAAK;;;;;;;;;;;CAYwD,CAAC"}
1
+ {"version":3,"file":"video-loader.d.ts","sourceRoot":"","sources":["../src/video-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAOpE,MAAM,MAAM,kBAAkB,GAAG,aAAa,GAAG;IAC/C,KAAK,EAAE,EAAE,CAAC;CACX,CAAC;AAEF,+DAA+D;AAC/D,iBAAe,OAAO;;;;;;;;;;;;;;;uBAOS,gBAAgB;wBAC1B,KAAK;GALzB;AAED,iEAAiE;AACjE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;uBACO,gBAAgB;wBAC1B,KAAK;CAQ8C,CAAC"}
@@ -1,26 +1,25 @@
1
1
  // loaders.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
- import parseVideo from "./lib/parsers/parse-video.js";
4
+ import { VideoFormat } from "./video-format.js";
5
5
  // __VERSION__ is injected by babel-plugin-version-inline
6
6
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
7
- const VERSION = typeof "4.4.2" !== 'undefined' ? "4.4.2" : 'latest';
8
- /**
9
- * Loads a platform-specific image type that can be used as input data to WebGL textures
10
- */
7
+ const VERSION = typeof "5.0.0-alpha.1" !== 'undefined' ? "5.0.0-alpha.1" : 'latest';
8
+ /** Preloads the parser-bearing video loader implementation. */
9
+ async function preload() {
10
+ const { VideoLoaderWithParser } = await import("./video-loader-with-parser.js");
11
+ return VideoLoaderWithParser;
12
+ }
13
+ /** Metadata-only loader for platform-specific video elements. */
11
14
  export const VideoLoader = {
12
15
  dataType: null,
13
16
  batchType: null,
14
- name: 'Video',
15
- id: 'video',
16
- module: 'video',
17
+ ...VideoFormat,
17
18
  version: VERSION,
18
- extensions: ['mp4'],
19
- mimeTypes: ['video/mp4'],
20
19
  // tests: arrayBuffer => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer))),
21
20
  options: {
22
21
  video: {}
23
22
  },
24
- parse: parseVideo
23
+ preload
25
24
  };
26
25
  //# sourceMappingURL=video-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"video-loader.js","sourceRoot":"","sources":["../src/video-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,UAAU,qCAAkC;AAEnD,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,cAAkB,KAAK,WAAW,CAAC,CAAC,SAAa,CAAC,CAAC,QAAQ,CAAC;AAM5E;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,IAAmC;IAC7C,SAAS,EAAE,IAAa;IACxB,IAAI,EAAE,OAAO;IACb,EAAE,EAAE,OAAO;IACX,MAAM,EAAE,OAAO;IACf,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,CAAC,KAAK,CAAC;IACnB,SAAS,EAAE,CAAC,WAAW,CAAC;IACxB,oFAAoF;IACpF,OAAO,EAAE;QACP,KAAK,EAAE,EAAE;KACV;IACD,KAAK,EAAE,UAAU;CAC+D,CAAC"}
1
+ {"version":3,"file":"video-loader.js","sourceRoot":"","sources":["../src/video-loader.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAE3C,yDAAyD;AACzD,qDAAqD;AACrD,MAAM,OAAO,GAAG,sBAAkB,KAAK,WAAW,CAAC,CAAC,iBAAa,CAAC,CAAC,QAAQ,CAAC;AAM5E,+DAA+D;AAC/D,KAAK,UAAU,OAAO;IACpB,MAAM,EAAC,qBAAqB,EAAC,GAAG,MAAM,MAAM,iCAA8B,CAAC;IAC3E,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,iEAAiE;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,QAAQ,EAAE,IAAmC;IAC7C,SAAS,EAAE,IAAa;IACxB,GAAG,WAAW;IACd,OAAO,EAAE,OAAO;IAChB,oFAAoF;IACpF,OAAO,EAAE;QACP,KAAK,EAAE,EAAE;KACV;IACD,OAAO;CAC+D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/video",
3
- "version": "4.4.2",
3
+ "version": "5.0.0-alpha.1",
4
4
  "description": "Framework-independent loaders and writers for video (MP4, WEBM, ...)",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,6 +27,14 @@
27
27
  "types": "./dist/index.d.ts",
28
28
  "import": "./dist/index.js",
29
29
  "require": "./dist/index.cjs"
30
+ },
31
+ "./unbundled": {
32
+ "types": "./dist/unbundled.d.ts",
33
+ "import": "./dist/unbundled.js"
34
+ },
35
+ "./bundled": {
36
+ "types": "./dist/bundled.d.ts",
37
+ "import": "./dist/bundled.js"
30
38
  }
31
39
  },
32
40
  "sideEffects": false,
@@ -41,12 +49,12 @@
41
49
  "build-bundle-dev": "ocular-bundle ./bundle.ts --env=dev --output=dist/dist.dev.js"
42
50
  },
43
51
  "dependencies": {
44
- "@loaders.gl/loader-utils": "4.4.2",
45
- "@loaders.gl/worker-utils": "4.4.2",
52
+ "@loaders.gl/loader-utils": "5.0.0-alpha.1",
53
+ "@loaders.gl/worker-utils": "5.0.0-alpha.1",
46
54
  "gifshot": "^0.4.5"
47
55
  },
48
56
  "peerDependencies": {
49
- "@loaders.gl/core": "~4.4.0"
57
+ "@loaders.gl/core": "~5.0.0-alpha.0"
50
58
  },
51
- "gitHead": "1c9649781db0403dbf7c3f1224bbeec77bd812eb"
59
+ "gitHead": "77a55028e8204e09df1258f10cb61ed35353b258"
52
60
  }
package/src/bundled.ts ADDED
@@ -0,0 +1,6 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ export type {VideoLoaderOptions} from './video-loader-with-parser';
6
+ export {VideoLoaderWithParser as VideoLoader} from './video-loader-with-parser';
@@ -16,7 +16,7 @@ const GIF_BUILDER_OPTIONS = {
16
16
  crossOrigin: 'Anonymous', // Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.
17
17
 
18
18
  // CALLBACKS
19
- progressCallback: (captureProgress) => {}, // Callback that provides the current progress of the current image
19
+ progressCallback: _captureProgress => {}, // Callback that provides the current progress of the current image
20
20
  completeCallback: () => {}, // Callback function that is called when the current image is completed
21
21
 
22
22
  // QUALITY SETTINGS
@@ -122,7 +122,7 @@ export default class GIFBuilder {
122
122
 
123
123
  async _createGIF(): Promise<string> {
124
124
  return new Promise((resolve, reject) => {
125
- this.gifshot.createGIF(this.options, (result) => {
125
+ this.gifshot.createGIF(this.options, result => {
126
126
  // callback object properties
127
127
  // --------------------------
128
128
  // image - Base 64 image
package/src/index.ts CHANGED
@@ -2,6 +2,8 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
+ export type {VideoLoaderOptions} from './video-loader';
6
+ export {VideoFormat} from './video-format';
5
7
  export {VideoLoader} from './video-loader';
6
8
 
7
9
  export {default as GIFBuilder} from './gif-builder';
@@ -49,7 +49,11 @@ var utils = {
49
49
  const loop = function loop() {
50
50
  const current = new Date().getTime();
51
51
  const delta = current - start;
52
- delta >= delay ? callback.call() : (handle.value = requestAnimFrame(loop));
52
+ if (delta >= delay) {
53
+ callback.call();
54
+ } else {
55
+ handle.value = requestAnimFrame(loop);
56
+ }
53
57
  };
54
58
  handle.value = requestAnimFrame(loop);
55
59
  return handle;
@@ -83,9 +87,9 @@ var utils = {
83
87
  enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
84
88
  enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
85
89
  enc4 = chr3 & 63;
86
- if (isNaN(chr2)) {
90
+ if (Number.isNaN(chr2)) {
87
91
  enc3 = enc4 = 64;
88
- } else if (isNaN(chr3)) {
92
+ } else if (Number.isNaN(chr3)) {
89
93
  enc4 = 64;
90
94
  }
91
95
  output =
@@ -110,6 +114,12 @@ var utils = {
110
114
  isElement: function isElement(elem) {
111
115
  return elem && elem.nodeType === 1;
112
116
  },
117
+ isImageBitmap: function isImageBitmap(image) {
118
+ return typeof ImageBitmap !== 'undefined' && image instanceof ImageBitmap;
119
+ },
120
+ isDrawable: function isDrawable(image) {
121
+ return utils.isElement(image) || utils.isImageBitmap(image);
122
+ },
113
123
  isString: function isString(value) {
114
124
  return typeof value === 'string' || Object.prototype.toString.call(value) === '[object String]';
115
125
  },
@@ -154,7 +164,7 @@ var utils = {
154
164
  // Check for Webm support
155
165
  supportObj.webm = testEl.canPlayType('video/webm; codecs="vp8, vorbis"') !== -1;
156
166
  }
157
- } catch (e) {}
167
+ } catch (_e) {}
158
168
  return supportObj;
159
169
  })()
160
170
  },
@@ -495,7 +505,7 @@ function NeuQuant() {
495
505
  const intbiasshift = 16; // bias for fractions
496
506
  const intbias = 1 << intbiasshift;
497
507
  const gammashift = 10; // gamma = 1024
498
- const gamma = 1 << gammashift;
508
+ const _gamma = 1 << gammashift;
499
509
  const betashift = 10;
500
510
  const beta = intbias >> betashift; // beta = 1/1024
501
511
  const betagamma = intbias << (gammashift - betashift);
@@ -589,7 +599,7 @@ function NeuQuant() {
589
599
  }
590
600
  q = network[smallpos];
591
601
  // swap p (i) and q (smallpos) entries
592
- if (i != smallpos) {
602
+ if (i !== smallpos) {
593
603
  j = q[0];
594
604
  q[0] = p[0];
595
605
  p[0] = j;
@@ -604,7 +614,7 @@ function NeuQuant() {
604
614
  p[3] = j;
605
615
  }
606
616
  // smallval entry is now in position i
607
- if (smallval != previouscol) {
617
+ if (smallval !== previouscol) {
608
618
  netindex[previouscol] = (startpos + i) >> 1;
609
619
  for (j = previouscol + 1; j < smallval; j++) {
610
620
  netindex[j] = i;
@@ -779,7 +789,7 @@ function NeuQuant() {
779
789
  // to prepare for sort
780
790
  function unbiasnet() {
781
791
  let i;
782
- let j;
792
+ let _j;
783
793
  for (i = 0; i < netsize; i++) {
784
794
  network[i][0] >>= netbiasshift;
785
795
  network[i][1] >>= netbiasshift;
@@ -816,7 +826,7 @@ function NeuQuant() {
816
826
  p[0] -= ((a * (p[0] - b)) / alpharadbias) | 0;
817
827
  p[1] -= ((a * (p[1] - g)) / alpharadbias) | 0;
818
828
  p[2] -= ((a * (p[2] - r)) / alpharadbias) | 0;
819
- } catch (e) {}
829
+ } catch (_e) {}
820
830
  }
821
831
  if (k > lo) {
822
832
  p = network[k--];
@@ -824,7 +834,7 @@ function NeuQuant() {
824
834
  p[0] -= ((a * (p[0] - b)) / alpharadbias) | 0;
825
835
  p[1] -= ((a * (p[1] - g)) / alpharadbias) | 0;
826
836
  p[2] -= ((a * (p[2] - r)) / alpharadbias) | 0;
827
- } catch (e) {}
837
+ } catch (_e) {}
828
838
  }
829
839
  }
830
840
  }
@@ -903,7 +913,7 @@ function NeuQuant() {
903
913
  * Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
904
914
  */
905
915
  function workerCode() {
906
- const self = this;
916
+ const _self = this;
907
917
  try {
908
918
  globalThis.onmessage = function (ev) {
909
919
  const data = ev.data || {};
@@ -913,7 +923,7 @@ function workerCode() {
913
923
  postMessage(response);
914
924
  }
915
925
  };
916
- } catch (e) {}
926
+ } catch (_e) {}
917
927
  var workerMethods = {
918
928
  dataToRGB: function dataToRGB(data, width, height) {
919
929
  const length = width * height * 4;
@@ -967,7 +977,7 @@ function workerCode() {
967
977
  frame = frame || {};
968
978
  const _frame = frame;
969
979
  const height = _frame.height;
970
- const palette = _frame.palette;
980
+ const _palette = _frame.palette;
971
981
  const sampleInterval = _frame.sampleInterval;
972
982
  const width = _frame.width;
973
983
  const imageData = frame.data;
@@ -1087,8 +1097,10 @@ function gifWriter(buf, width, height, gopts) {
1087
1097
  let num_colors = check_palette_and_num_colors(palette);
1088
1098
  // Compute the min_code_size (power of 2), destroying num_colors.
1089
1099
  let min_code_size = 0;
1090
- while ((num_colors >>= 1)) {
1100
+ num_colors >>= 1;
1101
+ while (num_colors) {
1091
1102
  ++min_code_size;
1103
+ num_colors >>= 1;
1092
1104
  }
1093
1105
  num_colors = 1 << min_code_size; // Now we can easily get it back.
1094
1106
  const delay = opts.delay === undefined ? 0 : opts.delay;
@@ -1406,7 +1418,6 @@ AnimatedGIF.prototype = {
1406
1418
  },
1407
1419
  processFrame: function processFrame(position) {
1408
1420
  const AnimatedGifContext = this;
1409
- const options = this.options;
1410
1421
  const _options = this.options;
1411
1422
  const progressCallback = _options.progressCallback;
1412
1423
  const sampleInterval = _options.sampleInterval;
@@ -1523,8 +1534,8 @@ AnimatedGIF.prototype = {
1523
1534
  const fontColor = _gifshotOptions.fontColor;
1524
1535
  const fontFamily = _gifshotOptions.fontFamily;
1525
1536
  const fontWeight = _gifshotOptions.fontWeight;
1526
- const gifHeight = _gifshotOptions.gifHeight;
1527
- const gifWidth = _gifshotOptions.gifWidth;
1537
+ const _gifHeight = _gifshotOptions.gifHeight;
1538
+ const _gifWidth = _gifshotOptions.gifWidth;
1528
1539
  const text = _gifshotOptions.text;
1529
1540
  const textAlign = _gifshotOptions.textAlign;
1530
1541
  const textBaseline = _gifshotOptions.textBaseline;
@@ -1630,7 +1641,7 @@ function getBase64GIF(animatedGifInstance, callback) {
1630
1641
  */
1631
1642
  function existingImages() {
1632
1643
  const obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1633
- const self = this;
1644
+ const _self = this;
1634
1645
  const callback = obj.callback;
1635
1646
  const images = obj.images;
1636
1647
  const options = obj.options;
@@ -1654,7 +1665,7 @@ function existingImages() {
1654
1665
  // if (image.src) {
1655
1666
  // currentImage = currentImage.src;
1656
1667
  // }
1657
- if (utils.isElement(currentImage)) {
1668
+ if (utils.isDrawable(currentImage)) {
1658
1669
  if (options.crossOrigin) {
1659
1670
  currentImage.crossOrigin = options.crossOrigin;
1660
1671
  }
@@ -1743,7 +1754,7 @@ const screenShot = {
1743
1754
  const fontFamily = options.fontFamily;
1744
1755
  const fontWeight = options.fontWeight;
1745
1756
  const keepCameraOn = options.keepCameraOn;
1746
- const numWorkers = options.numWorkers;
1757
+ const _numWorkers = options.numWorkers;
1747
1758
  const progressCallback = options.progressCallback;
1748
1759
  const saveRenderingContexts = options.saveRenderingContexts;
1749
1760
  const savedRenderingContexts = options.savedRenderingContexts;
@@ -1757,7 +1768,7 @@ const screenShot = {
1757
1768
  const gifWidth = Number(options.gifWidth);
1758
1769
  const gifHeight = Number(options.gifHeight);
1759
1770
  let interval = Number(options.interval);
1760
- const sampleInterval = Number(options.sampleInterval);
1771
+ const _sampleInterval = Number(options.sampleInterval);
1761
1772
  const waitBetweenFrames = hasExistingImages ? 0 : interval * 1000;
1762
1773
  const renderingContextsToSave = [];
1763
1774
  let numFrames = savedRenderingContexts.length
@@ -1981,7 +1992,7 @@ var videoStream = {
1981
1992
  } else if (existingVideo instanceof Blob) {
1982
1993
  try {
1983
1994
  videoElement.src = utils.URL.createObjectURL(existingVideo);
1984
- } catch (e) {}
1995
+ } catch (_e) {}
1985
1996
  videoElement.innerHTML = `<source src="${existingVideo}" type="${existingVideo.type}" />`;
1986
1997
  }
1987
1998
  } else if (videoElement.mozSrcObject) {
@@ -1990,7 +2001,7 @@ var videoStream = {
1990
2001
  try {
1991
2002
  videoElement.srcObject = cameraStream;
1992
2003
  videoElement.src = utils.URL.createObjectURL(cameraStream);
1993
- } catch (e) {
2004
+ } catch (_e) {
1994
2005
  videoElement.srcObject = cameraStream;
1995
2006
  }
1996
2007
  }
@@ -2032,7 +2043,7 @@ var videoStream = {
2032
2043
  : webcamVideoElement
2033
2044
  ? webcamVideoElement
2034
2045
  : document.createElement('video');
2035
- const cameraStream = void 0;
2046
+ const _cameraStream = void 0;
2036
2047
  if (crossOrigin) {
2037
2048
  videoElement.crossOrigin = options.crossOrigin;
2038
2049
  }
@@ -2178,7 +2189,7 @@ function createAndGetGIF(obj, callback) {
2178
2189
  const video = options.video;
2179
2190
  const gifWidth = Number(options.gifWidth);
2180
2191
  const gifHeight = Number(options.gifHeight);
2181
- const numFrames = Number(options.numFrames);
2192
+ const _numFrames = Number(options.numFrames);
2182
2193
  const cameraStream = obj.cameraStream;
2183
2194
  const videoElement = obj.videoElement;
2184
2195
  const videoWidth = obj.videoWidth;
@@ -2234,11 +2245,11 @@ function existingVideo() {
2234
2245
  'globalThis.URL': true
2235
2246
  };
2236
2247
  const errorObj = error.validate(skipObj);
2237
- const loadedImages = 0;
2248
+ const _loadedImages = 0;
2238
2249
  let videoType = void 0;
2239
2250
  let videoSrc = void 0;
2240
- const tempImage = void 0;
2241
- const ag = void 0;
2251
+ const _tempImage = void 0;
2252
+ const _ag = void 0;
2242
2253
  if (errorObj.error) {
2243
2254
  return callback(errorObj);
2244
2255
  }
@@ -0,0 +1,6 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ export type {VideoLoaderOptions} from './video-loader';
6
+ export {VideoLoader} from './video-loader';
@@ -0,0 +1,18 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {Format} from '@loaders.gl/loader-utils';
6
+
7
+ /** Video media format. */
8
+ export const VideoFormat = {
9
+ name: 'Video',
10
+ id: 'video',
11
+ module: 'video',
12
+ encoding: 'video',
13
+ format: 'video',
14
+ extensions: ['mp4'],
15
+ mimeTypes: ['video/mp4'],
16
+ category: 'video',
17
+ binary: true
18
+ } as const satisfies Format;
@@ -0,0 +1,21 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
6
+ import parseVideo from './lib/parsers/parse-video';
7
+ import {VideoLoader as VideoLoaderMetadata} from './video-loader';
8
+
9
+ const {preload: _VideoLoaderPreload, ...VideoLoaderMetadataWithoutPreload} = VideoLoaderMetadata;
10
+
11
+ export type VideoLoaderOptions = LoaderOptions & {
12
+ video: {};
13
+ };
14
+
15
+ /**
16
+ * Loads a platform-specific image type that can be used as input data to WebGL textures
17
+ */
18
+ export const VideoLoaderWithParser = {
19
+ ...VideoLoaderMetadataWithoutPreload,
20
+ parse: parseVideo
21
+ } as const satisfies LoaderWithParser<HTMLVideoElement, never, VideoLoaderOptions>;
@@ -2,8 +2,8 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
6
- import parseVideo from './lib/parsers/parse-video';
5
+ import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
6
+ import {VideoFormat} from './video-format';
7
7
 
8
8
  // __VERSION__ is injected by babel-plugin-version-inline
9
9
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
@@ -13,21 +13,21 @@ export type VideoLoaderOptions = LoaderOptions & {
13
13
  video: {};
14
14
  };
15
15
 
16
- /**
17
- * Loads a platform-specific image type that can be used as input data to WebGL textures
18
- */
16
+ /** Preloads the parser-bearing video loader implementation. */
17
+ async function preload() {
18
+ const {VideoLoaderWithParser} = await import('./video-loader-with-parser');
19
+ return VideoLoaderWithParser;
20
+ }
21
+
22
+ /** Metadata-only loader for platform-specific video elements. */
19
23
  export const VideoLoader = {
20
24
  dataType: null as unknown as HTMLVideoElement,
21
25
  batchType: null as never,
22
- name: 'Video',
23
- id: 'video',
24
- module: 'video',
26
+ ...VideoFormat,
25
27
  version: VERSION,
26
- extensions: ['mp4'],
27
- mimeTypes: ['video/mp4'],
28
28
  // tests: arrayBuffer => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer))),
29
29
  options: {
30
30
  video: {}
31
31
  },
32
- parse: parseVideo
33
- } as const satisfies LoaderWithParser<HTMLVideoElement, never, VideoLoaderOptions>;
32
+ preload
33
+ } as const satisfies Loader<HTMLVideoElement, never, VideoLoaderOptions>;