I want to call load() with set timeout ,how add to my code
It offer from library
Docs:
load()
When preload is true this is automatically called. When setting preload to false, you can call load() manually before playing sounds (useful for lazy loading large files on slow networks). If you attempt to play a sound that's not loading or loaded with preload react-howler will automatically call load().
And there is my code
<ReactHowler
src={Audio}
preload={false}
playing={isplaying ? false : true}
/>
For a fully controlled example (in a class-based component) take a look at the official examples
The trick is to get a ref to the howler component, then you can call load on it. So the following should work:
const howlerRef = useRef(null);
const myLoadFunc = ()=>{
if(howlerRef.current) {
howlerRef.current.load();
}
}
return (
<>
<ReactHowler
src={Audio}
preload={false}
playing={isplaying ? false : true}
ref={howlerRef}
/>
<button onClick={myLoadFunc}>start loading</button>
</>
)