Audio progress bar for Android - android

I have an audio program that I would like to add an audio progress bar with some kind of button, so that a user can grab the button to navigate through the audio forward or backward.
Is there any kind of standard component that does that? Or how can I make a custom one?

You can use SeekBar.
To position and seek the audio, use MediaPlayer's getCurrentPosition(), getDuration() and seekTo(int).

Related

How to show Activity overlaying on another Activity?

I want to show a volume bar (SeekBar) when a speaker button is pressed. Changing the whole Activity just for a SeekBar might not be a good decision.
I think overlaying that SeekBar would be the best solution. (But how?)
How would you solve this problem?
You could use your own customized dialog and automatically dismiss it if the user hasn't touched the screen after a short while, but I would like to ask exactly why you need it.
The reason: not all Android devices even have volume buttons.
If you wish, you can easily just set the volume control to be MEDIA instead of the ringtone volume, so that if the user accesses the volume , it will show the control of the MEDIA . Here's how you do it:
setVolumeControlStream(AudioManager.STREAM_MUSIC);
I think you should use a custom Dialog with a SeekBar set as content.
As a side note, remember to get rid of the title requesting the right feature to your window:
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);

how to hide the seek bar when the Media player is not playing?

I am developing a Media Player and i want to display seek bar only when the song is being played and when the song is not played or is paused i want to hide the seek bar,please help in achieving this.
i am developing android app on a htc wild fire which has android froyo 2.2 running in it.
setVisibility(View.GONE);
Call on the seek bar should do the trick. Subsequently, to make it reappear during other operations call:
setVisibility(View.VISIBLE);
Hope this helps.
Use somthing like that :
if(mediaPlayer.isPlaying() == false)
{
seekBar.setVisibility(View.GONE);
}

android progress bar movement with audio

How can I make progress bar or progress dialog movement with audio in android
I am trying to design an audio player. I need help regarding the progress bar. I want the status of progress bar to change as the audio progresses. I want progress bar to pause as I press Pause button and start again as I press start button. Please help...
Thanks
Step 1:
Get audio duration with MediaPlayer.getDuration()
Step 2:
Set ProgressBar progress max. value to value from step 1
Step 3:
Update progress bar periodically from MediaPlayer.getCurrentPosition(), while media playing using Handler. Check here
Remember to;
Stop periodic update of step 3 at pauses and stops
If you are going to add seek progress bar feature use MediaPlayer.seekTo(int msec) method, where msec is SeekBar.getProgress(), using SeekBar.OnSeekBarChangedListener
Good Luck!

How to tint the video, but still display the MediaController progress bar?

In my application I am using VideoView to play a video. Through this forum I have learnt to show the progress bar (MediaController) persistently (without hiding).
My requirement is to tint the video on some action (lets say pause on MediaController), but still be able to use the MediaController. i.e., once the video is tinted, I could move the progress-bar on MediaController and could also play the video again (after un-tinting it).

Disable user controls in an Android VideoView object

I'm working on an app that plays a video. I cannot find a way to disable the user video controls (Play, pause, go to 1:23, etc...)
How do I remove the user controls from that object? Ideally the bottom bar of controls will not even show up.
VideoView doesn't have controls built in so I'm assuming you have a MediaController set up in your code, which has the controls that appear when tapping the screen and then go away. If that's the case you can remove it and your problem should be solved.

Categories

Resources