@loaders.gl/video 4.4.5 → 5.0.0-alpha.2
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/LICENSE +14 -3
- 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 +154 -80
- 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 +140 -65
- package/dist/index.cjs.map +3 -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/lib/parsers/parse-video.d.ts +2 -0
- package/dist/lib/parsers/parse-video.d.ts.map +1 -1
- package/dist/lib/parsers/parse-video.js +6 -6
- package/dist/lib/parsers/parse-video.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 +28 -0
- package/dist/video-loader-with-parser.d.ts.map +1 -0
- package/dist/video-loader-with-parser.js +15 -0
- package/dist/video-loader-with-parser.js.map +1 -0
- package/dist/video-loader.d.ts +31 -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/lib/parsers/parse-video.ts +7 -6
- package/src/unbundled.ts +6 -0
- package/src/video-format.ts +18 -0
- package/src/video-loader-with-parser.ts +22 -0
- package/src/video-loader.ts +12 -12
package/LICENSE
CHANGED
|
@@ -24,8 +24,20 @@ THE SOFTWARE.
|
|
|
24
24
|
|
|
25
25
|
Copyright (c) 2015 Uber Technologies, Inc.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
Portions of modules/images/src/lib/category-api/binary-image-api.ts are based on
|
|
28
|
+
binary-gltf-utils (https://github.com/Qantas94Heavy/binary-gltf-utils) under the
|
|
29
|
+
MIT License reproduced above.
|
|
30
|
+
|
|
31
|
+
Copyright (c) 2016-17 Karl Cheng
|
|
32
|
+
|
|
33
|
+
Portions of modules/schema-utils/src/lib/utils/async-queue.ts are adapted from
|
|
34
|
+
async-iter-demo (https://github.com/rauschma/async-iter-demo) under the MIT
|
|
35
|
+
License reproduced above.
|
|
36
|
+
|
|
37
|
+
Copyright (c) 2016 Axel Rauschmayer
|
|
38
|
+
|
|
39
|
+
loaders.gl includes certain files from Cesium (https://github.com/CesiumGS/cesium)
|
|
40
|
+
under the Apache 2.0 License, including files in modules/3d-tiles and modules/math.
|
|
29
41
|
|
|
30
42
|
Copyright 2011-2018 CesiumJS Contributors
|
|
31
43
|
|
|
@@ -38,4 +50,3 @@ Unless required by applicable law or agreed to in writing, software
|
|
|
38
50
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
39
51
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
40
52
|
See the License for the specific language governing permissions and limitations under the License.
|
|
41
|
-
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.d.ts","sourceRoot":"","sources":["../src/bundled.ts"],"names":[],"mappings":"AAIA,YAAY,EAAC,kBAAkB,EAAC,sCAAmC;AACnE,OAAO,EAAC,qBAAqB,IAAI,WAAW,EAAC,sCAAmC"}
|
package/dist/bundled.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundled.js","sourceRoot":"","sources":["../src/bundled.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,qBAAqB,IAAI,WAAW,EAAC,sCAAmC"}
|
package/dist/dist.dev.js
CHANGED
|
@@ -12,8 +12,20 @@ var __exports__ = (() => {
|
|
|
12
12
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
13
|
var __getProtoOf = Object.getPrototypeOf;
|
|
14
14
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
15
|
+
var __esm = (fn, res, err) => function __init() {
|
|
16
|
+
if (err) throw err[0];
|
|
17
|
+
try {
|
|
18
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
throw err = [e], e;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
15
23
|
var __commonJS = (cb, mod) => function __require() {
|
|
16
|
-
|
|
24
|
+
try {
|
|
25
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
throw mod = 0, e;
|
|
28
|
+
}
|
|
17
29
|
};
|
|
18
30
|
var __export = (target, all) => {
|
|
19
31
|
for (var name in all)
|
|
@@ -45,39 +57,97 @@ var __exports__ = (() => {
|
|
|
45
57
|
}
|
|
46
58
|
});
|
|
47
59
|
|
|
48
|
-
//
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
// src/video-format.ts
|
|
61
|
+
var VideoFormat;
|
|
62
|
+
var init_video_format = __esm({
|
|
63
|
+
"src/video-format.ts"() {
|
|
64
|
+
"use strict";
|
|
65
|
+
VideoFormat = {
|
|
66
|
+
name: "Video",
|
|
67
|
+
id: "video",
|
|
68
|
+
module: "video",
|
|
69
|
+
encoding: "video",
|
|
70
|
+
format: "video",
|
|
71
|
+
extensions: ["mp4"],
|
|
72
|
+
mimeTypes: ["video/mp4"],
|
|
73
|
+
category: "video",
|
|
74
|
+
binary: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
53
77
|
});
|
|
54
|
-
__reExport(bundle_exports, __toESM(require_core(), 1));
|
|
55
78
|
|
|
56
79
|
// src/lib/parsers/parse-video.ts
|
|
57
|
-
async function
|
|
58
|
-
const blob2 = new Blob([arrayBuffer]);
|
|
80
|
+
async function parseVideoBlob(blob2) {
|
|
59
81
|
const video = document.createElement("video");
|
|
60
82
|
video.src = URL.createObjectURL(blob2);
|
|
61
83
|
return video;
|
|
62
84
|
}
|
|
85
|
+
async function parseVideo(arrayBuffer) {
|
|
86
|
+
return await parseVideoBlob(new Blob([arrayBuffer]));
|
|
87
|
+
}
|
|
88
|
+
var init_parse_video = __esm({
|
|
89
|
+
"src/lib/parsers/parse-video.ts"() {
|
|
90
|
+
"use strict";
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// src/video-loader-with-parser.ts
|
|
95
|
+
var video_loader_with_parser_exports = {};
|
|
96
|
+
__export(video_loader_with_parser_exports, {
|
|
97
|
+
VideoLoaderWithParser: () => VideoLoaderWithParser
|
|
98
|
+
});
|
|
99
|
+
var _VideoLoaderPreload, VideoLoaderMetadataWithoutPreload, VideoLoaderWithParser;
|
|
100
|
+
var init_video_loader_with_parser = __esm({
|
|
101
|
+
"src/video-loader-with-parser.ts"() {
|
|
102
|
+
"use strict";
|
|
103
|
+
init_parse_video();
|
|
104
|
+
init_video_loader();
|
|
105
|
+
({ preload: _VideoLoaderPreload, ...VideoLoaderMetadataWithoutPreload } = VideoLoader);
|
|
106
|
+
VideoLoaderWithParser = {
|
|
107
|
+
...VideoLoaderMetadataWithoutPreload,
|
|
108
|
+
parse: parseVideo,
|
|
109
|
+
parseBlob: parseVideoBlob
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
});
|
|
63
113
|
|
|
64
114
|
// src/video-loader.ts
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
115
|
+
async function preload() {
|
|
116
|
+
const { VideoLoaderWithParser: VideoLoaderWithParser2 } = await Promise.resolve().then(() => (init_video_loader_with_parser(), video_loader_with_parser_exports));
|
|
117
|
+
return VideoLoaderWithParser2;
|
|
118
|
+
}
|
|
119
|
+
var VERSION, VideoLoader;
|
|
120
|
+
var init_video_loader = __esm({
|
|
121
|
+
"src/video-loader.ts"() {
|
|
122
|
+
"use strict";
|
|
123
|
+
init_video_format();
|
|
124
|
+
VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
125
|
+
VideoLoader = {
|
|
126
|
+
dataType: null,
|
|
127
|
+
batchType: null,
|
|
128
|
+
...VideoFormat,
|
|
129
|
+
version: VERSION,
|
|
130
|
+
// tests: arrayBuffer => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer))),
|
|
131
|
+
options: {
|
|
132
|
+
video: {}
|
|
133
|
+
},
|
|
134
|
+
preload
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// bundle.ts
|
|
140
|
+
var bundle_exports = {};
|
|
141
|
+
__export(bundle_exports, {
|
|
142
|
+
GIFBuilder: () => GIFBuilder,
|
|
143
|
+
VideoFormat: () => VideoFormat,
|
|
144
|
+
VideoLoader: () => VideoLoader
|
|
145
|
+
});
|
|
146
|
+
__reExport(bundle_exports, __toESM(require_core(), 1));
|
|
147
|
+
|
|
148
|
+
// src/index.ts
|
|
149
|
+
init_video_format();
|
|
150
|
+
init_video_loader();
|
|
81
151
|
|
|
82
152
|
// src/lib/utils/assert.ts
|
|
83
153
|
function assert(condition, message) {
|
|
@@ -90,12 +160,11 @@ var __exports__ = (() => {
|
|
|
90
160
|
var document2 = globalThis.document || {};
|
|
91
161
|
var utils = {
|
|
92
162
|
URL: globalThis.URL || globalThis.webkitURL || globalThis.mozURL || globalThis.msURL,
|
|
93
|
-
getUserMedia: function() {
|
|
94
|
-
if (!globalThis.navigator)
|
|
95
|
-
return globalThis.navigator;
|
|
163
|
+
getUserMedia: (function() {
|
|
164
|
+
if (!globalThis.navigator) return globalThis.navigator;
|
|
96
165
|
const getUserMedia = globalThis.navigator.getUserMedia || globalThis.navigator.webkitGetUserMedia || globalThis.navigator.mozGetUserMedia || globalThis.navigator.msGetUserMedia;
|
|
97
166
|
return getUserMedia ? getUserMedia.bind(globalThis.navigator) : getUserMedia;
|
|
98
|
-
}(),
|
|
167
|
+
})(),
|
|
99
168
|
requestAnimFrame: globalThis.requestAnimationFrame || globalThis.webkitRequestAnimationFrame || globalThis.mozRequestAnimationFrame || globalThis.oRequestAnimationFrame || globalThis.msRequestAnimationFrame,
|
|
100
169
|
requestTimeout: function requestTimeout(callback, delay) {
|
|
101
170
|
callback = callback || utils.noop;
|
|
@@ -103,19 +172,23 @@ var __exports__ = (() => {
|
|
|
103
172
|
if (!utils.requestAnimFrame) {
|
|
104
173
|
return setTimeout(callback, delay);
|
|
105
174
|
}
|
|
106
|
-
const start = new Date().getTime();
|
|
175
|
+
const start = (/* @__PURE__ */ new Date()).getTime();
|
|
107
176
|
const handle = new Object();
|
|
108
177
|
const requestAnimFrame = utils.requestAnimFrame;
|
|
109
178
|
const loop = function loop2() {
|
|
110
|
-
const current = new Date().getTime();
|
|
179
|
+
const current = (/* @__PURE__ */ new Date()).getTime();
|
|
111
180
|
const delta = current - start;
|
|
112
|
-
delta >= delay
|
|
181
|
+
if (delta >= delay) {
|
|
182
|
+
callback.call();
|
|
183
|
+
} else {
|
|
184
|
+
handle.value = requestAnimFrame(loop2);
|
|
185
|
+
}
|
|
113
186
|
};
|
|
114
187
|
handle.value = requestAnimFrame(loop);
|
|
115
188
|
return handle;
|
|
116
189
|
},
|
|
117
190
|
Blob: globalThis.Blob || globalThis.BlobBuilder || globalThis.WebKitBlobBuilder || globalThis.MozBlobBuilder || globalThis.MSBlobBuilder,
|
|
118
|
-
btoa: function() {
|
|
191
|
+
btoa: (function() {
|
|
119
192
|
const btoa = globalThis.btoa || function(input) {
|
|
120
193
|
let output = "";
|
|
121
194
|
let i = 0;
|
|
@@ -136,9 +209,9 @@ var __exports__ = (() => {
|
|
|
136
209
|
enc2 = (chr1 & 3) << 4 | chr2 >> 4;
|
|
137
210
|
enc3 = (chr2 & 15) << 2 | chr3 >> 6;
|
|
138
211
|
enc4 = chr3 & 63;
|
|
139
|
-
if (isNaN(chr2)) {
|
|
212
|
+
if (Number.isNaN(chr2)) {
|
|
140
213
|
enc3 = enc4 = 64;
|
|
141
|
-
} else if (isNaN(chr3)) {
|
|
214
|
+
} else if (Number.isNaN(chr3)) {
|
|
142
215
|
enc4 = 64;
|
|
143
216
|
}
|
|
144
217
|
output = output + key.charAt(enc1) + key.charAt(enc2) + key.charAt(enc3) + key.charAt(enc4);
|
|
@@ -146,7 +219,7 @@ var __exports__ = (() => {
|
|
|
146
219
|
return output;
|
|
147
220
|
};
|
|
148
221
|
return btoa ? btoa.bind(globalThis) : utils.noop;
|
|
149
|
-
}(),
|
|
222
|
+
})(),
|
|
150
223
|
isObject: function isObject(obj) {
|
|
151
224
|
return obj && Object.prototype.toString.call(obj) === "[object Object]";
|
|
152
225
|
},
|
|
@@ -162,6 +235,12 @@ var __exports__ = (() => {
|
|
|
162
235
|
isElement: function isElement(elem) {
|
|
163
236
|
return elem && elem.nodeType === 1;
|
|
164
237
|
},
|
|
238
|
+
isImageBitmap: function isImageBitmap(image) {
|
|
239
|
+
return typeof ImageBitmap !== "undefined" && image instanceof ImageBitmap;
|
|
240
|
+
},
|
|
241
|
+
isDrawable: function isDrawable(image) {
|
|
242
|
+
return utils.isElement(image) || utils.isImageBitmap(image);
|
|
243
|
+
},
|
|
165
244
|
isString: function isString(value) {
|
|
166
245
|
return typeof value === "string" || Object.prototype.toString.call(value) === "[object String]";
|
|
167
246
|
},
|
|
@@ -182,7 +261,7 @@ var __exports__ = (() => {
|
|
|
182
261
|
Uint32Array: function Uint32Array2() {
|
|
183
262
|
return globalThis.Uint32Array;
|
|
184
263
|
},
|
|
185
|
-
videoCodecs: function() {
|
|
264
|
+
videoCodecs: (function() {
|
|
186
265
|
const testEl = document2.createElement("video");
|
|
187
266
|
const supportObj = {
|
|
188
267
|
mp4: false,
|
|
@@ -199,10 +278,10 @@ var __exports__ = (() => {
|
|
|
199
278
|
supportObj.ogg = testEl.canPlayType('video/ogg; codecs="theora"') !== "";
|
|
200
279
|
supportObj.webm = testEl.canPlayType('video/webm; codecs="vp8, vorbis"') !== -1;
|
|
201
280
|
}
|
|
202
|
-
} catch (
|
|
281
|
+
} catch (_e) {
|
|
203
282
|
}
|
|
204
283
|
return supportObj;
|
|
205
|
-
}()
|
|
284
|
+
})()
|
|
206
285
|
},
|
|
207
286
|
noop: function noop() {
|
|
208
287
|
},
|
|
@@ -465,7 +544,7 @@ var __exports__ = (() => {
|
|
|
465
544
|
const intbiasshift = 16;
|
|
466
545
|
const intbias = 1 << intbiasshift;
|
|
467
546
|
const gammashift = 10;
|
|
468
|
-
const
|
|
547
|
+
const _gamma = 1 << gammashift;
|
|
469
548
|
const betashift = 10;
|
|
470
549
|
const beta = intbias >> betashift;
|
|
471
550
|
const betagamma = intbias << gammashift - betashift;
|
|
@@ -542,7 +621,7 @@ var __exports__ = (() => {
|
|
|
542
621
|
}
|
|
543
622
|
}
|
|
544
623
|
q = network[smallpos];
|
|
545
|
-
if (i
|
|
624
|
+
if (i !== smallpos) {
|
|
546
625
|
j = q[0];
|
|
547
626
|
q[0] = p[0];
|
|
548
627
|
p[0] = j;
|
|
@@ -556,7 +635,7 @@ var __exports__ = (() => {
|
|
|
556
635
|
q[3] = p[3];
|
|
557
636
|
p[3] = j;
|
|
558
637
|
}
|
|
559
|
-
if (smallval
|
|
638
|
+
if (smallval !== previouscol) {
|
|
560
639
|
netindex[previouscol] = startpos + i >> 1;
|
|
561
640
|
for (j = previouscol + 1; j < smallval; j++) {
|
|
562
641
|
netindex[j] = i;
|
|
@@ -725,7 +804,7 @@ var __exports__ = (() => {
|
|
|
725
804
|
}
|
|
726
805
|
function unbiasnet() {
|
|
727
806
|
let i;
|
|
728
|
-
let
|
|
807
|
+
let _j;
|
|
729
808
|
for (i = 0; i < netsize; i++) {
|
|
730
809
|
network[i][0] >>= netbiasshift;
|
|
731
810
|
network[i][1] >>= netbiasshift;
|
|
@@ -760,7 +839,7 @@ var __exports__ = (() => {
|
|
|
760
839
|
p[0] -= a * (p[0] - b) / alpharadbias | 0;
|
|
761
840
|
p[1] -= a * (p[1] - g) / alpharadbias | 0;
|
|
762
841
|
p[2] -= a * (p[2] - r) / alpharadbias | 0;
|
|
763
|
-
} catch (
|
|
842
|
+
} catch (_e) {
|
|
764
843
|
}
|
|
765
844
|
}
|
|
766
845
|
if (k > lo) {
|
|
@@ -769,7 +848,7 @@ var __exports__ = (() => {
|
|
|
769
848
|
p[0] -= a * (p[0] - b) / alpharadbias | 0;
|
|
770
849
|
p[1] -= a * (p[1] - g) / alpharadbias | 0;
|
|
771
850
|
p[2] -= a * (p[2] - r) / alpharadbias | 0;
|
|
772
|
-
} catch (
|
|
851
|
+
} catch (_e) {
|
|
773
852
|
}
|
|
774
853
|
}
|
|
775
854
|
}
|
|
@@ -836,7 +915,7 @@ var __exports__ = (() => {
|
|
|
836
915
|
return exports;
|
|
837
916
|
}
|
|
838
917
|
function workerCode() {
|
|
839
|
-
const
|
|
918
|
+
const _self = this;
|
|
840
919
|
try {
|
|
841
920
|
globalThis.onmessage = function(ev) {
|
|
842
921
|
const data = ev.data || {};
|
|
@@ -846,7 +925,7 @@ var __exports__ = (() => {
|
|
|
846
925
|
postMessage(response);
|
|
847
926
|
}
|
|
848
927
|
};
|
|
849
|
-
} catch (
|
|
928
|
+
} catch (_e) {
|
|
850
929
|
}
|
|
851
930
|
var workerMethods = {
|
|
852
931
|
dataToRGB: function dataToRGB(data, width, height) {
|
|
@@ -896,7 +975,7 @@ var __exports__ = (() => {
|
|
|
896
975
|
frame = frame || {};
|
|
897
976
|
const _frame = frame;
|
|
898
977
|
const height = _frame.height;
|
|
899
|
-
const
|
|
978
|
+
const _palette = _frame.palette;
|
|
900
979
|
const sampleInterval = _frame.sampleInterval;
|
|
901
980
|
const width = _frame.width;
|
|
902
981
|
const imageData = frame.data;
|
|
@@ -910,8 +989,7 @@ var __exports__ = (() => {
|
|
|
910
989
|
gopts = gopts === void 0 ? {} : gopts;
|
|
911
990
|
const loop_count = gopts.loop === void 0 ? null : gopts.loop;
|
|
912
991
|
const global_palette = gopts.palette === void 0 ? null : gopts.palette;
|
|
913
|
-
if (width <= 0 || height <= 0 || width > 65535 || height > 65535)
|
|
914
|
-
throw "Width/Height invalid.";
|
|
992
|
+
if (width <= 0 || height <= 0 || width > 65535 || height > 65535) throw "Width/Height invalid.";
|
|
915
993
|
function check_palette_and_num_colors(palette) {
|
|
916
994
|
const num_colors = palette.length;
|
|
917
995
|
if (num_colors < 2 || num_colors > 256 || num_colors & num_colors - 1)
|
|
@@ -935,8 +1013,7 @@ var __exports__ = (() => {
|
|
|
935
1013
|
buf[p++] = background;
|
|
936
1014
|
buf[p++] = 0;
|
|
937
1015
|
if (loop_count !== null) {
|
|
938
|
-
if (loop_count < 0 || loop_count > 65535)
|
|
939
|
-
throw "Loop count invalid.";
|
|
1016
|
+
if (loop_count < 0 || loop_count > 65535) throw "Loop count invalid.";
|
|
940
1017
|
buf[p++] = 33;
|
|
941
1018
|
buf[p++] = 255;
|
|
942
1019
|
buf[p++] = 11;
|
|
@@ -964,12 +1041,9 @@ var __exports__ = (() => {
|
|
|
964
1041
|
ended = false;
|
|
965
1042
|
}
|
|
966
1043
|
opts = opts === void 0 ? {} : opts;
|
|
967
|
-
if (x < 0 || y < 0 || x > 65535 || y > 65535)
|
|
968
|
-
|
|
969
|
-
if (
|
|
970
|
-
throw "Width/Height invalid.";
|
|
971
|
-
if (indexed_pixels.length < w * h)
|
|
972
|
-
throw "Not enough pixels for the frame size.";
|
|
1044
|
+
if (x < 0 || y < 0 || x > 65535 || y > 65535) throw "x/y invalid.";
|
|
1045
|
+
if (w <= 0 || h <= 0 || w > 65535 || h > 65535) throw "Width/Height invalid.";
|
|
1046
|
+
if (indexed_pixels.length < w * h) throw "Not enough pixels for the frame size.";
|
|
973
1047
|
let using_local_palette = true;
|
|
974
1048
|
let palette = opts.palette;
|
|
975
1049
|
if (palette === void 0 || palette === null) {
|
|
@@ -980,8 +1054,10 @@ var __exports__ = (() => {
|
|
|
980
1054
|
throw "Must supply either a local or global palette.";
|
|
981
1055
|
let num_colors = check_palette_and_num_colors(palette);
|
|
982
1056
|
let min_code_size = 0;
|
|
983
|
-
|
|
1057
|
+
num_colors >>= 1;
|
|
1058
|
+
while (num_colors) {
|
|
984
1059
|
++min_code_size;
|
|
1060
|
+
num_colors >>= 1;
|
|
985
1061
|
}
|
|
986
1062
|
num_colors = 1 << min_code_size;
|
|
987
1063
|
const delay = opts.delay === void 0 ? 0 : opts.delay;
|
|
@@ -1084,8 +1160,7 @@ var __exports__ = (() => {
|
|
|
1084
1160
|
cur_code_size = min_code_size + 1;
|
|
1085
1161
|
code_table = {};
|
|
1086
1162
|
} else {
|
|
1087
|
-
if (next_code >= 1 << cur_code_size)
|
|
1088
|
-
++cur_code_size;
|
|
1163
|
+
if (next_code >= 1 << cur_code_size) ++cur_code_size;
|
|
1089
1164
|
code_table[cur_key] = next_code++;
|
|
1090
1165
|
}
|
|
1091
1166
|
ib_code = k;
|
|
@@ -1163,13 +1238,13 @@ var __exports__ = (() => {
|
|
|
1163
1238
|
freeWorker: function freeWorker(worker) {
|
|
1164
1239
|
this.availableWorkers.push(worker);
|
|
1165
1240
|
},
|
|
1166
|
-
byteMap: function() {
|
|
1241
|
+
byteMap: (function() {
|
|
1167
1242
|
const byteMap = [];
|
|
1168
1243
|
for (let i = 0; i < 256; i++) {
|
|
1169
1244
|
byteMap[i] = String.fromCharCode(i);
|
|
1170
1245
|
}
|
|
1171
1246
|
return byteMap;
|
|
1172
|
-
}(),
|
|
1247
|
+
})(),
|
|
1173
1248
|
bufferToString: function bufferToString(buffer) {
|
|
1174
1249
|
const numberValues = buffer.length;
|
|
1175
1250
|
let str = "";
|
|
@@ -1204,7 +1279,6 @@ var __exports__ = (() => {
|
|
|
1204
1279
|
},
|
|
1205
1280
|
processFrame: function processFrame(position) {
|
|
1206
1281
|
const AnimatedGifContext = this;
|
|
1207
|
-
const options = this.options;
|
|
1208
1282
|
const _options = this.options;
|
|
1209
1283
|
const progressCallback = _options.progressCallback;
|
|
1210
1284
|
const sampleInterval = _options.sampleInterval;
|
|
@@ -1316,8 +1390,8 @@ var __exports__ = (() => {
|
|
|
1316
1390
|
const fontColor = _gifshotOptions.fontColor;
|
|
1317
1391
|
const fontFamily = _gifshotOptions.fontFamily;
|
|
1318
1392
|
const fontWeight = _gifshotOptions.fontWeight;
|
|
1319
|
-
const
|
|
1320
|
-
const
|
|
1393
|
+
const _gifHeight = _gifshotOptions.gifHeight;
|
|
1394
|
+
const _gifWidth = _gifshotOptions.gifWidth;
|
|
1321
1395
|
const text = _gifshotOptions.text;
|
|
1322
1396
|
const textAlign = _gifshotOptions.textAlign;
|
|
1323
1397
|
const textBaseline = _gifshotOptions.textBaseline;
|
|
@@ -1397,7 +1471,7 @@ var __exports__ = (() => {
|
|
|
1397
1471
|
}
|
|
1398
1472
|
function existingImages() {
|
|
1399
1473
|
const obj = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1400
|
-
const
|
|
1474
|
+
const _self = this;
|
|
1401
1475
|
const callback = obj.callback;
|
|
1402
1476
|
const images = obj.images;
|
|
1403
1477
|
const options = obj.options;
|
|
@@ -1417,7 +1491,7 @@ var __exports__ = (() => {
|
|
|
1417
1491
|
ag = new AnimatedGIF(options);
|
|
1418
1492
|
utils.each(images, function(index, image) {
|
|
1419
1493
|
const currentImage = image;
|
|
1420
|
-
if (utils.
|
|
1494
|
+
if (utils.isDrawable(currentImage)) {
|
|
1421
1495
|
if (options.crossOrigin) {
|
|
1422
1496
|
currentImage.crossOrigin = options.crossOrigin;
|
|
1423
1497
|
}
|
|
@@ -1499,7 +1573,7 @@ var __exports__ = (() => {
|
|
|
1499
1573
|
const fontFamily = options.fontFamily;
|
|
1500
1574
|
const fontWeight = options.fontWeight;
|
|
1501
1575
|
const keepCameraOn = options.keepCameraOn;
|
|
1502
|
-
const
|
|
1576
|
+
const _numWorkers = options.numWorkers;
|
|
1503
1577
|
const progressCallback = options.progressCallback;
|
|
1504
1578
|
const saveRenderingContexts = options.saveRenderingContexts;
|
|
1505
1579
|
const savedRenderingContexts = options.savedRenderingContexts;
|
|
@@ -1513,7 +1587,7 @@ var __exports__ = (() => {
|
|
|
1513
1587
|
const gifWidth = Number(options.gifWidth);
|
|
1514
1588
|
const gifHeight = Number(options.gifHeight);
|
|
1515
1589
|
let interval = Number(options.interval);
|
|
1516
|
-
const
|
|
1590
|
+
const _sampleInterval = Number(options.sampleInterval);
|
|
1517
1591
|
const waitBetweenFrames = hasExistingImages ? 0 : interval * 1e3;
|
|
1518
1592
|
const renderingContextsToSave = [];
|
|
1519
1593
|
let numFrames = savedRenderingContexts.length ? savedRenderingContexts.length : options.numFrames;
|
|
@@ -1706,7 +1780,7 @@ var __exports__ = (() => {
|
|
|
1706
1780
|
} else if (existingVideo2 instanceof Blob) {
|
|
1707
1781
|
try {
|
|
1708
1782
|
videoElement.src = utils.URL.createObjectURL(existingVideo2);
|
|
1709
|
-
} catch (
|
|
1783
|
+
} catch (_e) {
|
|
1710
1784
|
}
|
|
1711
1785
|
videoElement.innerHTML = `<source src="${existingVideo2}" type="${existingVideo2.type}" />`;
|
|
1712
1786
|
}
|
|
@@ -1716,7 +1790,7 @@ var __exports__ = (() => {
|
|
|
1716
1790
|
try {
|
|
1717
1791
|
videoElement.srcObject = cameraStream;
|
|
1718
1792
|
videoElement.src = utils.URL.createObjectURL(cameraStream);
|
|
1719
|
-
} catch (
|
|
1793
|
+
} catch (_e) {
|
|
1720
1794
|
videoElement.srcObject = cameraStream;
|
|
1721
1795
|
}
|
|
1722
1796
|
}
|
|
@@ -1754,7 +1828,7 @@ var __exports__ = (() => {
|
|
|
1754
1828
|
const options = obj.options;
|
|
1755
1829
|
const webcamVideoElement = obj.webcamVideoElement;
|
|
1756
1830
|
const videoElement = utils.isElement(existingVideo2) ? existingVideo2 : webcamVideoElement ? webcamVideoElement : document2.createElement("video");
|
|
1757
|
-
const
|
|
1831
|
+
const _cameraStream = void 0;
|
|
1758
1832
|
if (crossOrigin) {
|
|
1759
1833
|
videoElement.crossOrigin = options.crossOrigin;
|
|
1760
1834
|
}
|
|
@@ -1876,7 +1950,7 @@ var __exports__ = (() => {
|
|
|
1876
1950
|
const video = options.video;
|
|
1877
1951
|
const gifWidth = Number(options.gifWidth);
|
|
1878
1952
|
const gifHeight = Number(options.gifHeight);
|
|
1879
|
-
const
|
|
1953
|
+
const _numFrames = Number(options.numFrames);
|
|
1880
1954
|
const cameraStream = obj.cameraStream;
|
|
1881
1955
|
const videoElement = obj.videoElement;
|
|
1882
1956
|
const videoWidth = obj.videoWidth;
|
|
@@ -1923,11 +1997,11 @@ var __exports__ = (() => {
|
|
|
1923
1997
|
"globalThis.URL": true
|
|
1924
1998
|
};
|
|
1925
1999
|
const errorObj = error.validate(skipObj);
|
|
1926
|
-
const
|
|
2000
|
+
const _loadedImages = 0;
|
|
1927
2001
|
let videoType = void 0;
|
|
1928
2002
|
let videoSrc = void 0;
|
|
1929
|
-
const
|
|
1930
|
-
const
|
|
2003
|
+
const _tempImage = void 0;
|
|
2004
|
+
const _ag = void 0;
|
|
1931
2005
|
if (errorObj.error) {
|
|
1932
2006
|
return callback(errorObj);
|
|
1933
2007
|
}
|
|
@@ -2067,7 +2141,7 @@ var __exports__ = (() => {
|
|
|
2067
2141
|
crossOrigin: "Anonymous",
|
|
2068
2142
|
// Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.
|
|
2069
2143
|
// CALLBACKS
|
|
2070
|
-
progressCallback: (
|
|
2144
|
+
progressCallback: (_captureProgress) => {
|
|
2071
2145
|
},
|
|
2072
2146
|
// Callback that provides the current progress of the current image
|
|
2073
2147
|
completeCallback: () => {
|
|
@@ -2139,14 +2213,14 @@ var __exports__ = (() => {
|
|
|
2139
2213
|
savedRenderingContexts: []
|
|
2140
2214
|
// Array of canvas image data
|
|
2141
2215
|
};
|
|
2142
|
-
var GIFBuilder = class {
|
|
2216
|
+
var GIFBuilder = class _GIFBuilder {
|
|
2143
2217
|
static get properties() {
|
|
2144
2218
|
return {
|
|
2145
2219
|
id: "gif",
|
|
2146
2220
|
name: "GIF",
|
|
2147
2221
|
extensions: ["gif"],
|
|
2148
2222
|
mimeTypes: ["image/gif"],
|
|
2149
|
-
builder:
|
|
2223
|
+
builder: _GIFBuilder,
|
|
2150
2224
|
options: GIF_BUILDER_OPTIONS
|
|
2151
2225
|
};
|
|
2152
2226
|
}
|