apm-react-audio-player
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -96,5 +96,6 @@ 'use strict'; | ||
setIsMuted = _useState10[1]; | ||
var isStream = audioRef.current && audioRef.current.currentSrc.includes('stream'); | ||
React.useEffect(function () { | ||
if (currentTime === Number(duration)) { | ||
restart(); | ||
// restart() | ||
setIsFinishedPlaying(true); | ||
@@ -106,3 +107,3 @@ } | ||
setDuration(seconds); | ||
if (!audioRef.current.currentSrc.includes('stream')) { | ||
if (!isStream) { | ||
progressBarRef.current.max = seconds; | ||
@@ -115,3 +116,5 @@ } | ||
var whilePlaying = function whilePlaying() { | ||
progressBarRef.current.value = Math.floor(audioRef.current.currentTime); | ||
if (!isStream) { | ||
progressBarRef.current.value = Math.floor(audioRef.current.currentTime); | ||
} | ||
progressBarRef.current.style.setProperty('--seek-before-width', "".concat(progressBarRef.current.value / duration * 100, "%")); | ||
@@ -121,4 +124,4 @@ updateCurrentTime(); | ||
// when you reach the end of the song | ||
if (progressBarRef.current.value === duration) { | ||
restart(); | ||
if (!isStream && progressBarRef.current.value === duration) { | ||
// restart() | ||
setIsFinishedPlaying(true); | ||
@@ -134,7 +137,9 @@ return; | ||
}; | ||
var restart = function restart() { | ||
progressBarRef.current.value = 0; | ||
updateCurrentTime(); | ||
pause(); | ||
}; | ||
// const restart = () => { | ||
// progressBarRef.current.value = 0 | ||
// updateCurrentTime() | ||
// pause() | ||
// } | ||
var play = function play() { | ||
@@ -144,3 +149,5 @@ setIsPlaying(true); | ||
audioRef.current.play(); | ||
animationRef.current = window.requestAnimationFrame(whilePlaying); | ||
if (!isStream) { | ||
animationRef.current = window.requestAnimationFrame(whilePlaying); | ||
} | ||
}; | ||
@@ -147,0 +154,0 @@ var toggleMute = function toggleMute() { |
{ | ||
"name": "apm-react-audio-player", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"author": "Jason Phan <jphan@mpr.org>", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
18628
359
0