Comments (3)
There's nothing built-in for that, but you should be able to do that by controlling the volume
prop via a state
field, and in a setInterval
you can start decreasing that volume via this.setState({ volume: volume - someDelta })
until you reach 0, in which case you stop the sound directly.
If you want to do cross fading with another sound, you can render two sounds and do the opposite with the other one, increasing the volume.
Hope this helps!
from react-sound.
Exactly. Thanks for the reply!
from react-sound.
Awesome, feel free to close this issue if that helped!
from react-sound.
Related Issues (20)
- onPause does not work on iOS when running in background HOT 1
- Mute feature? HOT 2
- Audio stuck when switching networks
- Please update the yarn and npm packages HOT 1
- No supported file found
- Problem with react-sound with setInterval
- Issue with Status Typing HOT 5
- Issue Sith Dynamic Positioning
- How to handle multiple plays of the same sound
- AbortError: The fetching process for the media resource was aborted by the user agent at the user's request.
- External sounds are prevented in background [Mobile Firefox, Mobile Safari]
- Uncaught Error: The error you provided does not contain a stack trace. HOT 1
- 怎么去获取当前播放时间?
- onLoad event is not called after onLoading
- typescript issue with onPlaying callback
- Creating a new v1.2.1 release with recent bugfix in master
- React-sound soundmanager doesnt work with useHistory hook
- Duration in milliseconds
- Could not resolve dependency issue for newer react@ ^17 HOT 1
- Decrease update interval
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-sound.