apm-react-audio-player 1.0.21 → 1.0.23

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 (3) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +13 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -76,7 +76,7 @@ Prop | Type | Default | Notes
76
76
  `isPlaying` | Boolean | false | Whether the audio is currently playing
77
77
  `isMuted` | Boolean | false | Whether the audio is currently muted
78
78
  `toggleMute` | Function | --- | A function to toggle the mute state
79
- `volumeControl` | Function | --- | A function to control the volume
79
+ `volumeCtrl` | Function | --- | A function to control the volume
80
80
  `currentTime` | Number | null | The current time of the audio track
81
81
  `duration` | Number | null | The duration of the audio track
82
82
  `rewindControl` | Function | --- | A function to rewind the audio track
package/dist/index.js CHANGED
@@ -294,7 +294,9 @@ var ReactAudioPlayerInner = function ReactAudioPlayerInner(props) {
294
294
  isMuted = props.isMuted,
295
295
  formatCalculateTime = props.formatCalculateTime,
296
296
  rewindControl = props.rewindControl,
297
- forwardControl = props.forwardControl;
297
+ forwardControl = props.forwardControl,
298
+ subtitle = props.subtitle,
299
+ prefix = props.prefix;
298
300
  var audioDuration = duration && !isNaN(duration) && calculateTime(duration);
299
301
  var formatDuration = duration && !isNaN(duration) && audioDuration && formatCalculateTime(audioDuration);
300
302
  return audioSrc && /*#__PURE__*/React__default.createElement("div", {
@@ -303,7 +305,7 @@ var ReactAudioPlayerInner = function ReactAudioPlayerInner(props) {
303
305
  }, /*#__PURE__*/React__default.createElement("audio", {
304
306
  ref: audioPlayerRef,
305
307
  src: audioSrc,
306
- preload: "metadata",
308
+ preload: "none",
307
309
  onLoadedMetadata: onLoadedMetadata,
308
310
  muted: isMuted
309
311
  }), /*#__PURE__*/React__default.createElement("div", {
@@ -356,7 +358,8 @@ var ReactAudioPlayerInner = function ReactAudioPlayerInner(props) {
356
358
  }, /*#__PURE__*/React__default.createElement("button", {
357
359
  onClick: togglePlaying,
358
360
  className: playBtnClass,
359
- style: customStyles && customStyles.playPause
361
+ style: customStyles && customStyles.playPause,
362
+ id: "playbutton"
360
363
  }, isPlaying ? /*#__PURE__*/React__default.createElement(Pause, null) : /*#__PURE__*/React__default.createElement(Play, null))), !isLive && /*#__PURE__*/React__default.createElement("div", {
361
364
  className: "player-backward-forward-controls"
362
365
  }, /*#__PURE__*/React__default.createElement("button", {
@@ -385,17 +388,17 @@ var ReactAudioPlayerInner = function ReactAudioPlayerInner(props) {
385
388
  style: customStyles && customStyles.duration
386
389
  }, duration && !isNaN(duration) && calculateTime(duration))))), /*#__PURE__*/React__default.createElement("div", {
387
390
  className: "player-content"
388
- }, customHtml && customHtml, /*#__PURE__*/React__default.createElement("div", {
391
+ }, customHtml && customHtml, console.log('🟢: REACT-AUDIO-PLAYER'), console.log('prefix', prefix), /*#__PURE__*/React__default.createElement("div", {
389
392
  className: "player-audio-type type-sm"
390
393
  }, isLive ? /*#__PURE__*/React__default.createElement("div", {
391
394
  className: "player-live-label"
392
- }, "On Air") : /*#__PURE__*/React__default.createElement("div", {
395
+ }, prefix ? prefix : 'On Air') : /*#__PURE__*/React__default.createElement("div", {
393
396
  className: "player-label"
394
397
  }, "listen", /*#__PURE__*/React__default.createElement("div", {
395
398
  className: "player-label-duration"
396
399
  }, "[".concat(formatDuration, "]"))), /*#__PURE__*/React__default.createElement("div", {
397
400
  className: "player-title"
398
- }, title || '', " ")))));
401
+ }, title || '', " ", subtitle && "by ".concat(subtitle), ' ')))));
399
402
  };
400
403
 
401
404
  var ReactAudioPlayer = function ReactAudioPlayer(props) {
@@ -408,16 +411,16 @@ var ReactAudioPlayer = function ReactAudioPlayer(props) {
408
411
 
409
412
  // hooks
410
413
  var _useAudioPlayer = useAudioPlayer(audioPlayerRef, progressBarRef),
414
+ isPlaying = _useAudioPlayer.isPlaying,
415
+ currentTime = _useAudioPlayer.currentTime,
416
+ duration = _useAudioPlayer.duration,
417
+ isMuted = _useAudioPlayer.isMuted,
411
418
  onLoadedMetadata = _useAudioPlayer.onLoadedMetadata,
412
419
  calculateTime = _useAudioPlayer.calculateTime,
413
420
  togglePlaying = _useAudioPlayer.togglePlaying,
414
421
  changePlayerCurrentTime = _useAudioPlayer.changePlayerCurrentTime,
415
- isPlaying = _useAudioPlayer.isPlaying,
416
- currentTime = _useAudioPlayer.currentTime,
417
- duration = _useAudioPlayer.duration,
418
422
  volumeControl = _useAudioPlayer.volumeControl,
419
423
  toggleMute = _useAudioPlayer.toggleMute,
420
- isMuted = _useAudioPlayer.isMuted,
421
424
  formatCalculateTime = _useAudioPlayer.formatCalculateTime,
422
425
  rewindControl = _useAudioPlayer.rewindControl,
423
426
  forwardControl = _useAudioPlayer.forwardControl;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apm-react-audio-player",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "author": "Jason Phan <jphan@mpr.org>",
5
5
  "license": "MIT",
6
6
  "private": false,