diff --git a/src/Components/AudioPlayer.js b/src/Components/AudioPlayer.js
index d707eea..54da4ba 100644
--- a/src/Components/AudioPlayer.js
+++ b/src/Components/AudioPlayer.js
@@ -1,4 +1,4 @@
-import React, {Component} from 'react';
+import React, {Component, useState} from 'react';
import VolumeSlider from './VolumeSlider';
import AudioPlayerButtons from './AudioPlayerButtons';
@@ -7,13 +7,16 @@ class AudioPlayer extends Component {
super(props);
this.state = {
volumeBeforeMute:.50,
- speakerEntity:"🔊"
+ speakerEntity:"🔊",
+
}
this.pause = this.pause.bind(this);
this.play = this.play.bind(this);
this.mute = this.mute.bind(this);
this.changeVolume = this.changeVolume.bind(this);
this.volumeRef = React.createRef();
+
+
}
componentDidMount(){
@@ -36,32 +39,35 @@ class AudioPlayer extends Component {
}
mute(){
- if(this.refs.audio.volume === 0)
+
+ if(this.refs.audio.volume === 0 )
{
// To unmute the player
- this.refs.audio.volume=this.volumeRef.current.value/100;
- this.setState((state)=>({
+ this.refs.audio.volume = this.volumeRef.current.value/100;
+ this.setState((state) => ({
speakerEntity:'🔊'
}));
} else {
// To mute the player
- this.setState((state)=>({
+ this.setState((state) =>({
speakerEntity:'🔇',
}));
- this.refs.audio.volume=0;
+ this.refs.audio.volume = 0;
}
}
+
+
changeVolume() {
this.refs.audio.volume = this.volumeRef.current.value/100;
- if(this.refs.audio.volume>0) {
- this.setState((state)=>({
- speakerEntity:'🔊',
+ if(this.refs.audio.volume > 0) {
+ this.setState((state) => ({
+ speakerEntity: '🔊',
}));
} else {
- this.setState((state)=>({
- speakerEntity:'🔇',
+ this.setState((state) => ({
+ speakerEntity: '🔇',
}));
}
}
@@ -74,7 +80,7 @@ class AudioPlayer extends Component {