videomail-client 9.2.12 → 9.2.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "videomail-client",
3
- "version": "9.2.12",
3
+ "version": "9.2.13",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -17267,7 +17267,7 @@ function wrappy (fn, cb) {
17267
17267
  },{}],116:[function(_dereq_,module,exports){
17268
17268
  module.exports={
17269
17269
  "name": "videomail-client",
17270
- "version": "9.2.12",
17270
+ "version": "9.2.13",
17271
17271
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
17272
17272
  "keywords": [
17273
17273
  "webcam",
@@ -17477,12 +17477,12 @@ var VideomailClient = function VideomailClient(options) {
17477
17477
  container.buildForm();
17478
17478
  container.loadForm(videomail);
17479
17479
 
17480
- // slight delay needed to avoid HTTP 416 errors (request range unavailable)
17481
- setTimeout(function () {
17482
- var replay = container.getReplay();
17483
- replay.setVideomail(videomail);
17480
+ // Wait until ready to avoid HTTP 416 errors (request range unavailable)
17481
+ this.once(_events.default.REPLAY_SHOWN, function () {
17484
17482
  container.showReplayOnly();
17485
- }, 50); // not sure, but probably can be reduced a bit
17483
+ });
17484
+ var replay = container.getReplay();
17485
+ replay.setVideomail(videomail);
17486
17486
  };
17487
17487
  this.startOver = function (params) {
17488
17488
  var replay = container.getReplay();
@@ -17493,6 +17493,7 @@ var VideomailClient = function VideomailClient(options) {
17493
17493
  container.startOver(params);
17494
17494
  };
17495
17495
  this.unload = function (e) {
17496
+ this.removeAllListeners();
17496
17497
  container.unload(e);
17497
17498
  };
17498
17499
  this.hide = function () {
@@ -19744,6 +19745,7 @@ var Buttons = function Buttons(container, options) {
19744
19745
  this.unload = function () {
19745
19746
  if (built) {
19746
19747
  debug("Buttons: unload()");
19748
+ self.removeAllListeners();
19747
19749
  built = false;
19748
19750
  }
19749
19751
  };
@@ -21102,6 +21104,7 @@ var Visuals = function Visuals(container, options) {
21102
21104
  return;
21103
21105
  }
21104
21106
  debug("Visuals: unload(".concat(e ? (0, _safeJsonStringify.default)(e) : "", ")"));
21107
+ self.removeAllListeners();
21105
21108
  recorder.unload(e);
21106
21109
  recorderInsides.unload(e);
21107
21110
  replay.unload();
@@ -21198,7 +21201,7 @@ var Visuals = function Visuals(container, options) {
21198
21201
  this.showVisuals();
21199
21202
  };
21200
21203
  this.showReplayOnly = function () {
21201
- !this.isReplayShown() && replay.show();
21204
+ replay.show();
21202
21205
  this.show();
21203
21206
  recorder.hide();
21204
21207
  notifier.hide();
@@ -23211,7 +23214,14 @@ var Replay = function Replay(parentElement, options) {
23211
23214
  this.show(videomail && videomail.width, videomail && videomail.height, hasAudio);
23212
23215
  };
23213
23216
  this.show = function (recorderWidth, recorderHeight, hasAudio) {
23214
- var _replayElement3;
23217
+ if (!replayElement) {
23218
+ return;
23219
+ }
23220
+ if (self.isShown()) {
23221
+ // Skip, already shown
23222
+ return;
23223
+ }
23224
+ debug("Replay: show()");
23215
23225
  if (videomail) {
23216
23226
  correctDimensions({
23217
23227
  responsive: true,
@@ -23220,9 +23230,7 @@ var Replay = function Replay(parentElement, options) {
23220
23230
  videoHeight: recorderHeight || replayElement.videoHeight
23221
23231
  });
23222
23232
  }
23223
- if (replayElement) {
23224
- (0, _hidden.default)(replayElement, false);
23225
- }
23233
+ (0, _hidden.default)(replayElement, false);
23226
23234
 
23227
23235
  // parent element can be any object, be careful!
23228
23236
  if (parentElement) {
@@ -23233,31 +23241,33 @@ var Replay = function Replay(parentElement, options) {
23233
23241
  }
23234
23242
  }
23235
23243
  if (hasAudio) {
23236
- var _replayElement;
23237
23244
  /*
23238
23245
  * https://github.com/binarykitchen/videomail-client/issues/115
23239
23246
  * do not set mute to false as this will mess up. just do not mention this attribute at all
23240
23247
  */
23241
- (_replayElement = replayElement) === null || _replayElement === void 0 || _replayElement.setAttribute("volume", 1);
23248
+ replayElement.setAttribute("volume", 1);
23242
23249
  } else if (!options.isAudioEnabled()) {
23243
- var _replayElement2;
23244
- (_replayElement2 = replayElement) === null || _replayElement2 === void 0 || _replayElement2.setAttribute("muted", true);
23250
+ replayElement.setAttribute("muted", true);
23245
23251
  }
23246
23252
 
23247
23253
  /*
23248
23254
  * this must be called after setting the sources and when becoming visible
23249
23255
  * see https://github.com/bfred-it/iphone-inline-video/issues/16
23250
23256
  */
23251
- _iphoneInlineVideo.default && replayElement && (0, _iphoneInlineVideo.default)(replayElement, {
23257
+ _iphoneInlineVideo.default && (0, _iphoneInlineVideo.default)(replayElement, {
23252
23258
  iPad: true
23253
23259
  });
23254
23260
 
23255
23261
  // this forces to actually fetch the videos from the server
23256
- (_replayElement3 = replayElement) === null || _replayElement3 === void 0 || _replayElement3.load();
23262
+ replayElement.load();
23257
23263
  if (!videomail) {
23258
- self.emit(_events.default.PREVIEW_SHOWN);
23264
+ replayElement.addEventListener("canplaythrough", function (event) {
23265
+ self.emit(_events.default.PREVIEW_SHOWN, event);
23266
+ });
23259
23267
  } else {
23260
- self.emit(_events.default.REPLAY_SHOWN);
23268
+ replayElement.addEventListener("canplaythrough", function (event) {
23269
+ self.emit(_events.default.REPLAY_SHOWN, event);
23270
+ });
23261
23271
  }
23262
23272
  };
23263
23273
  this.build = function (replayParentElement) {
@@ -23276,7 +23286,7 @@ var Replay = function Replay(parentElement, options) {
23276
23286
  replayElement.setAttribute("preload", "auto");
23277
23287
  if (!built) {
23278
23288
  if (!isStandalone()) {
23279
- this.on(_events.default.PREVIEW, function (key, recorderWidth, recorderHeight) {
23289
+ this.on(_events.default.PREVIEW, function (_key, recorderWidth, recorderHeight) {
23280
23290
  self.show(recorderWidth, recorderHeight);
23281
23291
  });
23282
23292
  }
@@ -23314,6 +23324,7 @@ var Replay = function Replay(parentElement, options) {
23314
23324
  };
23315
23325
  this.unload = function () {
23316
23326
  debug("Replay: unload()");
23327
+ self.removeAllListeners();
23317
23328
  replayElement.remove();
23318
23329
  replayElement = undefined;
23319
23330
  videomail = undefined;