videomail-client 9.5.1 → 9.5.4

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.1",
3
+ "version": "9.5.4",
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.1",
16910
+ "version": "9.5.4",
16911
16911
  "description": "A wicked npm package to record videos directly in the browser, wohooo!",
16912
16912
  "keywords": [
16913
16913
  "webcam",
@@ -17118,7 +17118,7 @@ var VideomailClient = function VideomailClient(options) {
17118
17118
  container.showReplayOnly();
17119
17119
  });
17120
17120
  var replay = container.getReplay();
17121
- replay.setVideomail(videomail);
17121
+ replay.setVideomail(videomail, true);
17122
17122
  };
17123
17123
  this.startOver = function (params) {
17124
17124
  var replay = container.getReplay();
@@ -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,6 +21404,7 @@ var Notifier = function Notifier(visuals, options) {
21388
21404
  var self = this;
21389
21405
  var debug = options && options.debug;
21390
21406
  var notifyElement;
21407
+ var messageElement;
21391
21408
  var explanationElement;
21392
21409
  var entertainTimeoutId;
21393
21410
  var entertaining;
@@ -21421,7 +21438,7 @@ var Notifier = function Notifier(visuals, options) {
21421
21438
  } else {
21422
21439
  overallProgress = frameProgress;
21423
21440
  }
21424
- self.setExplanation(overallProgress);
21441
+ setExplanation(overallProgress);
21425
21442
  }
21426
21443
  function onBeginVideoEncoding() {
21427
21444
  visuals.beginWaiting();
@@ -21493,21 +21510,6 @@ var Notifier = function Notifier(visuals, options) {
21493
21510
  entertainTimeoutId = null;
21494
21511
  entertaining = false;
21495
21512
  }
21496
- function setMessage(message, messageOptions) {
21497
- var notifierMessage = getNotifierMessage();
21498
- if (notifierMessage) {
21499
- options.debug("Notifier: setMessage(".concat(message, ")"));
21500
- if (message.length > 0) {
21501
- var problem = messageOptions.problem ? messageOptions.problem : false;
21502
- notifierMessage.innerHTML = (problem ? "☹ " : "") + message;
21503
- } else {
21504
- options.logger.warn("Not going to update notifierMessage element because message is empty", message);
21505
- }
21506
- (0, _hidden.default)(notifierMessage, false);
21507
- } else {
21508
- // Must be unloaded, do nothing further
21509
- }
21510
- }
21511
21513
  this.error = function (err) {
21512
21514
  var message = err.message ? err.message.toString() : err.toString();
21513
21515
  var explanation = err.explanation ? err.explanation.toString() : null;
@@ -21522,7 +21524,33 @@ var Notifier = function Notifier(visuals, options) {
21522
21524
  removeDimensions: err.removeDimensions && err.removeDimensions()
21523
21525
  });
21524
21526
  };
21525
- this.setExplanation = function (explanation) {
21527
+ function setMessage(message, messageOptions) {
21528
+ options.debug("Notifier: setMessage(".concat(message, ")"));
21529
+ if (!messageElement) {
21530
+ messageElement = (0, _hyperscript.default)("h2", {
21531
+ id: NOTIFIER_MESSAGE_ID
21532
+ });
21533
+ if (notifyElement) {
21534
+ if (messageElement && explanationElement) {
21535
+ // For rare cases, shouldn't happen to set an explanation without a message
21536
+ notifyElement.insertBefore(messageElement, explanationElement);
21537
+ } else {
21538
+ notifyElement.appendChild(messageElement);
21539
+ }
21540
+ } else {
21541
+ options.logger.warn("Unable to show message ".concat(message, " because notifyElement is empty"));
21542
+ }
21543
+ }
21544
+ if (message.length > 0) {
21545
+ var problem = messageOptions.problem ? messageOptions.problem : false;
21546
+ messageElement.innerHTML = (problem ? "☹ " : "") + message;
21547
+ } else {
21548
+ options.logger.warn("Not going to update notifierMessage element because message is empty");
21549
+ }
21550
+ (0, _hidden.default)(messageElement, false);
21551
+ }
21552
+ function setExplanation(explanation) {
21553
+ options.debug("Notifier: setExplanation(".concat(explanation, ")"));
21526
21554
  if (!explanationElement) {
21527
21555
  explanationElement = (0, _hyperscript.default)("p", {
21528
21556
  className: "explanation"
@@ -21535,7 +21563,7 @@ var Notifier = function Notifier(visuals, options) {
21535
21563
  }
21536
21564
  explanationElement.innerHTML = explanation;
21537
21565
  (0, _hidden.default)(explanationElement, false);
21538
- };
21566
+ }
21539
21567
  this.build = function () {
21540
21568
  options.debug("Notifier: build()");
21541
21569
  notifyElement = visuals.querySelector(".notifier");
@@ -21551,9 +21579,8 @@ var Notifier = function Notifier(visuals, options) {
21551
21579
  built = true;
21552
21580
  };
21553
21581
  function hideMessage() {
21554
- var notifierMessage = getNotifierMessage();
21555
- if (notifierMessage) {
21556
- (0, _hidden.default)(notifierMessage, true);
21582
+ if (messageElement) {
21583
+ (0, _hidden.default)(messageElement, true);
21557
21584
  }
21558
21585
  }
21559
21586
  function hideExplanation() {
@@ -21579,9 +21606,6 @@ var Notifier = function Notifier(visuals, options) {
21579
21606
  this.isBuilt = function () {
21580
21607
  return built;
21581
21608
  };
21582
- function getNotifierMessage() {
21583
- return document.getElementById(NOTIFIER_MESSAGE_ID);
21584
- }
21585
21609
  this.notify = function (message, explanation) {
21586
21610
  var notifyOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
21587
21611
  var params = [message, explanation].filter(Boolean);
@@ -21592,17 +21616,6 @@ var Notifier = function Notifier(visuals, options) {
21592
21616
  var hideForm = notifyOptions.hideForm ? notifyOptions.hideForm : false;
21593
21617
  var classList = notifyOptions.classList ? notifyOptions.classList : false;
21594
21618
  var removeDimensions = notifyOptions.removeDimensions ? notifyOptions.removeDimensions : false;
21595
- var notifierMessage = getNotifierMessage();
21596
- if (!notifierMessage && notifyElement) {
21597
- var messageElement = (0, _hyperscript.default)("h2", {
21598
- id: NOTIFIER_MESSAGE_ID
21599
- });
21600
- notifyElement.appendChild(messageElement);
21601
- }
21602
- notifierMessage = getNotifierMessage();
21603
- if (notifyElement && notifierMessage && explanationElement) {
21604
- notifyElement.insertBefore(notifierMessage, explanationElement);
21605
- }
21606
21619
  if (notifyElement) {
21607
21620
  // reset
21608
21621
  if (!entertain) {
@@ -21630,7 +21643,7 @@ var Notifier = function Notifier(visuals, options) {
21630
21643
  visuals.hideRecorder();
21631
21644
  setMessage(message, notifyOptions);
21632
21645
  if (explanation && explanation.length > 0) {
21633
- this.setExplanation(explanation);
21646
+ setExplanation(explanation);
21634
21647
  }
21635
21648
  if (entertain) {
21636
21649
  runEntertainment();
@@ -22352,8 +22365,8 @@ var Recorder = function Recorder(visuals, replay) {
22352
22365
  };
22353
22366
  this.back = function (cb) {
22354
22367
  this.emit(_events.default.GOING_BACK);
22368
+ unloaded = false;
22355
22369
  show();
22356
- this.reset();
22357
22370
  writeCommand("back", cb);
22358
22371
  };
22359
22372
  function reInitializeAudio() {
@@ -22839,7 +22852,6 @@ var Replay = function Replay(parentElement, options) {
22839
22852
  var videomail;
22840
22853
  function buildElement() {
22841
22854
  var replayParentElement = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : parentElement;
22842
- replayElement = (0, _hyperscript.default)("video.".concat(options.selectors.replayClass));
22843
22855
  if (typeof replayParentElement === "string") {
22844
22856
  replayParentElement = document.getElementById(replayParentElement);
22845
22857
  if (!replayParentElement) {