@loaders.gl/video 3.4.14 → 3.4.15
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/es5/bundle.js +1 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/gif-builder.js +62 -148
- package/dist/es5/gif-builder.js.map +1 -1
- package/dist/es5/index.js +2 -2
- package/dist/es5/lib/gifshot/gifshot-loader.js +13 -57
- package/dist/es5/lib/gifshot/gifshot-loader.js.map +1 -1
- package/dist/es5/lib/gifshot/gifshot.js +480 -482
- package/dist/es5/lib/gifshot/gifshot.js.map +1 -1
- package/dist/es5/lib/parsers/parse-video.js +5 -23
- package/dist/es5/lib/parsers/parse-video.js.map +1 -1
- package/dist/es5/video-loader.js +6 -6
- package/dist/es5/video-loader.js.map +1 -1
- package/dist/esm/video-loader.js +1 -1
- package/package.json +4 -4
package/dist/es5/bundle.js
CHANGED
package/dist/es5/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,
|
|
1
|
+
{"version":3,"file":"bundle.js","names":["moduleExports","require","globalThis","loaders","module","exports","Object","assign"],"sources":["../../src/bundle.ts"],"sourcesContent":["// @ts-nocheck\nconst moduleExports = require('./index');\nglobalThis.loaders = globalThis.loaders || {};\nmodule.exports = Object.assign(globalThis.loaders, moduleExports);\n"],"mappings":";;AACA,MAAMA,aAAa,GAAGC,OAAO,CAAC,SAAS,CAAC;AACxCC,UAAU,CAACC,OAAO,GAAGD,UAAU,CAACC,OAAO,IAAI,CAAC,CAAC;AAC7CC,MAAM,CAACC,OAAO,GAAGC,MAAM,CAACC,MAAM,CAACL,UAAU,CAACC,OAAO,EAAEH,aAAa,CAAC"}
|
package/dist/es5/gif-builder.js
CHANGED
|
@@ -5,22 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
8
|
var _assert = require("./lib/utils/assert");
|
|
14
9
|
var _gifshot = _interopRequireDefault(require("./lib/gifshot/gifshot"));
|
|
15
|
-
|
|
16
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
17
|
-
var GIF_BUILDER_OPTIONS = {
|
|
10
|
+
const GIF_BUILDER_OPTIONS = {
|
|
18
11
|
source: 'images',
|
|
19
12
|
width: 200,
|
|
20
13
|
height: 200,
|
|
21
14
|
crossOrigin: 'Anonymous',
|
|
22
|
-
progressCallback:
|
|
23
|
-
completeCallback:
|
|
15
|
+
progressCallback: captureProgress => {},
|
|
16
|
+
completeCallback: () => {},
|
|
24
17
|
numWorkers: 2,
|
|
25
18
|
sampleInterval: 10,
|
|
26
19
|
interval: 0.1,
|
|
@@ -51,150 +44,71 @@ var GIF_BUILDER_OPTIONS = {
|
|
|
51
44
|
saveRenderingContexts: false,
|
|
52
45
|
savedRenderingContexts: []
|
|
53
46
|
};
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
class GIFBuilder {
|
|
48
|
+
static get properties() {
|
|
49
|
+
return {
|
|
50
|
+
id: 'gif',
|
|
51
|
+
name: 'GIF',
|
|
52
|
+
extensions: ['gif'],
|
|
53
|
+
mimeTypes: ['image/gif'],
|
|
54
|
+
builder: GIFBuilder,
|
|
55
|
+
options: GIF_BUILDER_OPTIONS
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
constructor(options) {
|
|
59
|
+
this.options = {
|
|
60
|
+
...options
|
|
61
|
+
};
|
|
58
62
|
this.source = options.source;
|
|
59
63
|
delete options.source;
|
|
60
64
|
this.files = [];
|
|
61
65
|
this.gifshot = _gifshot.default;
|
|
62
66
|
}
|
|
63
|
-
(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
var _add = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(file) {
|
|
84
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
85
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
86
|
-
case 0:
|
|
87
|
-
_context2.next = 2;
|
|
88
|
-
return this.initialize();
|
|
89
|
-
case 2:
|
|
90
|
-
this.files.push(file);
|
|
91
|
-
case 3:
|
|
92
|
-
case "end":
|
|
93
|
-
return _context2.stop();
|
|
94
|
-
}
|
|
95
|
-
}, _callee2, this);
|
|
96
|
-
}));
|
|
97
|
-
function add(_x2) {
|
|
98
|
-
return _add.apply(this, arguments);
|
|
99
|
-
}
|
|
100
|
-
return add;
|
|
101
|
-
}()
|
|
102
|
-
}, {
|
|
103
|
-
key: "build",
|
|
104
|
-
value: function () {
|
|
105
|
-
var _build = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3() {
|
|
106
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
107
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
108
|
-
case 0:
|
|
109
|
-
_context3.next = 2;
|
|
110
|
-
return this.initialize();
|
|
111
|
-
case 2:
|
|
112
|
-
this._cleanOptions(this.options);
|
|
113
|
-
_context3.t0 = this.source;
|
|
114
|
-
_context3.next = _context3.t0 === 'images' ? 6 : _context3.t0 === 'video' ? 8 : _context3.t0 === 'webcam' ? 10 : 12;
|
|
115
|
-
break;
|
|
116
|
-
case 6:
|
|
117
|
-
this.options.images = this.files;
|
|
118
|
-
return _context3.abrupt("break", 13);
|
|
119
|
-
case 8:
|
|
120
|
-
this.options.video = this.files;
|
|
121
|
-
return _context3.abrupt("break", 13);
|
|
122
|
-
case 10:
|
|
123
|
-
(0, _assert.assert)(this.files.length === 0);
|
|
124
|
-
return _context3.abrupt("break", 13);
|
|
125
|
-
case 12:
|
|
126
|
-
throw new Error('GIFBuilder: invalid source');
|
|
127
|
-
case 13:
|
|
128
|
-
_context3.next = 15;
|
|
129
|
-
return this._createGIF();
|
|
130
|
-
case 15:
|
|
131
|
-
return _context3.abrupt("return", _context3.sent);
|
|
132
|
-
case 16:
|
|
133
|
-
case "end":
|
|
134
|
-
return _context3.stop();
|
|
135
|
-
}
|
|
136
|
-
}, _callee3, this);
|
|
137
|
-
}));
|
|
138
|
-
function build() {
|
|
139
|
-
return _build.apply(this, arguments);
|
|
140
|
-
}
|
|
141
|
-
return build;
|
|
142
|
-
}()
|
|
143
|
-
}, {
|
|
144
|
-
key: "_createGIF",
|
|
145
|
-
value: function () {
|
|
146
|
-
var _createGIF2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4() {
|
|
147
|
-
var _this = this;
|
|
148
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
149
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
150
|
-
case 0:
|
|
151
|
-
return _context4.abrupt("return", new Promise(function (resolve, reject) {
|
|
152
|
-
_this.gifshot.createGIF(_this.options, function (result) {
|
|
153
|
-
if (result.error) {
|
|
154
|
-
reject(result.errorMsg);
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
resolve(result.image);
|
|
158
|
-
});
|
|
159
|
-
}));
|
|
160
|
-
case 1:
|
|
161
|
-
case "end":
|
|
162
|
-
return _context4.stop();
|
|
163
|
-
}
|
|
164
|
-
}, _callee4);
|
|
165
|
-
}));
|
|
166
|
-
function _createGIF() {
|
|
167
|
-
return _createGIF2.apply(this, arguments);
|
|
168
|
-
}
|
|
169
|
-
return _createGIF;
|
|
170
|
-
}()
|
|
171
|
-
}, {
|
|
172
|
-
key: "_cleanOptions",
|
|
173
|
-
value: function _cleanOptions(options) {
|
|
174
|
-
if (options.video || options.images || options.gifWidth || options.gifHeight) {
|
|
175
|
-
console.warn('GIFBuilder: ignoring options');
|
|
176
|
-
}
|
|
177
|
-
delete options.video;
|
|
178
|
-
delete options.images;
|
|
179
|
-
options.gifWidth = options.width;
|
|
180
|
-
options.gifHeight = options.height;
|
|
181
|
-
delete options.width;
|
|
182
|
-
delete options.height;
|
|
67
|
+
async initialize(options) {}
|
|
68
|
+
async add(file) {
|
|
69
|
+
await this.initialize();
|
|
70
|
+
this.files.push(file);
|
|
71
|
+
}
|
|
72
|
+
async build() {
|
|
73
|
+
await this.initialize();
|
|
74
|
+
this._cleanOptions(this.options);
|
|
75
|
+
switch (this.source) {
|
|
76
|
+
case 'images':
|
|
77
|
+
this.options.images = this.files;
|
|
78
|
+
break;
|
|
79
|
+
case 'video':
|
|
80
|
+
this.options.video = this.files;
|
|
81
|
+
break;
|
|
82
|
+
case 'webcam':
|
|
83
|
+
(0, _assert.assert)(this.files.length === 0);
|
|
84
|
+
break;
|
|
85
|
+
default:
|
|
86
|
+
throw new Error('GIFBuilder: invalid source');
|
|
183
87
|
}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
};
|
|
88
|
+
return await this._createGIF();
|
|
89
|
+
}
|
|
90
|
+
async _createGIF() {
|
|
91
|
+
return new Promise((resolve, reject) => {
|
|
92
|
+
this.gifshot.createGIF(this.options, result => {
|
|
93
|
+
if (result.error) {
|
|
94
|
+
reject(result.errorMsg);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
resolve(result.image);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
_cleanOptions(options) {
|
|
102
|
+
if (options.video || options.images || options.gifWidth || options.gifHeight) {
|
|
103
|
+
console.warn('GIFBuilder: ignoring options');
|
|
195
104
|
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
105
|
+
delete options.video;
|
|
106
|
+
delete options.images;
|
|
107
|
+
options.gifWidth = options.width;
|
|
108
|
+
options.gifHeight = options.height;
|
|
109
|
+
delete options.width;
|
|
110
|
+
delete options.height;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
199
113
|
exports.default = GIFBuilder;
|
|
200
114
|
//# sourceMappingURL=gif-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gif-builder.js","names":["_assert","require","_gifshot","_interopRequireDefault","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","GIF_BUILDER_OPTIONS","width","height","crossOrigin","progressCallback","captureProgress","completeCallback","numWorkers","sampleInterval","interval","offset","numFrames","frameDuration","waterMark","waterMarkHeight","waterMarkWidth","waterMarkXCoordinate","waterMarkYCoordinate","text","showFrameText","fontWeight","fontSize","minFontSize","resizeFont","fontFamily","fontColor","textAlign","textBaseline","textXCoordinate","textYCoordinate","webcamVideoElement","keepCameraOn","cameraStream","saveRenderingContexts","savedRenderingContexts","GIFBuilder","options","_classCallCheck2","files","gifshot","_createClass2","value","_initialize","_asyncToGenerator2","_regenerator","mark","_callee","wrap","_callee$","_context","prev","next","stop","initialize","_x","_add","_callee2","file","_callee2$","_context2","add","_x2","_build","_callee3","_callee3$","_context3","_cleanOptions","t0","images","abrupt","video","assert","Error","_createGIF","sent","build","_createGIF2","_callee4","_this","_callee4$","_context4","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn","get","id","name","extensions","mimeTypes","builder","exports"],"sources":["../../src/gif-builder.ts"],"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"],"mappings":";;;;;;;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA4C,SAAAG,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAA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CAAC;QACxBC,OAAO,EAAE/D,UAAU;QACnBC,OAAO,EAAEpC;MACX,CAAC;IACH;EAAC;EAAA,OAAAmC,UAAA;AAAA;AAAAgE,OAAA,CAAAvG,OAAA,GAAAuC,UAAA"}
|
|
1
|
+
{"version":3,"file":"gif-builder.js","names":["_assert","require","_gifshot","_interopRequireDefault","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","gifshot","initialize","add","file","push","build","_cleanOptions","images","video","assert","length","Error","_createGIF","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn","exports","default"],"sources":["../../src/gif-builder.ts"],"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"],"mappings":";;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAC,sBAAA,CAAAF,OAAA;AAGA,MAAMG,mB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,CAACE,QAAQ,CAAC;UACvB;QACF;QAGAL,OAAO,CAACG,MAAM,CAACG,KAAK,CAAC;MAMvB,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;EAGAd,aAAaA,CAACT,OAAO,EAAQ;IAC3B,IAAIA,OAAO,CAACW,KAAK,IAAIX,OAAO,CAACU,MAAM,IAAIV,OAAO,CAACwB,QAAQ,IAAIxB,OAAO,CAACyB,SAAS,EAAE;MAC5EC,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC;IAC9C;IAGA,OAAO3B,OAAO,CAACW,KAAK;IACpB,OAAOX,OAAO,CAACU,MAAM;IAGrBV,OAAO,CAACwB,QAAQ,GAAGxB,OAAO,CAAC1C,KAAK;IAChC0C,OAAO,CAACyB,SAAS,GAAGzB,OAAO,CAACzC,MAAM;IAClC,OAAOyC,OAAO,CAAC1C,KAAK;IACpB,OAAO0C,OAAO,CAACzC,MAAM;EACvB;AACF;AAACqE,OAAA,CAAAC,OAAA,GAAApC,UAAA"}
|
package/dist/es5/index.js
CHANGED
|
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
Object.defineProperty(exports, "GIFBuilder", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function
|
|
9
|
+
get: function () {
|
|
10
10
|
return _gifBuilder.default;
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "VideoLoader", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function
|
|
15
|
+
get: function () {
|
|
16
16
|
return _videoLoader.VideoLoader;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
@@ -1,67 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.loadGifshotModule = loadGifshotModule;
|
|
8
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
7
|
var _workerUtils = require("@loaders.gl/worker-utils");
|
|
11
|
-
|
|
12
|
-
function loadGifshotModule() {
|
|
13
|
-
|
|
8
|
+
let loadGifshotPromise;
|
|
9
|
+
async function loadGifshotModule() {
|
|
10
|
+
let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
11
|
+
const modules = options.modules || {};
|
|
12
|
+
if (modules.gifshot) {
|
|
13
|
+
return modules.gifshot;
|
|
14
|
+
}
|
|
15
|
+
loadGifshotPromise = loadGifshotPromise || loadGifshot(options);
|
|
16
|
+
return await loadGifshotPromise;
|
|
14
17
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
_args = arguments;
|
|
20
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
21
|
-
while (1) switch (_context.prev = _context.next) {
|
|
22
|
-
case 0:
|
|
23
|
-
options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
|
|
24
|
-
modules = options.modules || {};
|
|
25
|
-
if (!modules.gifshot) {
|
|
26
|
-
_context.next = 4;
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
return _context.abrupt("return", modules.gifshot);
|
|
30
|
-
case 4:
|
|
31
|
-
loadGifshotPromise = loadGifshotPromise || loadGifshot(options);
|
|
32
|
-
_context.next = 7;
|
|
33
|
-
return loadGifshotPromise;
|
|
34
|
-
case 7:
|
|
35
|
-
return _context.abrupt("return", _context.sent);
|
|
36
|
-
case 8:
|
|
37
|
-
case "end":
|
|
38
|
-
return _context.stop();
|
|
39
|
-
}
|
|
40
|
-
}, _callee);
|
|
41
|
-
}));
|
|
42
|
-
return _loadGifshotModule.apply(this, arguments);
|
|
43
|
-
}
|
|
44
|
-
function loadGifshot(_x) {
|
|
45
|
-
return _loadGifshot.apply(this, arguments);
|
|
46
|
-
}
|
|
47
|
-
function _loadGifshot() {
|
|
48
|
-
_loadGifshot = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(options) {
|
|
49
|
-
var gifshot;
|
|
50
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
51
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
52
|
-
case 0:
|
|
53
|
-
options.libraryPath = options.libraryPath || 'libs/';
|
|
54
|
-
_context2.next = 3;
|
|
55
|
-
return (0, _workerUtils.loadLibrary)('gifshot.js', 'gifshot', options);
|
|
56
|
-
case 3:
|
|
57
|
-
gifshot = _context2.sent;
|
|
58
|
-
return _context2.abrupt("return", gifshot || globalThis.gifshot);
|
|
59
|
-
case 5:
|
|
60
|
-
case "end":
|
|
61
|
-
return _context2.stop();
|
|
62
|
-
}
|
|
63
|
-
}, _callee2);
|
|
64
|
-
}));
|
|
65
|
-
return _loadGifshot.apply(this, arguments);
|
|
18
|
+
async function loadGifshot(options) {
|
|
19
|
+
options.libraryPath = options.libraryPath || 'libs/';
|
|
20
|
+
const gifshot = await (0, _workerUtils.loadLibrary)('gifshot.js', 'gifshot', options);
|
|
21
|
+
return gifshot || globalThis.gifshot;
|
|
66
22
|
}
|
|
67
23
|
//# sourceMappingURL=gifshot-loader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gifshot-loader.js","names":["_workerUtils","require","loadGifshotPromise","loadGifshotModule","
|
|
1
|
+
{"version":3,"file":"gifshot-loader.js","names":["_workerUtils","require","loadGifshotPromise","loadGifshotModule","options","arguments","length","undefined","modules","gifshot","loadGifshot","libraryPath","loadLibrary","globalThis"],"sources":["../../../../src/lib/gifshot/gifshot-loader.ts"],"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"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAIC,kBAAkB;AAEf,eAAeC,iBAAiBA,CAAA,EAAe;EAAA,IAAdC,OAAO,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EAClD,MAAMG,OAAO,GAAGJ,OAAO,CAACI,OAAO,IAAI,CAAC,CAAC;EACrC,IAAIA,OAAO,CAACC,OAAO,EAAE;IACnB,OAAOD,OAAO,CAACC,OAAO;EACxB;EACAP,kBAAkB,GAAGA,kBAAkB,IAAIQ,WAAW,CAACN,OAAO,CAAC;EAC/D,OAAO,MAAMF,kBAAkB;AACjC;AAEA,eAAeQ,WAAWA,CAACN,OAAO,EAAE;EAClCA,OAAO,CAACO,WAAW,GAAGP,OAAO,CAACO,WAAW,IAAI,OAAO;EACpD,MAAMF,OAAO,GAAG,MAAM,IAAAG,wBAAW,EAAC,YAAY,EAAE,SAAS,EAAER,OAAO,CAAC;EAInE,OAAOK,OAAO,IAAII,UAAU,CAACJ,OAAO;AACtC"}
|