mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-14 09:48:10 -05:00
volume slider
This commit is contained in:
@@ -49,6 +49,23 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
.volume-icon {
|
||||||
|
padding: 0px 15px 0px 15px;
|
||||||
|
}
|
||||||
|
.volume-slider {
|
||||||
|
padding: 0px 0px 0px 0px;
|
||||||
|
}
|
||||||
|
.icon-button-item {
|
||||||
|
cursor:pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
padding: 5px;
|
||||||
|
width: 50px;
|
||||||
|
color: white;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
.button-item {
|
.button-item {
|
||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {
|
|||||||
Label,
|
Label,
|
||||||
Grid,
|
Grid,
|
||||||
GridRow,
|
GridRow,
|
||||||
|
Header,
|
||||||
|
Popup,
|
||||||
GridColumn,
|
GridColumn,
|
||||||
LabelGroup,
|
LabelGroup,
|
||||||
Button
|
Button
|
||||||
@@ -24,6 +26,7 @@ import "./MediaPlayer.css";
|
|||||||
const MediaPlayer = (props) => {
|
const MediaPlayer = (props) => {
|
||||||
const audioRef = React.createRef();
|
const audioRef = React.createRef();
|
||||||
const call = props.call;
|
const call = props.call;
|
||||||
|
const [volume, setVolume] = useState(1);
|
||||||
const [sourceIndex, setSourceIndex] = useState(0);
|
const [sourceIndex, setSourceIndex] = useState(0);
|
||||||
const [wavesurfer, setWavesurfer] = useState(null)
|
const [wavesurfer, setWavesurfer] = useState(null)
|
||||||
const [isPlaying, setIsPlaying] = useState(false)
|
const [isPlaying, setIsPlaying] = useState(false)
|
||||||
@@ -71,6 +74,12 @@ const MediaPlayer = (props) => {
|
|||||||
setSourceIndex(0);
|
setSourceIndex(0);
|
||||||
}, [call]);
|
}, [call]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (wavesurfer) {
|
||||||
|
wavesurfer.setVolume(volume);
|
||||||
|
}
|
||||||
|
}, [volume, wavesurfer]);
|
||||||
|
|
||||||
|
|
||||||
const onReady = (ws) => {
|
const onReady = (ws) => {
|
||||||
setWavesurfer(ws)
|
setWavesurfer(ws)
|
||||||
@@ -140,21 +149,38 @@ const MediaPlayer = (props) => {
|
|||||||
|
|
||||||
<div className="mediaplayer-container">
|
<div className="mediaplayer-container">
|
||||||
|
|
||||||
|
<div className="icon-button-item desktop-only" >
|
||||||
|
<Popup trigger={<Icon name='volume off' />} hoverable position='top center'>
|
||||||
<div className="button-item" onClick={onPlayPause}>
|
<Icon name='volume down' className="volume-icon" />
|
||||||
{
|
<input
|
||||||
isPlaying
|
className="volume-slider"
|
||||||
? (<Icon name="pause" />)
|
type="range"
|
||||||
: (<Icon name="play" />)
|
min={0}
|
||||||
}
|
max={1}
|
||||||
|
step={0.02}
|
||||||
|
value={volume}
|
||||||
|
onChange={event => {
|
||||||
|
setVolume(event.target.valueAsNumber)
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<Icon name='volume up' className="volume-icon" />
|
||||||
|
</Popup>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="icon-button-item" onClick={onPlayPause}>
|
||||||
|
{
|
||||||
|
isPlaying
|
||||||
|
? (<Icon name="pause" />)
|
||||||
|
: (<Icon name="play" />)
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="mediaplayer-item">
|
<div className="mediaplayer-item">
|
||||||
|
|
||||||
<WavesurferPlayer
|
<WavesurferPlayer
|
||||||
autoplay={true}
|
autoplay={true}
|
||||||
height={25}
|
height={25}
|
||||||
barWidth ={3}
|
barWidth={3}
|
||||||
barGap={3}
|
barGap={3}
|
||||||
barRadius={6}
|
barRadius={6}
|
||||||
waveColor="#E81B39"
|
waveColor="#E81B39"
|
||||||
|
|||||||
Reference in New Issue
Block a user