i am working on an application where i need to play video from a remote server as live stream.
which is done by me successfully. i managed every thing in my app.
but when video is loading i need to show a progress dialog over VideoView.
i tried using OnPreparedListener as "how to show the progress bar before playing the video"
@Override
public void onPrepared(MediaPlayer mp) {
progressbar.setVisibility(View.GONE);
mp.start();
}
but video play after 5-7 Sec of progressbar gone. i searched a lot on Google but not found any solution for it.
Could anyone help me.
Thanks in Advance.
have a look this one solved my problem hope help you also..
http://www.quicktips.in/how-to-show-progressbar-while-loading-a-video-in-android-videoview/
progressbar.setVisibility(View.VISIBLE);
videoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.start();
mp.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() {
@Override
public void onVideoSizeChanged(MediaPlayer mp, int arg1, int arg2) {
// TODO Auto-generated method stub
Log.e(TAG, "Changed");
progressbar.setVisibility(View.GONE);
mp.start();
}
});
}
});
:)