Reuse looping mediaplayer in android [closed] - android

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
how can i properly reuse a MediaPlayer in android which is also be looping? (should be initialize as MediaPlayer.setDataSource in the raw folder so that i can use prepareAsync())

If you want to reuse a MediaPlayer, according to the lifecycle documentation, you should stop() the player, prepare it again with new data, then start it again. I believe the same OnPreparedListener previously set will be invoked again, but you could also reset it before preparing.
Once you call release(), the MediaPlayer is no longer usable, so you should only do that when you are completely finished and need it to release resources.

Related

Music Player how to make the UI [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am surely able to run the music on my music player. But how am i really supposed to create a UI? I want a kind of UI for the music player in which there will be a pause, a start, and other basic buttons along with a proceeding bar as the music progresses.
Just use the MediaPlayer class.
Then Add ImageButtons for the player action (play , pause etc...)
Here is a good place for free icons
https://material.io/icons/

How to play audio while animation in unity 3D? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm new unity 3D developer i want to play audio while animation at the time set. How to play audio while animation in unity 3D?
You can use AnimationEvents to call a function at a specific frame in an
animation it can be playing an audio or anything else

Any way to know what music the user is listening to? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am looking to write an app that is aware of what music the user is listening to (in any other app). Does the Android SDK allow for this?
I know that MediaPlayer objects are generally used, however they seem to be created within the context of the specific app...
Any ideas?
Thanks
Most music apps will send out metadata about songs/tracks that are playing.
You may want to look at using a BroadcastReceiver

How to record audio while taking pictures in android? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Planning to develop an android application in which it has to record audio while taking pictures. When viewing it in gallery it has to play the recorded audio as well pictures.How to sync audio while taking pictures?
Better use asynchronous task. So u can make both capture and record audio at the same time

play music infinitely until a button is clicked [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm just trying to play music continuously in an infinite loop until a button is clicked.it works fine but,say for eg: my sound file is 5 sec. after every 5 sec there is a pause and the music plays again.Is there anyway to prevent that and play the music without interruption?
I have used Setlooping(true) for that infinite loop.
Your problem is that your music file likely contains a short pause at the end (or the beginning). You will need to edit this file in a sound editor to make it more suitable for continuous playback.
EDIT
To be clear, are you looking to loop one specific sound file, or any sound file in general?

Categories

Resources