@loaders.gl/video 4.0.0-alpha.5 → 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.
- package/dist/bundle.js +2 -2
- package/dist/dist.min.js +23 -21
- package/dist/es5/bundle.js +6 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/gif-builder.js +200 -0
- package/dist/es5/gif-builder.js.map +1 -0
- package/dist/es5/index.js +21 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/lib/gifshot/gifshot-loader.js +67 -0
- package/dist/es5/lib/gifshot/gifshot-loader.js.map +1 -0
- package/dist/es5/lib/gifshot/gifshot.js +1924 -0
- package/dist/es5/lib/gifshot/gifshot.js.map +1 -0
- package/dist/es5/lib/parsers/parse-video.js +31 -0
- package/dist/es5/lib/parsers/parse-video.js.map +1 -0
- package/dist/es5/lib/utils/assert.js +12 -0
- package/dist/es5/lib/utils/assert.js.map +1 -0
- package/dist/es5/video-loader.js +28 -0
- package/dist/es5/video-loader.js.map +1 -0
- package/dist/esm/bundle.js +4 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/gif-builder.js +106 -0
- package/dist/esm/gif-builder.js.map +1 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/gifshot/gifshot-loader.js +17 -0
- package/dist/esm/lib/gifshot/gifshot-loader.js.map +1 -0
- package/dist/esm/lib/gifshot/gifshot.js +1915 -0
- package/dist/esm/lib/gifshot/gifshot.js.map +1 -0
- package/dist/esm/lib/parsers/parse-video.js +7 -0
- package/dist/esm/lib/parsers/parse-video.js.map +1 -0
- package/dist/esm/lib/utils/assert.js +6 -0
- package/dist/esm/lib/utils/assert.js.map +1 -0
- package/dist/esm/video-loader.js +19 -0
- package/dist/esm/video-loader.js.map +1 -0
- package/dist/gif-builder.js +136 -114
- package/dist/index.js +10 -3
- package/dist/lib/gifshot/gifshot-loader.js +18 -15
- package/dist/lib/gifshot/gifshot.d.ts.map +1 -1
- package/dist/lib/gifshot/gifshot.js +2344 -2089
- package/dist/lib/parsers/parse-video.js +12 -6
- package/dist/lib/utils/assert.js +8 -5
- package/dist/video-loader.d.ts +1 -1
- package/dist/video-loader.d.ts.map +1 -1
- package/dist/video-loader.js +22 -14
- package/package.json +6 -6
- package/src/lib/gifshot/gifshot.ts +33 -32
- package/dist/bundle.js.map +0 -1
- package/dist/gif-builder.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/gifshot/gifshot-loader.js.map +0 -1
- package/dist/lib/gifshot/gifshot.js.map +0 -1
- package/dist/lib/parsers/parse-video.js.map +0 -1
- package/dist/lib/utils/assert.js.map +0 -1
- package/dist/lib/utils/globals.d.ts +0 -10
- package/dist/lib/utils/globals.d.ts.map +0 -1
- package/dist/lib/utils/globals.js +0 -16
- package/dist/lib/utils/globals.js.map +0 -1
- package/dist/video-loader.js.map +0 -1
- package/src/lib/utils/globals.ts +0 -25
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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
|
-
|
|
13
|
+
exports.default = parseVideo;
|
package/dist/lib/utils/assert.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
9
|
+
exports.assert = assert;
|
package/dist/video-loader.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { LoaderWithParser, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import parseVideo from './lib/parsers/parse-video';
|
|
3
|
-
export
|
|
3
|
+
export type VideoLoaderOptions = LoaderOptions & {
|
|
4
4
|
video: {};
|
|
5
5
|
};
|
|
6
6
|
export declare const VideoLoader: {
|
|
@@ -1 +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,
|
|
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"}
|
package/dist/video-loader.js
CHANGED
|
@@ -1,19 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
14
|
+
video: {}
|
|
7
15
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
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.
|
|
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": {
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"PLY"
|
|
20
20
|
],
|
|
21
21
|
"types": "dist/index.d.ts",
|
|
22
|
-
"main": "dist/index.js",
|
|
23
|
-
"module": "dist/index.js",
|
|
22
|
+
"main": "dist/es5/index.js",
|
|
23
|
+
"module": "dist/esm/index.js",
|
|
24
24
|
"sideEffects": false,
|
|
25
25
|
"files": [
|
|
26
26
|
"src",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
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.
|
|
36
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
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": "
|
|
39
|
+
"gitHead": "acc1985050dfaa0f1f0c066f8da5bce7454a046c"
|
|
40
40
|
}
|
|
@@ -16,21 +16,22 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
|
|
16
16
|
* Copyrights licensed under the MIT License. See the accompanying LICENSE file for terms.
|
|
17
17
|
*/
|
|
18
18
|
var utils = {
|
|
19
|
-
URL:
|
|
19
|
+
URL: globalThis.URL || globalThis.webkitURL || globalThis.mozURL || globalThis.msURL,
|
|
20
20
|
getUserMedia: (function () {
|
|
21
|
+
if (!globalThis.navigator) return globalThis.navigator;
|
|
21
22
|
const getUserMedia =
|
|
22
|
-
navigator.getUserMedia ||
|
|
23
|
-
navigator.webkitGetUserMedia ||
|
|
24
|
-
navigator.mozGetUserMedia ||
|
|
25
|
-
navigator.msGetUserMedia;
|
|
26
|
-
return getUserMedia ? getUserMedia.bind(navigator) : getUserMedia;
|
|
23
|
+
globalThis.navigator.getUserMedia ||
|
|
24
|
+
globalThis.navigator.webkitGetUserMedia ||
|
|
25
|
+
globalThis.navigator.mozGetUserMedia ||
|
|
26
|
+
globalThis.navigator.msGetUserMedia;
|
|
27
|
+
return getUserMedia ? getUserMedia.bind(globalThis.navigator) : getUserMedia;
|
|
27
28
|
})(),
|
|
28
29
|
requestAnimFrame:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
globalThis.requestAnimationFrame ||
|
|
31
|
+
globalThis.webkitRequestAnimationFrame ||
|
|
32
|
+
globalThis.mozRequestAnimationFrame ||
|
|
33
|
+
globalThis.oRequestAnimationFrame ||
|
|
34
|
+
globalThis.msRequestAnimationFrame,
|
|
34
35
|
requestTimeout: function requestTimeout(callback, delay) {
|
|
35
36
|
callback = callback || utils.noop;
|
|
36
37
|
delay = delay || 0;
|
|
@@ -49,14 +50,14 @@ var utils = {
|
|
|
49
50
|
return handle;
|
|
50
51
|
},
|
|
51
52
|
Blob:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
globalThis.Blob ||
|
|
54
|
+
globalThis.BlobBuilder ||
|
|
55
|
+
globalThis.WebKitBlobBuilder ||
|
|
56
|
+
globalThis.MozBlobBuilder ||
|
|
57
|
+
globalThis.MSBlobBuilder,
|
|
57
58
|
btoa: (function () {
|
|
58
59
|
const btoa =
|
|
59
|
-
|
|
60
|
+
globalThis.btoa ||
|
|
60
61
|
function (input) {
|
|
61
62
|
let output = '';
|
|
62
63
|
let i = 0;
|
|
@@ -87,7 +88,7 @@ var utils = {
|
|
|
87
88
|
}
|
|
88
89
|
return output;
|
|
89
90
|
};
|
|
90
|
-
return btoa ? btoa.bind(
|
|
91
|
+
return btoa ? btoa.bind(globalThis) : utils.noop;
|
|
91
92
|
})(),
|
|
92
93
|
isObject: function isObject(obj) {
|
|
93
94
|
return obj && Object.prototype.toString.call(obj) === '[object Object]';
|
|
@@ -113,16 +114,16 @@ var utils = {
|
|
|
113
114
|
return el && el.getContext && el.getContext('2d');
|
|
114
115
|
},
|
|
115
116
|
webworkers: function webworkers() {
|
|
116
|
-
return
|
|
117
|
+
return globalThis.Worker;
|
|
117
118
|
},
|
|
118
119
|
blob: function blob() {
|
|
119
120
|
return utils.Blob;
|
|
120
121
|
},
|
|
121
122
|
Uint8Array: function Uint8Array() {
|
|
122
|
-
return
|
|
123
|
+
return globalThis.Uint8Array;
|
|
123
124
|
},
|
|
124
125
|
Uint32Array: function Uint32Array() {
|
|
125
|
-
return
|
|
126
|
+
return globalThis.Uint32Array;
|
|
126
127
|
},
|
|
127
128
|
videoCodecs: (function () {
|
|
128
129
|
const testEl = document.createElement('video');
|
|
@@ -310,23 +311,23 @@ var error = {
|
|
|
310
311
|
},
|
|
311
312
|
{
|
|
312
313
|
condition: utils.isFunction(utils.URL),
|
|
313
|
-
errorCode: '
|
|
314
|
-
errorMsg: 'The
|
|
314
|
+
errorCode: 'globalThis.URL',
|
|
315
|
+
errorMsg: 'The globalThis.URL API is not supported in your browser'
|
|
315
316
|
},
|
|
316
317
|
{
|
|
317
318
|
condition: utils.isSupported.blob(),
|
|
318
|
-
errorCode: '
|
|
319
|
-
errorMsg: 'The
|
|
319
|
+
errorCode: 'globalThis.Blob',
|
|
320
|
+
errorMsg: 'The globalThis.Blob File API is not supported in your browser'
|
|
320
321
|
},
|
|
321
322
|
{
|
|
322
323
|
condition: utils.isSupported.Uint8Array(),
|
|
323
|
-
errorCode: '
|
|
324
|
-
errorMsg: 'The
|
|
324
|
+
errorCode: 'globalThis.Uint8Array',
|
|
325
|
+
errorMsg: 'The globalThis.Uint8Array function constructor is not supported in your browser'
|
|
325
326
|
},
|
|
326
327
|
{
|
|
327
328
|
condition: utils.isSupported.Uint32Array(),
|
|
328
|
-
errorCode: '
|
|
329
|
-
errorMsg: 'The
|
|
329
|
+
errorCode: 'globalThis.Uint32Array',
|
|
330
|
+
errorMsg: 'The globalThis.Uint32Array function constructor is not supported in your browser'
|
|
330
331
|
}
|
|
331
332
|
],
|
|
332
333
|
messages: {
|
|
@@ -907,7 +908,7 @@ function NeuQuant() {
|
|
|
907
908
|
function workerCode() {
|
|
908
909
|
const self = this;
|
|
909
910
|
try {
|
|
910
|
-
|
|
911
|
+
globalThis.onmessage = function (ev) {
|
|
911
912
|
const data = ev.data || {};
|
|
912
913
|
let response;
|
|
913
914
|
if (data.gifshot) {
|
|
@@ -1643,7 +1644,7 @@ function existingImages() {
|
|
|
1643
1644
|
let imagesLength = obj.imagesLength;
|
|
1644
1645
|
const skipObj = {
|
|
1645
1646
|
getUserMedia: true,
|
|
1646
|
-
'
|
|
1647
|
+
'globalThis.URL': true
|
|
1647
1648
|
};
|
|
1648
1649
|
const errorObj = error.validate(skipObj);
|
|
1649
1650
|
const loadedImages = [];
|
|
@@ -2242,7 +2243,7 @@ function existingVideo() {
|
|
|
2242
2243
|
const options = obj.options;
|
|
2243
2244
|
const skipObj = {
|
|
2244
2245
|
getUserMedia: true,
|
|
2245
|
-
'
|
|
2246
|
+
'globalThis.URL': true
|
|
2246
2247
|
};
|
|
2247
2248
|
const errorObj = error.validate(skipObj);
|
|
2248
2249
|
const loadedImages = 0;
|
package/dist/bundle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bundle.ts"],"names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"mappings":"AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAD,CAA7B;;AACAC,UAAU,CAACC,OAAX,GAAqBD,UAAU,CAACC,OAAX,IAAsB,EAA3C;AACAC,MAAM,CAACC,OAAP,GAAiBC,MAAM,CAACC,MAAP,CAAcL,UAAU,CAACC,OAAzB,EAAkCH,aAAlC,CAAjB","sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"file":"bundle.js"}
|
package/dist/gif-builder.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/gif-builder.ts"],"names":["assert","gifshot","GIF_BUILDER_OPTIONS","source","width","height","crossOrigin","progressCallback","captureProgress","completeCallback","numWorkers","sampleInterval","interval","offset","numFrames","frameDuration","filter","waterMark","waterMarkHeight","waterMarkWidth","waterMarkXCoordinate","waterMarkYCoordinate","text","showFrameText","fontWeight","fontSize","minFontSize","resizeFont","fontFamily","fontColor","textAlign","textBaseline","textXCoordinate","textYCoordinate","webcamVideoElement","keepCameraOn","cameraStream","saveRenderingContexts","savedRenderingContexts","GIFBuilder","properties","id","name","extensions","mimeTypes","builder","options","constructor","files","initialize","add","file","push","build","_cleanOptions","images","video","length","Error","_createGIF","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn"],"mappings":"AAEA,SAAQA,MAAR,QAAqB,oBAArB;AACA,OAAOC,OAAP,MAAoB,uBAApB;AAGA,MAAMC,mBAAmB,GAAG;AAC1BC,EAAAA,MAAM,EAAE,QADkB;AAE1BC,EAAAA,KAAK,EAAE,GAFmB;AAG1BC,EAAAA,MAAM,EAAE,GAHkB;AAK1BC,EAAAA,WAAW,EAAE,WALa;AAQ1BC,EAAAA,gBAAgB,EAAGC,eAAD,IAAqB,CAAE,CARf;AAS1BC,EAAAA,gBAAgB,EAAE,MAAM,CAAE,CATA;AAY1BC,EAAAA,UAAU,EAAE,CAZc;AAa1BC,EAAAA,cAAc,EAAE,EAbU;AAc1BC,EAAAA,QAAQ,EAAE,GAdgB;AAe1BC,EAAAA,MAAM,EAAE,IAfkB;AAgB1BC,EAAAA,SAAS,EAAE,EAhBe;AAiB1BC,EAAAA,aAAa,EAAE,CAjBW;AAoB1BC,EAAAA,MAAM,EAAE,EApBkB;AAuB1BC,EAAAA,SAAS,EAAE,IAvBe;AAwB1BC,EAAAA,eAAe,EAAE,IAxBS;AAyB1BC,EAAAA,cAAc,EAAE,IAzBU;AA0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AAa,8BAAb;AACD;;AAGD,WAAOzB,OAAO,CAACU,KAAf;AACA,WAAOV,OAAO,CAACS,MAAf;AAGAT,IAAAA,OAAO,CAACsB,QAAR,GAAmBtB,OAAO,CAAC1C,KAA3B;AACA0C,IAAAA,OAAO,CAACuB,SAAR,GAAoBvB,OAAO,CAACzC,MAA5B;AACA,WAAOyC,OAAO,CAAC1C,KAAf;AACA,WAAO0C,OAAO,CAACzC,MAAf;AACD;;AApG6B","sourcesContent":["// A GIFBuilder based on the gifshot module\n// @ts-nocheck\nimport {assert} from './lib/utils/assert';\nimport gifshot from './lib/gifshot/gifshot'; // TODO - load dynamically to avoid bloating\n\n// These are gifshot module options\nconst GIF_BUILDER_OPTIONS = {\n source: 'images',\n width: 200, // Desired width of the image\n height: 200, // Desired height of the image\n\n crossOrigin: 'Anonymous', // Options are 'Anonymous', 'use-credentials', or a falsy value to not set a CORS attribute.\n\n // CALLBACKS\n progressCallback: (captureProgress) => {}, // Callback that provides the current progress of the current image\n completeCallback: () => {}, // Callback function that is called when the current image is completed\n\n // QUALITY SETTINGS\n numWorkers: 2, // how many web workers to use to process the animated GIF frames. Default is 2.\n sampleInterval: 10, // pixels to skip when creating the palette. Default is 10. Less is better, but slower.\n interval: 0.1, // The amount of time (in seconds) to wait between each frame capture\n offset: null, // The amount of time (in seconds) to start capturing the GIF (only for HTML5 videos)\n numFrames: 10, // The number of frames to use to create the animated GIF. Note: Each frame is captured every 100 milliseconds of a video and every ms for existing images\n frameDuration: 1, // The amount of time (10 = 1s) to stay on each frame\n\n // CSS FILTER OPTIONS\n filter: '', // CSS filter that will be applied to the image (eg. blur(5px))\n\n // WATERMARK OPTIONS\n waterMark: null, // If an image is given here, it will be stamped on top of the GIF frames\n waterMarkHeight: null, // Height of the waterMark\n waterMarkWidth: null, // Height of the waterMark\n waterMarkXCoordinate: 1, // The X (horizontal) Coordinate of the watermark image\n waterMarkYCoordinate: 1, // The Y (vertical) Coordinate of the watermark image\n\n // TEXT OPTIONS\n text: '', // The text that covers the animated GIF\n showFrameText: true, // If frame-specific text is supplied with the image array, you can force to not be displayed\n fontWeight: 'normal', // The font weight of the text that covers the animated GIF\n fontSize: '16px', // The font size of the text that covers the animated GIF\n minFontSize: '10px', // The minimum font size of the text that covers the animated GIF\n resizeFont: false, // Whether or not the animated GIF text will be resized to fit within the GIF container\n fontFamily: 'sans-serif', // The font family of the text that covers the animated GIF\n fontColor: '#ffffff', // The font color of the text that covers the animated GIF\n textAlign: 'center', // The horizontal text alignment of the text that covers the animated GIF\n textBaseline: 'bottom', // The vertical text alignment of the text that covers the animated GIF\n textXCoordinate: null, // The X (horizontal) Coordinate of the text that covers the animated GIF\n textYCoordinate: null, // The Y (vertical) Coordinate of the text that covers the animated GIF\n\n // ADVANCED OPTIONS\n\n // WEBCAM CAPTURE OPTIONS\n webcamVideoElement: null, // You can pass an existing video element to use for the webcam GIF creation process,\n keepCameraOn: false, // Whether or not you would like the user's camera to stay on after the GIF is created\n cameraStream: null, // Expects a cameraStream Media object\n\n // CANVAS OPTIMIZATION OPTIONS\n saveRenderingContexts: false, // Whether or not you would like to save all of the canvas image binary data\n savedRenderingContexts: [] // Array of canvas image data\n};\n\nexport default class GIFBuilder {\n static get properties() {\n return {\n id: 'gif',\n name: 'GIF',\n extensions: ['gif'],\n mimeTypes: ['image/gif'],\n builder: GIFBuilder,\n options: GIF_BUILDER_OPTIONS\n };\n }\n\n constructor(options) {\n this.options = {...options};\n this.source = options.source;\n delete options.source;\n\n // Allow files to be added\n this.files = [];\n\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n this.gifshot = gifshot;\n }\n\n async initialize(options): Promise<void> {\n // Expose the gifshot module so that the full gifshot API is available to apps (Experimental)\n // this.gifshot = await loadGifshotModule(options);\n }\n\n async add(file): void {\n await this.initialize();\n this.files.push(file);\n }\n\n async build(): Promise<string> {\n await this.initialize();\n this._cleanOptions(this.options);\n\n switch (this.source) {\n case 'images':\n this.options.images = this.files;\n break;\n case 'video':\n this.options.video = this.files;\n break;\n case 'webcam':\n assert(this.files.length === 0);\n break;\n default:\n throw new Error('GIFBuilder: invalid source');\n }\n\n return await this._createGIF();\n }\n\n // PRIVATE\n\n async _createGIF(): Promise<string> {\n return new Promise((resolve, reject) => {\n this.gifshot.createGIF(this.options, (result) => {\n // callback object properties\n // --------------------------\n // image - Base 64 image\n // cameraStream - The webRTC MediaStream object\n // error - Boolean that determines if an error occurred\n // errorCode - Helpful error label\n // errorMsg - Helpful error message\n // savedRenderingContexts - An array of canvas image data (will only be set if the saveRenderingContexts option was used)\n\n if (result.error) {\n reject(result.errorMsg);\n return;\n }\n\n // image - Base 64 image\n resolve(result.image);\n\n // var image = obj.image,\n // animatedImage = document.createElement('img');\n // animatedImage.src = image;\n // document.body.appendChild(animatedImage);\n });\n });\n }\n\n // Remove some gifshot options\n _cleanOptions(options): void {\n if (options.video || options.images || options.gifWidth || options.gifHeight) {\n console.warn('GIFBuilder: ignoring options'); // eslint-disable-line\n }\n\n // We control these through options.source instead\n delete options.video;\n delete options.images;\n\n // Use width/height props (to standardize across builders)\n options.gifWidth = options.width;\n options.gifHeight = options.height;\n delete options.width;\n delete options.height;\n }\n}\n"],"file":"gif-builder.js"}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["VideoLoader","default","GIFBuilder"],"mappings":"AAAA,SAAQA,WAAR,QAA0B,gBAA1B;AAEA,SAAQC,OAAO,IAAIC,UAAnB,QAAoC,eAApC","sourcesContent":["export {VideoLoader} from './video-loader';\n\nexport {default as GIFBuilder} from './gif-builder';\n"],"file":"index.js"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/lib/gifshot/gifshot-loader.ts"],"names":["loadLibrary","loadGifshotPromise","loadGifshotModule","options","modules","gifshot","loadGifshot","libraryPath","globalThis"],"mappings":"AACA,SAAQA,WAAR,QAA0B,0BAA1B;AAEA,IAAIC,kBAAJ;AAEA,OAAO,eAAeC,iBAAf,CAAiCC,OAAO,GAAG,EAA3C,EAA+C;AACpD,QAAMC,OAAO,GAAGD,OAAO,CAACC,OAAR,IAAmB,EAAnC;;AACA,MAAIA,OAAO,CAACC,OAAZ,EAAqB;AACnB,WAAOD,OAAO,CAACC,OAAf;AACD;;AACDJ,EAAAA,kBAAkB,GAAGA,kBAAkB,IAAIK,WAAW,CAACH,OAAD,CAAtD;AACA,SAAO,MAAMF,kBAAb;AACD;;AAED,eAAeK,WAAf,CAA2BH,OAA3B,EAAoC;AAClCA,EAAAA,OAAO,CAACI,WAAR,GAAsBJ,OAAO,CAACI,WAAR,IAAuB,OAA7C;AACA,QAAMF,OAAO,GAAG,MAAML,WAAW,CAAC,YAAD,EAAe,SAAf,EAA0BG,OAA1B,CAAjC;AAIA,SAAOE,OAAO,IAAIG,UAAU,CAACH,OAA7B;AACD","sourcesContent":["// @ts-nocheck\nimport {loadLibrary} from '@loaders.gl/worker-utils';\n\nlet loadGifshotPromise;\n\nexport async function loadGifshotModule(options = {}) {\n const modules = options.modules || {};\n if (modules.gifshot) {\n return modules.gifshot;\n }\n loadGifshotPromise = loadGifshotPromise || loadGifshot(options);\n return await loadGifshotPromise;\n}\n\nasync function loadGifshot(options) {\n options.libraryPath = options.libraryPath || 'libs/';\n const gifshot = await loadLibrary('gifshot.js', 'gifshot', options);\n\n // Depends on how import happened...\n // @ts-ignore TS2339: Property does not exist on type\n return gifshot || globalThis.gifshot;\n}\n"],"file":"gifshot-loader.js"}
|