Update audio player

This commit is contained in:
Prayag Prajapati committed 2023-10-05 21:31:46 +05:30
1 parent 686d1597af
commit e0c77fb7c6
2 files changed
+10 -8

No files matched your search

@@ -19,6 +19,11 @@
#waveform { #waveform {
width: 100%; width: 100%;
transform: scaleY(0);
transition: transform $transition-time-default;
&[data-show="true"] {
transform: scaleY(1) !important;
}
} }
&-controls { &-controls {
display: flex; display: flex;
@@ -1,5 +1,5 @@
/** @format */ /** @format */
import { useEffect, useRef, useState } from "react"; import React, { useEffect, useRef, useState } from "react";
import { motion } from "framer-motion"; import { motion } from "framer-motion";
@@ -96,13 +96,13 @@ const AudioPlayer = () => {
if (display) { if (display) {
const waveSurfer = WaveSurfer.create({ const waveSurfer = WaveSurfer.create({
container: waveSurferContainerRef.current, container: waveSurferContainerRef.current,
barHeight: 0.8,
dragToSeek: true, dragToSeek: true,
height: 35, height: 35,
cursorColor: "#fb2376", cursorColor: "#fb2376",
progressColor: "#fb2376", progressColor: "#fb2376",
waveColor: "#ffffff2f", waveColor: "#ffffff2f",
normalize: true, normalize: true,
barHeight: 0.6,
}); });
waveSurfer.load(url); waveSurfer.load(url);
waveSurfer.on("load", () => { waveSurfer.on("load", () => {
@@ -196,7 +196,7 @@ const AudioPlayer = () => {
}; };
return ( return (
<AnimatePresence> <AnimatePresence mode="sync">
{display && ( {display && (
<motion.div <motion.div
key={display} key={display}
@@ -213,7 +213,7 @@ const AudioPlayer = () => {
)} - 10px)`, )} - 10px)`,
}} }}
transition={{ transition={{
duration: 0.1, duration: 0.2,
ease: "easeInOut", ease: "easeInOut",
}} }}
className="audio-player" className="audio-player"
@@ -343,11 +343,8 @@ const AudioPlayer = () => {
</Typography> </Typography>
<div <div
id="waveform" id="waveform"
style={{
opacity: showWaveform ? 1 : 0,
transition: "opacity 250ms",
}}
ref={waveSurferContainerRef} ref={waveSurferContainerRef}
data-show={Boolean(showWaveform)}
></div> ></div>
<Typography <Typography
variant="subtitle2" variant="subtitle2"