react-waves | React component wrapper for wavesurfer.js | Frontend Framework library
kandi X-RAY | react-waves Summary
kandi X-RAY | react-waves Summary
React component wrapper for wavesurfer.js
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Load audio file .
- Seek to move .
- Assert if a number is positive .
- Load audio files .
- Capitalize the first letter of a string
- Register events on wavesur
- Convert milliseconds to a position .
react-waves Key Features
react-waves Examples and Code Snippets
Community Discussions
Trending Discussions on react-waves
QUESTION
...import React,{ useEffect, useRef, useState } from "react"; import { useDispatch, useSelector } from 'react-redux' import { format, formWaveSurferOptions } from '../../utils/generic' import { receiveCurrentTrack, receiveTrackRef , togglePlay} from '../../redux/action/currentTrack' import './_playlist.scss' import WaveSurfer from "wavesurfer.js"; import {Link} from 'react-router-dom'; const PlayList = (props) => { const dispatch = useDispatch() const { track, queue, currentTrack, index } = props const waveformRef = useRef(null); const waveRef = useSelector((state)=>state.currentTrack.waveRef) const wavesurfer = useRef(null); const currentTime = useRef(null) const [duration, setDuration] = useState() useEffect(() => { const options = formWaveSurferOptions(waveformRef.current); wavesurfer.current = WaveSurfer.create(options); wavesurfer.current.load(track.url); wavesurfer.current.on("ready", ()=> { if(wavesurfer.current){ wavesurfer.current.setVolume(0) setDuration(format(wavesurfer.current.getDuration())) } }); return () => wavesurfer.current.destroy(); }, [track.url]); useEffect(()=>{ if(currentTrack){ dispatch(receiveTrackRef(wavesurfer)) } return ()=> waveRef?.current.stop() },[currentTrack.track?.url]) const handleClick = () => { dispatch(receiveTrackRef(wavesurfer)) if(currentTrack){ dispatch(togglePlay()) } else { waveRef?.current.stop() dispatch(receiveCurrentTrack(track, queue)); } }; return (
# {index} : {track.title} {track.artist} 0.00 / {duration && duration} console.log('hhh')} ref={waveformRef} /> {duration && duration} ); }; export default PlayList;
ANSWER
Answered 2021-May-02 at 08:18From the Official Doc :
getCurrentTime() – Returns current progress in seconds.
There's also a audioprocess
event as you mentioned that fires continuously as the audio plays.
So by combining these together, we have this:
QUESTION
So, I am not very familiar with webpack, however, I am trying to use a package in Gatsby.js that requires 'window'. I found the following webpage in their docs, and have tried to figure out what I need to do to make it work, but to no success. Any light anyone can shed would be very appreciated. This is what I have:
gatsby-node.js
...ANSWER
Answered 2020-Oct-30 at 06:42Change your setWebpackConfig
rule to:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-waves
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page