The application that I am working on plays music files. If a timer expires I want the music to fade out. How do I do that. I am using MediaPlayer to play music and music files are present in raw folder of my application.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
One way to do it is to use
MediaPlayer.setVolume(right, left)and have these values decrement after every iteration..here is a rough ideaThe
FadeIn()orFadeOut()should be called once this timer of yours has expired. The method doesn’t need to take the deltaTime, but it’s better as it will lower the volume at the same rate across all devices.