videomail-client 9.5.3 → 9.5.5

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.5.3",
3
+ "version": "9.5.5",
4
4
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
5
5
  "keywords": [
6
6
  "webcam",
@@ -16907,7 +16907,7 @@ function wrappy (fn, cb) {
16907
16907
  },{}],112:[function(_dereq_,module,exports){
16908
16908
  module.exports={
16909
16909
  "name": "videomail-client",
16910
- "version": "9.5.3",
16910
+ "version": "9.5.5",
16911
16911
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
16912
16912
  "keywords": [
16913
16913
  "webcam",
@@ -20615,7 +20615,7 @@ var Visuals = function Visuals(container, options) {
20615
20615
  function buildChildren() {
20616
20616
  var playerOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
20617
20617
  var replayParentElement = arguments.length > 1 ? arguments[1] : undefined;
20618
- debug("Visuals: buildChildren (playerOnly = ".concat(playerOnly).concat(replayParentElement ? ", replayParentElement=\"".concat(replayParentElement, "\"") : "", ")"));
20618
+ debug("Visuals: buildChildren (playerOnly = ".concat(playerOnly).concat(replayParentElement ? ", replayParentElement=\"".concat(replayParentElement.id, "\"") : "", ")"));
20619
20619
  buildNoScriptTag();
20620
20620
  if (!playerOnly) {
20621
20621
  notifier.build();
@@ -20685,20 +20685,27 @@ var Visuals = function Visuals(container, options) {
20685
20685
  this.build = function () {
20686
20686
  var playerOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
20687
20687
  var replayParentElement = arguments.length > 1 ? arguments[1] : undefined;
20688
+ debug("Visuals: build (playerOnly=".concat(playerOnly, ")"));
20688
20689
  if (container) {
20689
20690
  visualsElement = container.querySelector(".".concat(options.selectors.visualsClass));
20690
20691
  if (!visualsElement) {
20691
- visualsElement = (0, _hyperscript.default)("div.".concat(options.selectors.visualsClass));
20692
- var buttonsElement = container.querySelector(".".concat(options.selectors.buttonsClass));
20693
-
20694
- /*
20695
- * Make sure it's placed before the buttons, but only if it's a child
20696
- * element of the container = inside the container
20697
- */
20698
- if (buttonsElement && !container.isOutsideElementOf(buttonsElement)) {
20699
- container.insertBefore(visualsElement, buttonsElement);
20692
+ if (playerOnly && replayParentElement) {
20693
+ visualsElement = replayParentElement;
20700
20694
  } else {
20701
- container.appendChild(visualsElement);
20695
+ visualsElement = (0, _hyperscript.default)("div.".concat(options.selectors.visualsClass));
20696
+ }
20697
+ if (!playerOnly) {
20698
+ var buttonsElement = container.querySelector(".".concat(options.selectors.buttonsClass));
20699
+
20700
+ /*
20701
+ * Make sure it's placed before the buttons, but only if it's a child
20702
+ * element of the container = inside the container
20703
+ */
20704
+ if (buttonsElement && !container.isOutsideElementOf(buttonsElement)) {
20705
+ container.insertBefore(visualsElement, buttonsElement);
20706
+ } else {
20707
+ container.appendChild(visualsElement);
20708
+ }
20702
20709
  }
20703
20710
  }
20704
20711
 
@@ -20741,6 +20748,7 @@ var Visuals = function Visuals(container, options) {
20741
20748
  cb = params;
20742
20749
  params = {};
20743
20750
  }
20751
+ debug("Visuals: back(".concat(params ? (0, _safeJsonStringify.default)(params) : "", ")"));
20744
20752
  replay.hide();
20745
20753
  notifier.hide();
20746
20754
  if (params && params.keepHidden) {
@@ -20773,6 +20781,12 @@ var Visuals = function Visuals(container, options) {
20773
20781
  recorder.unload(e);
20774
20782
  recorderInsides.unload(e);
20775
20783
  replay.unload();
20784
+ if (e instanceof Error) {
20785
+ // Don't hide when e is an error so that the error can be still
20786
+ // displayed under visuals > notifier
20787
+ } else {
20788
+ this.hide();
20789
+ }
20776
20790
  built = false;
20777
20791
  } catch (exc) {
20778
20792
  this.emit(_events.default.ERROR, exc);
@@ -20859,15 +20873,17 @@ var Visuals = function Visuals(container, options) {
20859
20873
  }
20860
20874
  };
20861
20875
  this.showVisuals = function () {
20862
- visualsElement && (0, _hidden.default)(visualsElement, false);
20876
+ (0, _hidden.default)(visualsElement, false);
20863
20877
  };
20864
20878
  this.show = function () {
20865
- !this.isReplayShown() && visualsElement && recorder.build();
20879
+ var playerOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
20880
+ if (!playerOnly && !this.isReplayShown()) {
20881
+ recorder.build();
20882
+ }
20866
20883
  this.showVisuals();
20867
20884
  };
20868
20885
  this.showReplayOnly = function () {
20869
- replay.show();
20870
- this.show();
20886
+ this.show(true);
20871
20887
  recorder.hide();
20872
20888
  notifier.hide();
20873
20889
  };
@@ -21388,7 +21404,7 @@ var Notifier = function Notifier(visuals, options) {
21388
21404
  var self = this;
21389
21405
  var debug = options && options.debug;
21390
21406
  var notifyElement;
21391
- var messageElement;
21407
+ var messageElement = document.getElementById(NOTIFIER_MESSAGE_ID);
21392
21408
  var explanationElement;
21393
21409
  var entertainTimeoutId;
21394
21410
  var entertaining;
@@ -21508,14 +21524,28 @@ var Notifier = function Notifier(visuals, options) {
21508
21524
  removeDimensions: err.removeDimensions && err.removeDimensions()
21509
21525
  });
21510
21526
  };
21527
+
21528
+ // Special treatment to deal with race conditions
21529
+ function getMessageElement() {
21530
+ if (messageElement) {
21531
+ return messageElement;
21532
+ }
21533
+ messageElement = document.getElementById(NOTIFIER_MESSAGE_ID);
21534
+ return messageElement;
21535
+ }
21511
21536
  function setMessage(message, messageOptions) {
21512
21537
  options.debug("Notifier: setMessage(".concat(message, ")"));
21513
- if (!messageElement && notifyElement) {
21538
+ if (!getMessageElement()) {
21514
21539
  messageElement = (0, _hyperscript.default)("h2", {
21515
21540
  id: NOTIFIER_MESSAGE_ID
21516
21541
  });
21517
21542
  if (notifyElement) {
21518
- notifyElement.appendChild(messageElement);
21543
+ if (explanationElement) {
21544
+ // For rare cases, shouldn't happen to set an explanation without a message
21545
+ notifyElement.insertBefore(messageElement, explanationElement);
21546
+ } else {
21547
+ notifyElement.appendChild(messageElement);
21548
+ }
21519
21549
  } else {
21520
21550
  options.logger.warn("Unable to show message ".concat(message, " because notifyElement is empty"));
21521
21551
  }
@@ -21558,7 +21588,7 @@ var Notifier = function Notifier(visuals, options) {
21558
21588
  built = true;
21559
21589
  };
21560
21590
  function hideMessage() {
21561
- if (messageElement) {
21591
+ if (getMessageElement()) {
21562
21592
  (0, _hidden.default)(messageElement, true);
21563
21593
  }
21564
21594
  }
@@ -21596,10 +21626,6 @@ var Notifier = function Notifier(visuals, options) {
21596
21626
  var classList = notifyOptions.classList ? notifyOptions.classList : false;
21597
21627
  var removeDimensions = notifyOptions.removeDimensions ? notifyOptions.removeDimensions : false;
21598
21628
  if (notifyElement) {
21599
- if (messageElement && explanationElement) {
21600
- notifyElement.insertBefore(messageElement, explanationElement);
21601
- }
21602
-
21603
21629
  // reset
21604
21630
  if (!entertain) {
21605
21631
  notifyElement.className = "notifier";