diff --git a/frontend/package.json b/frontend/package.json index 3aa6dc07..5d3602d7 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -19,6 +19,7 @@ "markdown-to-jsx": "^7.1.0", "material-ui-color": "^1.2.0", "mic-recorder-to-mp3": "^2.2.2", + "mui-audio-player": "^1.0.1", "qrcode.react": "^1.0.0", "react": "^16.13.1", "react-color": "^2.19.3", @@ -54,4 +55,4 @@ "last 1 safari version" ] } -} \ No newline at end of file +} diff --git a/frontend/src/components/Audio/index.jsx b/frontend/src/components/Audio/index.jsx index d1dac124..a46f38e6 100644 --- a/frontend/src/components/Audio/index.jsx +++ b/frontend/src/components/Audio/index.jsx @@ -1,14 +1,12 @@ -import { Button } from "@material-ui/core"; -import React, { useRef } from "react"; -import { useEffect } from "react"; -import { useState } from "react"; +import React, { useRef, useEffect, useState } from "react"; +import { AudioPlayer } from 'mui-audio-player'; const LS_NAME = 'audioMessageRate'; -export default function({url}) { +export default function ({ url }) { const audioRef = useRef(null); - const [audioRate, setAudioRate] = useState( parseFloat(localStorage.getItem(LS_NAME) || "1") ); - const [showButtonRate, setShowButtonRate] = useState(false); + const [audioRate] = useState(parseFloat(localStorage.getItem(LS_NAME) || "1")); + const [,setShowButtonRate] = useState(false); useEffect(() => { audioRef.current.playbackRate = audioRate; @@ -27,36 +25,18 @@ export default function({url}) { }; }, []); - const toogleRate = () => { - let newRate = null; - - switch(audioRate) { - case 0.5: - newRate = 1; - break; - case 1: - newRate = 1.5; - break; - case 1.5: - newRate = 2; - break; - case 2: - newRate = 0.5; - break; - default: - newRate = 1; - break; - } - - setAudioRate(newRate); - }; - return ( <> - - {showButtonRate && } + ); -} \ No newline at end of file +} \ No newline at end of file