@loaders.gl/video 3.4.0-alpha.2 → 3.4.0-alpha.3

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.
@@ -14,32 +14,25 @@ var _assert = require("./lib/utils/assert");
14
14
  var _gifshot = _interopRequireDefault(require("./lib/gifshot/gifshot"));
15
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
16
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
-
18
17
  var GIF_BUILDER_OPTIONS = {
19
18
  source: 'images',
20
19
  width: 200,
21
20
  height: 200,
22
-
23
21
  crossOrigin: 'Anonymous',
24
-
25
22
  progressCallback: function progressCallback(captureProgress) {},
26
23
  completeCallback: function completeCallback() {},
27
-
28
24
  numWorkers: 2,
29
25
  sampleInterval: 10,
30
26
  interval: 0.1,
31
27
  offset: null,
32
28
  numFrames: 10,
33
29
  frameDuration: 1,
34
-
35
30
  filter: '',
36
-
37
31
  waterMark: null,
38
32
  waterMarkHeight: null,
39
33
  waterMarkWidth: null,
40
34
  waterMarkXCoordinate: 1,
41
35
  waterMarkYCoordinate: 1,
42
-
43
36
  text: '',
44
37
  showFrameText: true,
45
38
  fontWeight: 'normal',
@@ -52,11 +45,9 @@ var GIF_BUILDER_OPTIONS = {
52
45
  textBaseline: 'bottom',
53
46
  textXCoordinate: null,
54
47
  textYCoordinate: null,
55
-
56
48
  webcamVideoElement: null,
57
49
  keepCameraOn: false,
58
50
  cameraStream: null,
59
-
60
51
  saveRenderingContexts: false,
61
52
  savedRenderingContexts: []
62
53
  };
@@ -66,9 +57,7 @@ var GIFBuilder = function () {
66
57
  this.options = _objectSpread({}, options);
67
58
  this.source = options.source;
68
59
  delete options.source;
69
-
70
60
  this.files = [];
71
-
72
61
  this.gifshot = _gifshot.default;
73
62
  }
74
63
  (0, _createClass2.default)(GIFBuilder, [{
@@ -76,12 +65,10 @@ var GIFBuilder = function () {
76
65
  value: function () {
77
66
  var _initialize = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(options) {
78
67
  return _regenerator.default.wrap(function _callee$(_context) {
79
- while (1) {
80
- switch (_context.prev = _context.next) {
81
- case 0:
82
- case "end":
83
- return _context.stop();
84
- }
68
+ while (1) switch (_context.prev = _context.next) {
69
+ case 0:
70
+ case "end":
71
+ return _context.stop();
85
72
  }
86
73
  }, _callee);
87
74
  }));
@@ -95,17 +82,15 @@ var GIFBuilder = function () {
95
82
  value: function () {
96
83
  var _add = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(file) {
97
84
  return _regenerator.default.wrap(function _callee2$(_context2) {
98
- while (1) {
99
- switch (_context2.prev = _context2.next) {
100
- case 0:
101
- _context2.next = 2;
102
- return this.initialize();
103
- case 2:
104
- this.files.push(file);
105
- case 3:
106
- case "end":
107
- return _context2.stop();
108
- }
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();
109
94
  }
110
95
  }, _callee2, this);
111
96
  }));
@@ -119,36 +104,34 @@ var GIFBuilder = function () {
119
104
  value: function () {
120
105
  var _build = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3() {
121
106
  return _regenerator.default.wrap(function _callee3$(_context3) {
122
- while (1) {
123
- switch (_context3.prev = _context3.next) {
124
- case 0:
125
- _context3.next = 2;
126
- return this.initialize();
127
- case 2:
128
- this._cleanOptions(this.options);
129
- _context3.t0 = this.source;
130
- _context3.next = _context3.t0 === 'images' ? 6 : _context3.t0 === 'video' ? 8 : _context3.t0 === 'webcam' ? 10 : 12;
131
- break;
132
- case 6:
133
- this.options.images = this.files;
134
- return _context3.abrupt("break", 13);
135
- case 8:
136
- this.options.video = this.files;
137
- return _context3.abrupt("break", 13);
138
- case 10:
139
- (0, _assert.assert)(this.files.length === 0);
140
- return _context3.abrupt("break", 13);
141
- case 12:
142
- throw new Error('GIFBuilder: invalid source');
143
- case 13:
144
- _context3.next = 15;
145
- return this._createGIF();
146
- case 15:
147
- return _context3.abrupt("return", _context3.sent);
148
- case 16:
149
- case "end":
150
- return _context3.stop();
151
- }
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();
152
135
  }
153
136
  }, _callee3, this);
154
137
  }));
@@ -163,25 +146,20 @@ var GIFBuilder = function () {
163
146
  var _createGIF2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee4() {
164
147
  var _this = this;
165
148
  return _regenerator.default.wrap(function _callee4$(_context4) {
166
- while (1) {
167
- switch (_context4.prev = _context4.next) {
168
- case 0:
169
- return _context4.abrupt("return", new Promise(function (resolve, reject) {
170
- _this.gifshot.createGIF(_this.options, function (result) {
171
-
172
- if (result.error) {
173
- reject(result.errorMsg);
174
- return;
175
- }
176
-
177
- resolve(result.image);
178
-
179
- });
180
- }));
181
- case 1:
182
- case "end":
183
- return _context4.stop();
184
- }
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();
185
163
  }
186
164
  }, _callee4);
187
165
  }));
@@ -192,15 +170,12 @@ var GIFBuilder = function () {
192
170
  }()
193
171
  }, {
194
172
  key: "_cleanOptions",
195
- value:
196
- function _cleanOptions(options) {
173
+ value: function _cleanOptions(options) {
197
174
  if (options.video || options.images || options.gifWidth || options.gifHeight) {
198
175
  console.warn('GIFBuilder: ignoring options');
199
176
  }
200
-
201
177
  delete options.video;
202
178
  delete options.images;
203
-
204
179
  options.gifWidth = options.width;
205
180
  options.gifHeight = options.height;
206
181
  delete options.width;
@@ -1 +1 @@
1
- {"version":3,"file":"gif-builder.js","names":["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","options","files","gifshot","file","initialize","push","_cleanOptions","images","video","assert","length","Error","_createGIF","Promise","resolve","reject","createGIF","result","error","errorMsg","image","gifWidth","gifHeight","console","warn","id","name","extensions","mimeTypes","builder"],"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;AACA;AAA4C;AAAA;;AAG5C,IAAMA,mBAAmB,GAAG;EAC1BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,GAAG;EACVC,MAAM,EAAE,GAAG;;EAEXC,WAAW,EAAE,WAAW;;EAGxBC,gBAAgB,EAAE,0BAACC,eAAe,EAAK,CAAC,CAAC;EACzCC,gBAAgB,EAAE,4BAAM,CAAC,CAAC;;EAG1BC,UAAU,EAAE,CAAC;EACbC,cAAc,EAAE,EAAE;EAClBC,QAAQ,EAAE,GAAG;EACbC,MAAM,EAAE,IAAI;EACZC,SAAS,EAAE,EAAE;EACbC,aAAa,EAAE,CAAC;;EAGhBC,MAAM,EAAE,EAAE;;EAGVC,SAAS,EAAE,IAAI;EACfC,eAAe,EAAE,IAAI;EACrBC,cAAc,EAAE,IAAI;EACpBC,oBAAoB,EAAE,CAAC;EACvBC,oBAAoB,EAAE,CAAC;;EAGvBC,IAAI,EAAE,EAAE;EACRC,aAAa,EAAE,IAAI;EACnBC,UAAU,EAAE,QAAQ;EACpBC,QAAQ,EAAE,MAAM;EAChBC,WAAW,EAAE,MAAM;EAC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,CAACqB,QAAQ,GAAGrB,OAAO,CAACpC,KAAK;MAChCoC,OAAO,CAACsB,SAAS,GAAGtB,OAAO,CAACnC,MAAM;MAClC,OAAOmC,OAAO,CAACpC,KAAK;MACpB,OAAOoC,OAAO,CAACnC,MAAM;IACvB;EAAC;IAAA;IAAA,KAnGD,eAAwB;MACtB,OAAO;QACL4D,EAAE,EAAE,KAAK;QACTC,IAAI,EAAE,KAAK;QACXC,UAAU,EAAE,CAAC,KAAK,CAAC;QACnBC,SAAS,EAAE,CAAC,WAAW,CAAC;QACxBC,OAAO,EAAE9B,UAAU;QACnBC,OAAO,EAAEtC;MACX,CAAC;IACH;EAAC;EAAA;AAAA;AAAA"}
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,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,CAAAC,OAAA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WAAA,CAAA1F,KAAA,OAAAI,SAAA;MAAA;MAAA,OAAAmF,UAAA;IAAA;EAAA;IAAA/E,GAAA;IAAA+C,KAAA,EAGD,SAAAyB,cAAc9B,OAAO,EAAQ;MAC3B,IAAIA,OAAO,CAACkC,KAAK,IAAIlC,OAAO,CAACgC,MAAM,IAAIhC,OAAO,CAACqD,QAAQ,IAAIrD,OAAO,CAACsD,SAAS,EAAE;QAC5EC,OAAO,CAACC,IAAI,CAAC,8BAA8B,CAAC;MAC9C;MAGA,OAAOxD,OAAO,CAACkC,KAAK;MACpB,OAAOlC,OAAO,CAACgC,MAAM;MAGrBhC,OAAO,CAACqD,QAAQ,GAAGrD,OAAO,CAACnC,KAAK;MAChCmC,OAAO,CAACsD,SAAS,GAAGtD,OAAO,CAAClC,MAAM;MAClC,OAAOkC,OAAO,CAACnC,KAAK;MACpB,OAAOmC,OAAO,CAAClC,MAAM;IACvB;EAAC;IAAAR,GAAA;IAAAmG,GAAA,EAnGD,SAAAA,IAAA,EAAwB;MACtB,OAAO;QACLC,EAAE,EAAE,KAAK;QACTC,IAAI,EAAE,KAAK;QACXC,UAAU,EAAE,CAAC,KAAK,CAAC;QACnBC,SAAS,EAAE,CAAC,WAAW,CAAC;QACxBC,OAAO,EAAE/D,UAAU;QACnBC,OAAO,EAAEpC;MACX,CAAC;IACH;EAAC;EAAA,OAAAmC,UAAA;AAAA;AAAAgE,OAAA,CAAAvG,OAAA,GAAAuC,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export {VideoLoader} from './video-loader';\n\nexport {default as GIFBuilder} from './gif-builder';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAEA"}
1
+ {"version":3,"file":"index.js","names":["_videoLoader","require","_gifBuilder","_interopRequireDefault"],"sources":["../../src/index.ts"],"sourcesContent":["export {VideoLoader} from './video-loader';\n\nexport {default as GIFBuilder} from './gif-builder';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA"}
@@ -8,7 +8,6 @@ exports.loadGifshotModule = loadGifshotModule;
8
8
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
9
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
10
  var _workerUtils = require("@loaders.gl/worker-utils");
11
-
12
11
  var loadGifshotPromise;
13
12
  function loadGifshotModule() {
14
13
  return _loadGifshotModule.apply(this, arguments);
@@ -19,26 +18,24 @@ function _loadGifshotModule() {
19
18
  modules,
20
19
  _args = arguments;
21
20
  return _regenerator.default.wrap(function _callee$(_context) {
22
- while (1) {
23
- switch (_context.prev = _context.next) {
24
- case 0:
25
- options = _args.length > 0 && _args[0] !== undefined ? _args[0] : {};
26
- modules = options.modules || {};
27
- if (!modules.gifshot) {
28
- _context.next = 4;
29
- break;
30
- }
31
- return _context.abrupt("return", modules.gifshot);
32
- case 4:
33
- loadGifshotPromise = loadGifshotPromise || loadGifshot(options);
34
- _context.next = 7;
35
- return loadGifshotPromise;
36
- case 7:
37
- return _context.abrupt("return", _context.sent);
38
- case 8:
39
- case "end":
40
- return _context.stop();
41
- }
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();
42
39
  }
43
40
  }, _callee);
44
41
  }));
@@ -51,19 +48,17 @@ function _loadGifshot() {
51
48
  _loadGifshot = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(options) {
52
49
  var gifshot;
53
50
  return _regenerator.default.wrap(function _callee2$(_context2) {
54
- while (1) {
55
- switch (_context2.prev = _context2.next) {
56
- case 0:
57
- options.libraryPath = options.libraryPath || 'libs/';
58
- _context2.next = 3;
59
- return (0, _workerUtils.loadLibrary)('gifshot.js', 'gifshot', options);
60
- case 3:
61
- gifshot = _context2.sent;
62
- return _context2.abrupt("return", gifshot || globalThis.gifshot);
63
- case 5:
64
- case "end":
65
- return _context2.stop();
66
- }
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();
67
62
  }
68
63
  }, _callee2);
69
64
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"gifshot-loader.js","names":["loadGifshotPromise","loadGifshotModule","options","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;;AAEA,IAAIA,kBAAkB;AAAC,SAEDC,iBAAiB;EAAA;AAAA;AAAA;EAAA,+EAAhC;IAAA;MAAA;MAAA;IAAA;MAAA;QAAA;UAAA;YAAiCC,OAAO,2DAAG,CAAC,CAAC;YAC5CC,OAAO,GAAGD,OAAO,CAACC,OAAO,IAAI,CAAC,CAAC;YAAA,KACjCA,OAAO,CAACC,OAAO;cAAA;cAAA;YAAA;YAAA,iCACVD,OAAO,CAACC,OAAO;UAAA;YAExBJ,kBAAkB,GAAGA,kBAAkB,IAAIK,WAAW,CAACH,OAAO,CAAC;YAAC;YAAA,OACnDF,kBAAkB;UAAA;YAAA;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CAChC;EAAA;AAAA;AAAA,SAEcK,WAAW;EAAA;AAAA;AAAA;EAAA,yEAA1B,kBAA2BH,OAAO;IAAA;IAAA;MAAA;QAAA;UAAA;YAChCA,OAAO,CAACI,WAAW,GAAGJ,OAAO,CAACI,WAAW,IAAI,OAAO;YAAC;YAAA,OAC/B,IAAAC,wBAAW,EAAC,YAAY,EAAE,SAAS,EAAEL,OAAO,CAAC;UAAA;YAA7DE,OAAO;YAAA,kCAINA,OAAO,IAAII,UAAU,CAACJ,OAAO;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACrC;EAAA;AAAA"}
1
+ {"version":3,"file":"gifshot-loader.js","names":["_workerUtils","require","loadGifshotPromise","loadGifshotModule","_loadGifshotModule","apply","arguments","_asyncToGenerator2","default","_regenerator","mark","_callee","options","modules","_args","wrap","_callee$","_context","prev","next","length","undefined","gifshot","abrupt","loadGifshot","sent","stop","_x","_loadGifshot","_callee2","_callee2$","_context2","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;AAAC,SAEDC,iBAAiBA,CAAA;EAAA,OAAAC,kBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAF,mBAAA;EAAAA,kBAAA,OAAAG,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAAhC,SAAAC,QAAA;IAAA,IAAAC,OAAA;MAAAC,OAAA;MAAAC,KAAA,GAAAR,SAAA;IAAA,OAAAG,YAAA,CAAAD,OAAA,CAAAO,IAAA,UAAAC,SAAAC,QAAA;MAAA,kBAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;QAAA;UAAiCP,OAAO,GAAAE,KAAA,CAAAM,MAAA,QAAAN,KAAA,QAAAO,SAAA,GAAAP,KAAA,MAAG,CAAC,CAAC;UAC5CD,OAAO,GAAGD,OAAO,CAACC,OAAO,IAAI,CAAC,CAAC;UAAA,KACjCA,OAAO,CAACS,OAAO;YAAAL,QAAA,CAAAE,IAAA;YAAA;UAAA;UAAA,OAAAF,QAAA,CAAAM,MAAA,WACVV,OAAO,CAACS,OAAO;QAAA;UAExBpB,kBAAkB,GAAGA,kBAAkB,IAAIsB,WAAW,CAACZ,OAAO,CAAC;UAACK,QAAA,CAAAE,IAAA;UAAA,OACnDjB,kBAAkB;QAAA;UAAA,OAAAe,QAAA,CAAAM,MAAA,WAAAN,QAAA,CAAAQ,IAAA;QAAA;QAAA;UAAA,OAAAR,QAAA,CAAAS,IAAA;MAAA;IAAA,GAAAf,OAAA;EAAA,CAChC;EAAA,OAAAP,kBAAA,CAAAC,KAAA,OAAAC,SAAA;AAAA;AAAA,SAEckB,WAAWA,CAAAG,EAAA;EAAA,OAAAC,YAAA,CAAAvB,KAAA,OAAAC,SAAA;AAAA;AAAA,SAAAsB,aAAA;EAAAA,YAAA,OAAArB,kBAAA,CAAAC,OAAA,EAAAC,YAAA,CAAAD,OAAA,CAAAE,IAAA,CAA1B,SAAAmB,SAA2BjB,OAAO;IAAA,IAAAU,OAAA;IAAA,OAAAb,YAAA,CAAAD,OAAA,CAAAO,IAAA,UAAAe,UAAAC,SAAA;MAAA,kBAAAA,SAAA,CAAAb,IAAA,GAAAa,SAAA,CAAAZ,IAAA;QAAA;UAChCP,OAAO,CAACoB,WAAW,GAAGpB,OAAO,CAACoB,WAAW,IAAI,OAAO;UAACD,SAAA,CAAAZ,IAAA;UAAA,OAC/B,IAAAc,wBAAW,EAAC,YAAY,EAAE,SAAS,EAAErB,OAAO,CAAC;QAAA;UAA7DU,OAAO,GAAAS,SAAA,CAAAN,IAAA;UAAA,OAAAM,SAAA,CAAAR,MAAA,WAIND,OAAO,IAAIY,UAAU,CAACZ,OAAO;QAAA;QAAA;UAAA,OAAAS,SAAA,CAAAL,IAAA;MAAA;IAAA,GAAAG,QAAA;EAAA,CACrC;EAAA,OAAAD,YAAA,CAAAvB,KAAA,OAAAC,SAAA;AAAA"}
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
7
-
8
+ var _readOnlyError2 = _interopRequireDefault(require("@babel/runtime/helpers/readOnlyError"));
8
9
  var utils = {
9
10
  URL: globalThis.URL || globalThis.webkitURL || globalThis.mozURL || globalThis.msURL,
10
11
  getUserMedia: function () {
@@ -446,7 +447,6 @@ function NeuQuant() {
446
447
  smallval = q[1];
447
448
  }
448
449
  }
449
-
450
450
  q = network[smallpos];
451
451
  if (i != smallpos) {
452
452
  j = q[0];
@@ -762,7 +762,6 @@ function workerCode() {
762
762
  rgb.push(data[i++]);
763
763
  i++;
764
764
  }
765
-
766
765
  return rgb;
767
766
  },
768
767
  componentizedPaletteToArray: function componentizedPaletteToArray(paletteRGB) {
@@ -831,8 +830,7 @@ function gifWriter(buf, width, height, gopts) {
831
830
  buf[p++] = width >> 8 & 0xff;
832
831
  buf[p++] = height & 0xff;
833
832
  buf[p++] = height >> 8 & 0xff;
834
- buf[p++] = (global_palette !== null ? 0x80 : 0) |
835
- gp_num_colors_pow2;
833
+ buf[p++] = (global_palette !== null ? 0x80 : 0) | gp_num_colors_pow2;
836
834
  buf[p++] = background;
837
835
  buf[p++] = 0;
838
836
  if (loop_count !== null) {
@@ -857,7 +855,6 @@ function gifWriter(buf, width, height, gopts) {
857
855
  buf[p++] = loop_count >> 8 & 0xff;
858
856
  buf[p++] = 0x00;
859
857
  }
860
-
861
858
  var ended = false;
862
859
  this.addFrame = function (x, y, w, h, indexed_pixels, opts) {
863
860
  if (ended === true) {
@@ -883,8 +880,7 @@ function gifWriter(buf, width, height, gopts) {
883
880
  num_colors = 1 << min_code_size;
884
881
  var delay = opts.delay === undefined ? 0 : opts.delay;
885
882
  var disposal = opts.disposal === undefined ? 0 : opts.disposal;
886
- if (disposal < 0 || disposal > 3)
887
- throw 'Disposal out of range.';
883
+ if (disposal < 0 || disposal > 3) throw 'Disposal out of range.';
888
884
  var use_transparency = false;
889
885
  var transparent_index = 0;
890
886
  if (opts.transparent !== undefined && opts.transparent !== null) {
@@ -983,13 +979,11 @@ function gifWriter(buf, width, height, gopts) {
983
979
  if (next_code >= 1 << cur_code_size) ++cur_code_size;
984
980
  code_table[cur_key] = next_code++;
985
981
  }
986
-
987
982
  ib_code = k;
988
983
  } else {
989
984
  ib_code = cur_code;
990
985
  }
991
986
  }
992
-
993
987
  emit_code(ib_code);
994
988
  emit_code(eoi_code);
995
989
  emit_bytes_to_buffer(1);