@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.
- package/dist/bundled.d.ts +3 -0
- package/dist/bundled.d.ts.map +1 -0
- package/dist/bundled.js +5 -0
- package/dist/bundled.js.map +1 -0
- package/dist/dist.dev.js +120 -51
- package/dist/dist.min.js +1 -1
- package/dist/gif-builder.d.ts +1 -1
- package/dist/gif-builder.js +2 -2
- package/dist/gif-builder.js.map +1 -1
- package/dist/index.cjs +118 -51
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/gifshot/gifshot.d.ts.map +1 -1
- package/dist/lib/gifshot/gifshot.js +40 -28
- package/dist/lib/gifshot/gifshot.js.map +1 -1
- package/dist/unbundled.d.ts +3 -0
- package/dist/unbundled.d.ts.map +1 -0
- package/dist/unbundled.js +5 -0
- package/dist/unbundled.js.map +1 -0
- package/dist/video-format.d.ts +13 -0
- package/dist/video-format.d.ts.map +1 -0
- package/dist/video-format.js +16 -0
- package/dist/video-format.js.map +1 -0
- package/dist/video-loader-with-parser.d.ts +27 -0
- package/dist/video-loader-with-parser.d.ts.map +1 -0
- package/dist/video-loader-with-parser.js +14 -0
- package/dist/video-loader-with-parser.js.map +1 -0
- package/dist/video-loader.d.ts +30 -9
- package/dist/video-loader.d.ts.map +1 -1
- package/dist/video-loader.js +10 -11
- package/dist/video-loader.js.map +1 -1
- package/package.json +13 -5
- package/src/bundled.ts +6 -0
- package/src/gif-builder.ts +2 -2
- package/src/index.ts +2 -0
- package/src/lib/gifshot/gifshot.ts +39 -28
- package/src/unbundled.ts +6 -0
- package/src/video-format.ts +18 -0
- package/src/video-loader-with-parser.ts +21 -0
- package/src/video-loader.ts +12 -12
package/dist/index.cjs
CHANGED
|
@@ -3,6 +3,9 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
6
9
|
var __export = (target, all) => {
|
|
7
10
|
for (var name in all)
|
|
8
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -17,13 +20,24 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
20
|
};
|
|
18
21
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
22
|
|
|
20
|
-
// dist/
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// dist/video-format.js
|
|
24
|
+
var VideoFormat;
|
|
25
|
+
var init_video_format = __esm({
|
|
26
|
+
"dist/video-format.js"() {
|
|
27
|
+
"use strict";
|
|
28
|
+
VideoFormat = {
|
|
29
|
+
name: "Video",
|
|
30
|
+
id: "video",
|
|
31
|
+
module: "video",
|
|
32
|
+
encoding: "video",
|
|
33
|
+
format: "video",
|
|
34
|
+
extensions: ["mp4"],
|
|
35
|
+
mimeTypes: ["video/mp4"],
|
|
36
|
+
category: "video",
|
|
37
|
+
binary: true
|
|
38
|
+
};
|
|
39
|
+
}
|
|
25
40
|
});
|
|
26
|
-
module.exports = __toCommonJS(dist_exports);
|
|
27
41
|
|
|
28
42
|
// dist/lib/parsers/parse-video.js
|
|
29
43
|
async function parseVideo(arrayBuffer) {
|
|
@@ -32,24 +46,66 @@ async function parseVideo(arrayBuffer) {
|
|
|
32
46
|
video.src = URL.createObjectURL(blob2);
|
|
33
47
|
return video;
|
|
34
48
|
}
|
|
49
|
+
var init_parse_video = __esm({
|
|
50
|
+
"dist/lib/parsers/parse-video.js"() {
|
|
51
|
+
"use strict";
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// dist/video-loader-with-parser.js
|
|
56
|
+
var video_loader_with_parser_exports = {};
|
|
57
|
+
__export(video_loader_with_parser_exports, {
|
|
58
|
+
VideoLoaderWithParser: () => VideoLoaderWithParser
|
|
59
|
+
});
|
|
60
|
+
var _VideoLoaderPreload, VideoLoaderMetadataWithoutPreload, VideoLoaderWithParser;
|
|
61
|
+
var init_video_loader_with_parser = __esm({
|
|
62
|
+
"dist/video-loader-with-parser.js"() {
|
|
63
|
+
"use strict";
|
|
64
|
+
init_parse_video();
|
|
65
|
+
init_video_loader();
|
|
66
|
+
({ preload: _VideoLoaderPreload, ...VideoLoaderMetadataWithoutPreload } = VideoLoader);
|
|
67
|
+
VideoLoaderWithParser = {
|
|
68
|
+
...VideoLoaderMetadataWithoutPreload,
|
|
69
|
+
parse: parseVideo
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
35
73
|
|
|
36
74
|
// dist/video-loader.js
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
75
|
+
async function preload() {
|
|
76
|
+
const { VideoLoaderWithParser: VideoLoaderWithParser2 } = await Promise.resolve().then(() => (init_video_loader_with_parser(), video_loader_with_parser_exports));
|
|
77
|
+
return VideoLoaderWithParser2;
|
|
78
|
+
}
|
|
79
|
+
var VERSION, VideoLoader;
|
|
80
|
+
var init_video_loader = __esm({
|
|
81
|
+
"dist/video-loader.js"() {
|
|
82
|
+
"use strict";
|
|
83
|
+
init_video_format();
|
|
84
|
+
VERSION = true ? "5.0.0-alpha.1" : "latest";
|
|
85
|
+
VideoLoader = {
|
|
86
|
+
dataType: null,
|
|
87
|
+
batchType: null,
|
|
88
|
+
...VideoFormat,
|
|
89
|
+
version: VERSION,
|
|
90
|
+
// tests: arrayBuffer => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer))),
|
|
91
|
+
options: {
|
|
92
|
+
video: {}
|
|
93
|
+
},
|
|
94
|
+
preload
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// dist/index.js
|
|
100
|
+
var dist_exports = {};
|
|
101
|
+
__export(dist_exports, {
|
|
102
|
+
GIFBuilder: () => GIFBuilder,
|
|
103
|
+
VideoFormat: () => VideoFormat,
|
|
104
|
+
VideoLoader: () => VideoLoader
|
|
105
|
+
});
|
|
106
|
+
module.exports = __toCommonJS(dist_exports);
|
|
107
|
+
init_video_format();
|
|
108
|
+
init_video_loader();
|
|
53
109
|
|
|
54
110
|
// dist/lib/utils/assert.js
|
|
55
111
|
function assert(condition, message) {
|
|
@@ -81,7 +137,11 @@ var utils = {
|
|
|
81
137
|
const loop = function loop2() {
|
|
82
138
|
const current = new Date().getTime();
|
|
83
139
|
const delta = current - start;
|
|
84
|
-
delta >= delay
|
|
140
|
+
if (delta >= delay) {
|
|
141
|
+
callback.call();
|
|
142
|
+
} else {
|
|
143
|
+
handle.value = requestAnimFrame(loop2);
|
|
144
|
+
}
|
|
85
145
|
};
|
|
86
146
|
handle.value = requestAnimFrame(loop);
|
|
87
147
|
return handle;
|
|
@@ -108,9 +168,9 @@ var utils = {
|
|
|
108
168
|
enc2 = (chr1 & 3) << 4 | chr2 >> 4;
|
|
109
169
|
enc3 = (chr2 & 15) << 2 | chr3 >> 6;
|
|
110
170
|
enc4 = chr3 & 63;
|
|
111
|
-
if (isNaN(chr2)) {
|
|
171
|
+
if (Number.isNaN(chr2)) {
|
|
112
172
|
enc3 = enc4 = 64;
|
|
113
|
-
} else if (isNaN(chr3)) {
|
|
173
|
+
} else if (Number.isNaN(chr3)) {
|
|
114
174
|
enc4 = 64;
|
|
115
175
|
}
|
|
116
176
|
output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);
|
|
@@ -134,6 +194,12 @@ var utils = {
|
|
|
134
194
|
isElement: function isElement(elem) {
|
|
135
195
|
return elem && elem.nodeType === 1;
|
|
136
196
|
},
|
|
197
|
+
isImageBitmap: function isImageBitmap(image) {
|
|
198
|
+
return typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap;
|
|
199
|
+
},
|
|
200
|
+
isDrawable: function isDrawable(image) {
|
|
201
|
+
return utils.isElement(image) || utils.isImageBitmap(image);
|
|
202
|
+
},
|
|
137
203
|
isString: function isString(value) {
|
|
138
204
|
return typeof value === "string" || Object.prototype.toString.call(value) === "[object String]";
|
|
139
205
|
},
|
|
@@ -171,7 +237,7 @@ var utils = {
|
|
|
171
237
|
supportObj.ogg = testEl.canPlayType('video/ogg; codecs="theora"') !== "";
|
|
172
238
|
supportObj.webm = testEl.canPlayType('video/webm; codecs="vp8, vorbis"') !== -1;
|
|
173
239
|
}
|
|
174
|
-
} catch (
|
|
240
|
+
} catch (_e) {
|
|
175
241
|
}
|
|
176
242
|
return supportObj;
|
|
177
243
|
}()
|
|
@@ -437,7 +503,7 @@ function NeuQuant() {
|
|
|
437
503
|
const intbiasshift = 16;
|
|
438
504
|
const intbias = 1 << intbiasshift;
|
|
439
505
|
const gammashift = 10;
|
|
440
|
-
const
|
|
506
|
+
const _gamma = 1 << gammashift;
|
|
441
507
|
const betashift = 10;
|
|
442
508
|
const beta = intbias >> betashift;
|
|
443
509
|
const betagamma = intbias << gammashift - betashift;
|
|
@@ -514,7 +580,7 @@ function NeuQuant() {
|
|
|
514
580
|
}
|
|
515
581
|
}
|
|
516
582
|
q = network[smallpos];
|
|
517
|
-
if (i
|
|
583
|
+
if (i !== smallpos) {
|
|
518
584
|
j = q[0];
|
|
519
585
|
q[0] = p[0];
|
|
520
586
|
p[0] = j;
|
|
@@ -528,7 +594,7 @@ function NeuQuant() {
|
|
|
528
594
|
q[3] = p[3];
|
|
529
595
|
p[3] = j;
|
|
530
596
|
}
|
|
531
|
-
if (smallval
|
|
597
|
+
if (smallval !== previouscol) {
|
|
532
598
|
netindex[previouscol] = startpos + i >> 1;
|
|
533
599
|
for (j = previouscol + 1; j < smallval; j++) {
|
|
534
600
|
netindex[j] = i;
|
|
@@ -697,7 +763,7 @@ function NeuQuant() {
|
|
|
697
763
|
}
|
|
698
764
|
function unbiasnet() {
|
|
699
765
|
let i;
|
|
700
|
-
let
|
|
766
|
+
let _j;
|
|
701
767
|
for (i = 0; i < netsize; i++) {
|
|
702
768
|
network[i][0] >>= netbiasshift;
|
|
703
769
|
network[i][1] >>= netbiasshift;
|
|
@@ -732,7 +798,7 @@ function NeuQuant() {
|
|
|
732
798
|
p[0] -= a * (p[0] - b) / alpharadbias | 0;
|
|
733
799
|
p[1] -= a * (p[1] - g) / alpharadbias | 0;
|
|
734
800
|
p[2] -= a * (p[2] - r) / alpharadbias | 0;
|
|
735
|
-
} catch (
|
|
801
|
+
} catch (_e) {
|
|
736
802
|
}
|
|
737
803
|
}
|
|
738
804
|
if (k > lo) {
|
|
@@ -741,7 +807,7 @@ function NeuQuant() {
|
|
|
741
807
|
p[0] -= a * (p[0] - b) / alpharadbias | 0;
|
|
742
808
|
p[1] -= a * (p[1] - g) / alpharadbias | 0;
|
|
743
809
|
p[2] -= a * (p[2] - r) / alpharadbias | 0;
|
|
744
|
-
} catch (
|
|
810
|
+
} catch (_e) {
|
|
745
811
|
}
|
|
746
812
|
}
|
|
747
813
|
}
|
|
@@ -808,7 +874,7 @@ function NeuQuant() {
|
|
|
808
874
|
return exports;
|
|
809
875
|
}
|
|
810
876
|
function workerCode() {
|
|
811
|
-
const
|
|
877
|
+
const _self = this;
|
|
812
878
|
try {
|
|
813
879
|
globalThis.onmessage = function(ev) {
|
|
814
880
|
const data = ev.data || {};
|
|
@@ -818,7 +884,7 @@ function workerCode() {
|
|
|
818
884
|
postMessage(response);
|
|
819
885
|
}
|
|
820
886
|
};
|
|
821
|
-
} catch (
|
|
887
|
+
} catch (_e) {
|
|
822
888
|
}
|
|
823
889
|
var workerMethods = {
|
|
824
890
|
dataToRGB: function dataToRGB(data, width, height) {
|
|
@@ -868,7 +934,7 @@ function workerCode() {
|
|
|
868
934
|
frame = frame || {};
|
|
869
935
|
const _frame = frame;
|
|
870
936
|
const height = _frame.height;
|
|
871
|
-
const
|
|
937
|
+
const _palette = _frame.palette;
|
|
872
938
|
const sampleInterval = _frame.sampleInterval;
|
|
873
939
|
const width = _frame.width;
|
|
874
940
|
const imageData = frame.data;
|
|
@@ -952,8 +1018,10 @@ function gifWriter(buf, width, height, gopts) {
|
|
|
952
1018
|
throw "Must supply either a local or global palette.";
|
|
953
1019
|
let num_colors = check_palette_and_num_colors(palette);
|
|
954
1020
|
let min_code_size = 0;
|
|
955
|
-
|
|
1021
|
+
num_colors >>= 1;
|
|
1022
|
+
while (num_colors) {
|
|
956
1023
|
++min_code_size;
|
|
1024
|
+
num_colors >>= 1;
|
|
957
1025
|
}
|
|
958
1026
|
num_colors = 1 << min_code_size;
|
|
959
1027
|
const delay = opts.delay === void 0 ? 0 : opts.delay;
|
|
@@ -1176,7 +1244,6 @@ AnimatedGIF.prototype = {
|
|
|
1176
1244
|
},
|
|
1177
1245
|
processFrame: function processFrame(position) {
|
|
1178
1246
|
const AnimatedGifContext = this;
|
|
1179
|
-
const options = this.options;
|
|
1180
1247
|
const _options = this.options;
|
|
1181
1248
|
const progressCallback = _options.progressCallback;
|
|
1182
1249
|
const sampleInterval = _options.sampleInterval;
|
|
@@ -1288,8 +1355,8 @@ AnimatedGIF.prototype = {
|
|
|
1288
1355
|
const fontColor = _gifshotOptions.fontColor;
|
|
1289
1356
|
const fontFamily = _gifshotOptions.fontFamily;
|
|
1290
1357
|
const fontWeight = _gifshotOptions.fontWeight;
|
|
1291
|
-
const
|
|
1292
|
-
const
|
|
1358
|
+
const _gifHeight = _gifshotOptions.gifHeight;
|
|
1359
|
+
const _gifWidth = _gifshotOptions.gifWidth;
|
|
1293
1360
|
const text = _gifshotOptions.text;
|
|
1294
1361
|
const textAlign = _gifshotOptions.textAlign;
|
|
1295
1362
|
const textBaseline = _gifshotOptions.textBaseline;
|
|
@@ -1369,7 +1436,7 @@ function getBase64GIF2(animatedGifInstance, callback) {
|
|
|
1369
1436
|
}
|
|
1370
1437
|
function existingImages() {
|
|
1371
1438
|
const obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1372
|
-
const
|
|
1439
|
+
const _self = this;
|
|
1373
1440
|
const callback = obj.callback;
|
|
1374
1441
|
const images = obj.images;
|
|
1375
1442
|
const options = obj.options;
|
|
@@ -1389,7 +1456,7 @@ function existingImages() {
|
|
|
1389
1456
|
ag = new AnimatedGIF(options);
|
|
1390
1457
|
utils.each(images, function(index, image) {
|
|
1391
1458
|
const currentImage = image;
|
|
1392
|
-
if (utils.
|
|
1459
|
+
if (utils.isDrawable(currentImage)) {
|
|
1393
1460
|
if (options.crossOrigin) {
|
|
1394
1461
|
currentImage.crossOrigin = options.crossOrigin;
|
|
1395
1462
|
}
|
|
@@ -1471,7 +1538,7 @@ var screenShot = {
|
|
|
1471
1538
|
const fontFamily = options.fontFamily;
|
|
1472
1539
|
const fontWeight = options.fontWeight;
|
|
1473
1540
|
const keepCameraOn = options.keepCameraOn;
|
|
1474
|
-
const
|
|
1541
|
+
const _numWorkers = options.numWorkers;
|
|
1475
1542
|
const progressCallback = options.progressCallback;
|
|
1476
1543
|
const saveRenderingContexts = options.saveRenderingContexts;
|
|
1477
1544
|
const savedRenderingContexts = options.savedRenderingContexts;
|
|
@@ -1485,7 +1552,7 @@ var screenShot = {
|
|
|
1485
1552
|
const gifWidth = Number(options.gifWidth);
|
|
1486
1553
|
const gifHeight = Number(options.gifHeight);
|
|
1487
1554
|
let interval = Number(options.interval);
|
|
1488
|
-
const
|
|
1555
|
+
const _sampleInterval = Number(options.sampleInterval);
|
|
1489
1556
|
const waitBetweenFrames = hasExistingImages ? 0 : interval * 1e3;
|
|
1490
1557
|
const renderingContextsToSave = [];
|
|
1491
1558
|
let numFrames = savedRenderingContexts.length ? savedRenderingContexts.length : options.numFrames;
|
|
@@ -1666,7 +1733,7 @@ var videoStream = {
|
|
|
1666
1733
|
} else if (existingVideo2 instanceof Blob) {
|
|
1667
1734
|
try {
|
|
1668
1735
|
videoElement.src = utils.URL.createObjectURL(existingVideo2);
|
|
1669
|
-
} catch (
|
|
1736
|
+
} catch (_e) {
|
|
1670
1737
|
}
|
|
1671
1738
|
videoElement.innerHTML = `<source src="${existingVideo2}" type="${existingVideo2.type}" />`;
|
|
1672
1739
|
}
|
|
@@ -1676,7 +1743,7 @@ var videoStream = {
|
|
|
1676
1743
|
try {
|
|
1677
1744
|
videoElement.srcObject = cameraStream;
|
|
1678
1745
|
videoElement.src = utils.URL.createObjectURL(cameraStream);
|
|
1679
|
-
} catch (
|
|
1746
|
+
} catch (_e) {
|
|
1680
1747
|
videoElement.srcObject = cameraStream;
|
|
1681
1748
|
}
|
|
1682
1749
|
}
|
|
@@ -1714,7 +1781,7 @@ var videoStream = {
|
|
|
1714
1781
|
const options = obj.options;
|
|
1715
1782
|
const webcamVideoElement = obj.webcamVideoElement;
|
|
1716
1783
|
const videoElement = utils.isElement(existingVideo2) ? existingVideo2 : webcamVideoElement ? webcamVideoElement : document2.createElement("video");
|
|
1717
|
-
const
|
|
1784
|
+
const _cameraStream = void 0;
|
|
1718
1785
|
if (crossOrigin) {
|
|
1719
1786
|
videoElement.crossOrigin = options.crossOrigin;
|
|
1720
1787
|
}
|
|
@@ -1832,7 +1899,7 @@ function createAndGetGIF(obj, callback) {
|
|
|
1832
1899
|
const video = options.video;
|
|
1833
1900
|
const gifWidth = Number(options.gifWidth);
|
|
1834
1901
|
const gifHeight = Number(options.gifHeight);
|
|
1835
|
-
const
|
|
1902
|
+
const _numFrames = Number(options.numFrames);
|
|
1836
1903
|
const cameraStream = obj.cameraStream;
|
|
1837
1904
|
const videoElement = obj.videoElement;
|
|
1838
1905
|
const videoWidth = obj.videoWidth;
|
|
@@ -1879,11 +1946,11 @@ function existingVideo() {
|
|
|
1879
1946
|
"globalThis.URL": true
|
|
1880
1947
|
};
|
|
1881
1948
|
const errorObj = error.validate(skipObj);
|
|
1882
|
-
const
|
|
1949
|
+
const _loadedImages = 0;
|
|
1883
1950
|
let videoType = void 0;
|
|
1884
1951
|
let videoSrc = void 0;
|
|
1885
|
-
const
|
|
1886
|
-
const
|
|
1952
|
+
const _tempImage = void 0;
|
|
1953
|
+
const _ag = void 0;
|
|
1887
1954
|
if (errorObj.error) {
|
|
1888
1955
|
return callback(errorObj);
|
|
1889
1956
|
}
|
|
@@ -2020,7 +2087,7 @@ var GIF_BUILDER_OPTIONS = {
|
|
|
2020
2087
|
crossOrigin: "Anonymous",
|
|
2021
2088
|
// Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.
|
|
2022
2089
|
// CALLBACKS
|
|
2023
|
-
progressCallback: (
|
|
2090
|
+
progressCallback: (_captureProgress) => {
|
|
2024
2091
|
},
|
|
2025
2092
|
// Callback that provides the current progress of the current image
|
|
2026
2093
|
completeCallback: () => {
|