apm-react-audio-player 1.0.25 → 1.0.27

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -61,11 +61,12 @@ function _unsupportedIterableToArray(r, a) {
61
61
  }
62
62
 
63
63
  var useAudioPlayer = function useAudioPlayer(audioRef, progressBarRef, volumeCtrl) {
64
+ var initialDuration = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
64
65
  var _useState = React.useState(false),
65
66
  _useState2 = _slicedToArray(_useState, 2),
66
67
  isPlaying = _useState2[0],
67
68
  setIsPlaying = _useState2[1];
68
- var _useState3 = React.useState(0),
69
+ var _useState3 = React.useState(initialDuration),
69
70
  _useState4 = _slicedToArray(_useState3, 2),
70
71
  duration = _useState4[0],
71
72
  setDuration = _useState4[1];
@@ -356,9 +357,11 @@ var ReactAudioPlayerInner = function ReactAudioPlayerInner(props) {
356
357
  }, /*#__PURE__*/React.createElement("img", {
357
358
  src: "/img/icon-forward-15.svg",
358
359
  alt: "Forward 15 seconds"
359
- })))), !isLive && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
360
+ })))), !isLive && /*#__PURE__*/React.createElement("div", {
360
361
  className: "player-timeline"
361
362
  }, /*#__PURE__*/React.createElement("div", {
363
+ className: "player-currentTime"
364
+ }, calculateTime(currentTime)), /*#__PURE__*/React.createElement("div", {
362
365
  className: "player-timeline-progress-outer"
363
366
  }, /*#__PURE__*/React.createElement("input", {
364
367
  type: "range",
@@ -369,13 +372,9 @@ var ReactAudioPlayerInner = function ReactAudioPlayerInner(props) {
369
372
  "aria-label": "Audio progress",
370
373
  max: duration
371
374
  })), /*#__PURE__*/React.createElement("div", {
372
- className: "player-times"
373
- }, /*#__PURE__*/React.createElement("div", {
374
- className: "player-currentTime"
375
- }, calculateTime(currentTime)), /*#__PURE__*/React.createElement("div", {
376
375
  className: "player-duration",
377
376
  style: customStyles && customStyles.duration
378
- }, duration && !isNaN(duration) && calculateTime(duration))))), /*#__PURE__*/React.createElement("div", {
377
+ }, duration && !isNaN(duration) ? calculateTime(duration) : '-- : --')), /*#__PURE__*/React.createElement("div", {
379
378
  className: "player-content"
380
379
  }, customHtml && customHtml, /*#__PURE__*/React.createElement("div", {
381
380
  className: "player-audio-type type-sm"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apm-react-audio-player",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "author": "Jason Phan <jphan@mpr.org>",
5
5
  "license": "MIT",
6
6
  "private": false,