apm-react-audio-player
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -170,12 +170,14 @@ 'use strict'; | ||
}; | ||
var timeTravel = function timeTravel(newTime) { | ||
progressBarRef.current.value = newTime; | ||
var changeRange = function changeRange() { | ||
audioRef.current.currentTime = progressBarRef.current.value; | ||
updateCurrentTime(); | ||
changePlayerCurrentTime(); | ||
}; | ||
var backThirty = function backThirty() { | ||
timeTravel(Number(progressBarRef.current.value) - 30); | ||
var rewindControl = function rewindControl() { | ||
progressBarRef.current.value = Number(progressBarRef.current.value) - 15; | ||
changeRange(); | ||
}; | ||
var forwardThirty = function forwardThirty() { | ||
timeTravel(Number(progressBarRef.current.value) + 30); | ||
var forwardControl = function forwardControl() { | ||
progressBarRef.current.value = Number(progressBarRef.current.value) + 15; | ||
changeRange(); | ||
}; | ||
@@ -209,4 +211,4 @@ var volumeControl = function volumeControl(e) { | ||
changePlayerCurrentTime: changePlayerCurrentTime, | ||
backThirty: backThirty, | ||
forwardThirty: forwardThirty, | ||
rewindControl: rewindControl, | ||
forwardControl: forwardControl, | ||
play: play, | ||
@@ -219,5 +221,5 @@ pause: pause, | ||
volumeCtrl: volumeCtrl, | ||
isMuted: isMuted, | ||
volumeControl: volumeControl, | ||
toggleMute: toggleMute, | ||
isMuted: isMuted, | ||
formatCalculateTime: formatCalculateTime | ||
@@ -291,3 +293,5 @@ }; | ||
isMuted = props.isMuted, | ||
formatCalculateTime = props.formatCalculateTime; | ||
formatCalculateTime = props.formatCalculateTime, | ||
rewindControl = props.rewindControl, | ||
forwardControl = props.forwardControl; | ||
var audioDuration = duration && !isNaN(duration) && calculateTime(duration); | ||
@@ -342,3 +346,10 @@ var formatDuration = duration && !isNaN(duration) && audioDuration && formatCalculateTime(audioDuration); | ||
className: "player-controls" | ||
}, /*#__PURE__*/React__default.createElement("div", { | ||
}, !isLive && /*#__PURE__*/React__default.createElement("div", { | ||
className: "player-backward-forward-controls" | ||
}, /*#__PURE__*/React__default.createElement("button", { | ||
onClick: rewindControl | ||
}, /*#__PURE__*/React__default.createElement("img", { | ||
src: "/img/icon-rewind-15.svg", | ||
alt: "Backward 15 seconds" | ||
}))), /*#__PURE__*/React__default.createElement("div", { | ||
className: "".concat(isPlaying ? 'is-playing' : '', " player-btn-play-pause-outer") | ||
@@ -349,3 +360,10 @@ }, /*#__PURE__*/React__default.createElement("button", { | ||
style: customStyles && customStyles.playPause | ||
}, isPlaying ? /*#__PURE__*/React__default.createElement(Pause, null) : /*#__PURE__*/React__default.createElement(Play, null)))), !isLive && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", { | ||
}, isPlaying ? /*#__PURE__*/React__default.createElement(Pause, null) : /*#__PURE__*/React__default.createElement(Play, null))), !isLive && /*#__PURE__*/React__default.createElement("div", { | ||
className: "player-backward-forward-controls" | ||
}, /*#__PURE__*/React__default.createElement("button", { | ||
onClick: forwardControl | ||
}, /*#__PURE__*/React__default.createElement("img", { | ||
src: "/img/icon-forward-15.svg", | ||
alt: "Forward 15 seconds" | ||
})))), !isLive && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", { | ||
className: "player-timeline" | ||
@@ -401,6 +419,12 @@ }, /*#__PURE__*/React__default.createElement("input", { | ||
isMuted = _useAudioPlayer.isMuted, | ||
formatCalculateTime = _useAudioPlayer.formatCalculateTime; | ||
formatCalculateTime = _useAudioPlayer.formatCalculateTime, | ||
rewindControl = _useAudioPlayer.rewindControl, | ||
forwardControl = _useAudioPlayer.forwardControl; | ||
return /*#__PURE__*/React__default.createElement(ReactAudioPlayerInner, _extends({}, props, { | ||
audioPlayerRef: audioPlayerRef, | ||
progressBarRef: progressBarRef, | ||
isPlaying: isPlaying, | ||
isMuted: isMuted, | ||
currentTime: currentTime, | ||
duration: duration, | ||
customStyles: customStyles, | ||
@@ -411,9 +435,7 @@ onLoadedMetadata: onLoadedMetadata, | ||
changePlayerCurrentTime: changePlayerCurrentTime, | ||
isPlaying: isPlaying, | ||
currentTime: currentTime, | ||
duration: duration, | ||
volumeControl: volumeControl, | ||
toggleMute: toggleMute, | ||
isMuted: isMuted, | ||
formatCalculateTime: formatCalculateTime | ||
formatCalculateTime: formatCalculateTime, | ||
rewindControl: rewindControl, | ||
forwardControl: forwardControl | ||
})); | ||
@@ -420,0 +442,0 @@ }; |
{ | ||
"name": "apm-react-audio-player", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"author": "Jason Phan <jphan@mpr.org>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
21634
422