How to create ProgressDialog with pause and resume - android

I currently have url for an audio file. I'd like to create audio player like that in Evernote.
I have tried to create a ProgressDialog where the maximum value equals the player duration. But I have no idea how to add a pause/resume Button to work with both progress bar and audio. So basically this divided into three sub-questions:
How can I add a Button to ProgressDialog?
How to pause and resume the a) ProgressDialog and b) audio?
How to detect that the user tabs outside of the ProgressDialog in which case the audio should be stopped?

You cannot user a pre-defined dialog for that. Create your own custom one. Here can you find everything you need to know about that.

Related

How to start the progress of a seekbar from anywhere not from the beginning

I'm trying to create an android application with video cutting facility. For that I need to create a seekbar and when user clicks on "start cutting" button, progress of that seekbar must start from that position. And the when user clicks on "stop cutting", seekbar must stop at that point and the duration in between start to end must show in a different color. Please help me..
I want it to look some thing like following image:
I think it will far too good to use a double thumb seekbar.Just try
https://code.google.com/p/range-seek-bar/
Since SeekBar is a subclass of the ProgressBar you can try setProgress() http://developer.android.com/reference/android/widget/ProgressBar.html#setProgress(int) method to start the initial point of the SeekBar.
There is also a secondary progress displayable on a progress bar which is useful for displaying intermediate progress, such as the buffer level during a streaming playback progress bar.
http://developer.android.com/reference/android/widget/ProgressBar.html#setSecondaryProgress(int)
Please see if that can be used for your use case...

How to Buffering one video in background while playing one?

I have one activity where i got two video URL.So, once the activity started i have set one progress dialog which spins till the first video is prepared.So once first video started , i want to buffer the second video in background(First Video is still playing in foreground).Right now i am showing one progress dialog till the video prepared.So once the first video is finished ,i want to immediately start the second one.So user feels like that its an one video.
Any help will be appreciated....
Thanks in Advance....

How do I set spinning ProgressBar to Media?

I'm creating a soundboard application. Im new to developing but I have my whole app running perfectly exept for one last thing. I have it so I have multiple buttons and each button plays a different sound. I want to have a spinning progressbar on my button while the sound is playing, but then dissappear when the sound is done. How would I do this easily?
so i'm not sure how you're playing your sounds, whether its just one line of code that actually PLAYS the sound. In my opinion, you have two options
If your method returns something once the sound stops playing, I'd do something like
while (myapp.playSound() != -1){ //implement spin bar }
Or you can use AsyncTask -- http://developer.android.com/reference/android/os/AsyncTask.html
AsyncTask would probably be your best bet
Add a OnCompletionListener to the mediaplayer, so when you play the sound (or click the button) start the progress bar, and when the track is complete remove/stop it.

Progress bar with Streaming Audio using MediaPlayer

Is there a way to show the progress of a song playing with a progress bar and possibly length in terms of minutes and seconds? I would like it in the status bar, but I know how to do that using a custom notification layout so if someone steers me in the right direction that would be nice. Either with some code or code examples, thanks.
You obviously have to tie in with the NotificationManager classes the progress of the player/mp3. There was a question on SO that may have what you need... Also take a look at this for just basic Progress bar. And of course read the documentation on ProgressBar and Status Bar
To get the minutes left to play song, I know VLC player doesn't do that for my SlimDevices server. If you want to do this from via streaming you will have to get the length of the song, then implement your own timer as I am pretty sure that streaming music does not give you the current time left to play song.

How to connect Media Player to a SeekBar?

I want to show the progress of a media on a seekbar.
Also I want to allow user to "jump" within a medium.
I have a MediaPlayer, and a SeekBar. And as far as I see there is no an easy way to merge them.
You can use VideoView instead of MediaPlayer and you can have MediaController which can be set to VideoView.
Otherwise you have to get the progress at instances and update the seek bar you can use timers.

Categories

Resources