@bigbinary/neeto-media-recorder 1.3.12 → 1.3.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/index.js CHANGED
@@ -2,7 +2,7 @@ import { shallow } from 'zustand/shallow';
2
2
  import React, { useState, useEffect, forwardRef, useImperativeHandle } from 'react';
3
3
  import classNames from 'classnames';
4
4
  import { isNotEmpty, noop } from '@bigbinary/neeto-cist';
5
- import { SCREEN_RECORDER_STATUS, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, UPLOAD_STATUS, ONE_MINUTE_IN_MILLISECONDS, ONE_SECOND_IN_MILLISECONDS, IS_EXTENSION, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
5
+ import { SCREEN_RECORDER_STATUS, SCREEN_RECORDER_ERROR, IS_SAFARI_EXTENSION, UPLOAD_STATUS, ONE_MINUTE_IN_MILLISECONDS as ONE_MINUTE_IN_MILLISECONDS$1, ONE_SECOND_IN_MILLISECONDS as ONE_SECOND_IN_MILLISECONDS$1, IS_EXTENSION, SCREEN_RECORDER_EVENT, UPLOAD_EVENT } from '@bigbinary/neeto-media-recorder/constants';
6
6
  import { screenRecorder, multipartS3Uploader } from '@bigbinary/neeto-media-recorder/core';
7
7
  import { Typography, Spinner, Button, Callout, Alert } from '@bigbinary/neetoui';
8
8
  import { useTranslation, Trans } from 'react-i18next';
@@ -499,10 +499,14 @@ function _typeof(obj) {
499
499
  }, _typeof(obj);
500
500
  }
501
501
 
502
+ var ONE_SECOND_IN_MILLISECONDS = 1000;
503
+ var ONE_MINUTE_IN_MILLISECONDS = 60 * ONE_SECOND_IN_MILLISECONDS;
504
+ var ONE_HOUR_IN_MILLISECONDS = 60 * ONE_MINUTE_IN_MILLISECONDS;
502
505
  var HAS_CHROME_NAMESPACE = (typeof chrome === "undefined" ? "undefined" : _typeof(chrome)) === "object";
503
506
  HAS_CHROME_NAMESPACE && isNotNil(chrome.extension);
504
507
  platform.name === "Safari";
505
508
  var PERMISSIONS_HELP_DOC = "https://neetorecordhelp.neetokb.com/p/a-10efcfd7";
509
+ // 2 hours
506
510
 
507
511
  var AbortUpload = withT(function (_ref) {
508
512
  var t = _ref.t;
@@ -820,8 +824,12 @@ var formatTime = function formatTime(time) {
820
824
  return Math.floor(time).toString().padStart(2, "0");
821
825
  };
822
826
  var getTimeString = function getTimeString(date) {
823
- var minutes = formatTime(date / ONE_MINUTE_IN_MILLISECONDS);
824
- var seconds = formatTime(date % ONE_MINUTE_IN_MILLISECONDS / ONE_SECOND_IN_MILLISECONDS);
827
+ var hours = formatTime(Math.floor(date / ONE_HOUR_IN_MILLISECONDS));
828
+ var minutes = formatTime(date % ONE_HOUR_IN_MILLISECONDS / ONE_MINUTE_IN_MILLISECONDS$1);
829
+ var seconds = formatTime(date % ONE_MINUTE_IN_MILLISECONDS$1 / ONE_SECOND_IN_MILLISECONDS$1);
830
+ if (hours > 0) {
831
+ return "".concat(hours, ":").concat(minutes, ":").concat(seconds);
832
+ }
825
833
  return "".concat(minutes, ":").concat(seconds);
826
834
  };
827
835
  var downloadRecordingBlob = function downloadRecordingBlob(blob, name) {
@@ -846,6 +854,14 @@ var hasRecordingDiscarded = function hasRecordingDiscarded(_ref) {
846
854
  uploadStatus = _ref.uploadStatus;
847
855
  return recorderStatus === SCREEN_RECORDER_STATUS.stopped && uploadStatus === UPLOAD_STATUS.aborting;
848
856
  };
857
+ var getRecorderTimeLimitInHumanFormat = function getRecorderTimeLimitInHumanFormat(timeInMs) {
858
+ var minutes = Math.floor(timeInMs / (1000 * 60));
859
+ var hours = Math.floor(minutes / 60);
860
+ if (hours < 1) {
861
+ return "".concat(minutes, " minutes");
862
+ }
863
+ return "".concat(hours, " hours");
864
+ };
849
865
 
850
866
  var Timer = function Timer() {
851
867
  var _useTranslation = useTranslation(),
@@ -1175,7 +1191,9 @@ var MediaRecorder = function MediaRecorder(_ref, ref) {
1175
1191
  className: "mx-auto mb-2 w-1/2 p-3",
1176
1192
  "data-cy": "recorder-time-limit-warning-callout",
1177
1193
  style: "warning"
1178
- }, t("neetoMediaRecorder.record.timeLimitWarning")), isRecorderStatus(SCREEN_RECORDER_STATUS.media_acquired, SCREEN_RECORDER_STATUS.restarting) && /*#__PURE__*/React.createElement("div", {
1194
+ }, t("neetoMediaRecorder.record.timeLimitWarning", {
1195
+ duration: getRecorderTimeLimitInHumanFormat(screenRecorder.timeLimit)
1196
+ })), isRecorderStatus(SCREEN_RECORDER_STATUS.media_acquired, SCREEN_RECORDER_STATUS.restarting) && /*#__PURE__*/React.createElement("div", {
1179
1197
  className: " mx-auto flex flex-col items-center justify-center space-y-4",
1180
1198
  "data-cy": "recorder-countdown-wrapper"
1181
1199
  }, /*#__PURE__*/React.createElement(Typography, {