I have multiple audio files in my application's property directory. When I click on a button when the user clicks on a button Want to play in a certain order, after the second, there should be no noticeable interval between the audio files. What is the best way to achieve this?
I'm thinking of using mediaplayer objects and OnCompletionListener s. But, this would mean that I have to create lots of OnCompletionListener because I know every time that audio file is next, am I forgetting or better view?
You are on the right track, not many on-concept listener is required.
// Define a variable to use as the indicator int audioindex = 0; // Extract the files in an array string [] files = tap; Files = assetManager.list ("audiofile"); Then in your on-campus listener.
mp.setOnCompletionListener (New On Compilation Listener) {//Override Ends at Public Zero (Mediaplayer arg0) {// File has finished, play next one.Functionplayfile (files [ Ondindex]); Orndex + = 1; // Index increases to get the next audio file}});
Comments
Post a Comment