diff --git a/jam-ui/src/components/jamtracks/JKAudioPlayer.js b/jam-ui/src/components/jamtracks/JKAudioPlayer.js index 58910827c..32387085d 100644 --- a/jam-ui/src/components/jamtracks/JKAudioPlayer.js +++ b/jam-ui/src/components/jamtracks/JKAudioPlayer.js @@ -60,7 +60,7 @@ const JKAudioPlayer = ({ audioUrl }) => { } const togglePlayPause = (e) => { - if (!audio) return; + if (!audio || e === "undefined") return; if (audio.paused) { audio.play(); setIsPlaying(true); @@ -70,14 +70,8 @@ const JKAudioPlayer = ({ audioUrl }) => { } } - const onVolumeButtonClick = () => { - if (!audio) return; - audio.muted = !audio.muted; - setIsMuted(audio.muted); - } - const onClickTimeline = (e) => { - if (!audio) return; + if (!audio || e === "undefined") return; let timeToSeek = 0; try { let timelineWidth = window.getComputedStyle(audioPlayer.current.querySelector(".timeline")).width; @@ -94,7 +88,7 @@ const JKAudioPlayer = ({ audioUrl }) => { } const onVolumeSliderClick = (e) => { - if (!audio) return; + if (!audio || e === "undefined") return; let volume = .75; try { let sliderWidth = window.getComputedStyle(audioPlayer.current.querySelector(".controls .volume-slider")).width; @@ -110,7 +104,13 @@ const JKAudioPlayer = ({ audioUrl }) => { audioPlayer.current.querySelector(".controls .volume-percentage").style.width = volume * 100 + '%'; } - function getTimeCodeFromNum(num) { + const onVolumeButtonClick = () => { + if (!audio) return; + audio.muted = !audio.muted; + setIsMuted(audio.muted); + } + + const getTimeCodeFromNum = (num) => { let seconds = parseInt(num); let minutes = parseInt(seconds / 60); seconds -= minutes * 60;