Videoview Pausing and resuming
You can use this
@Override
public void onPause() {
Log.d(TAG, "onPause called");
super.onPause();
stopPosition = videoView.getCurrentPosition(); //stopPosition is an int
videoView.pause();
}
@Override
public void onResume() {
super.onResume();
Log.d(TAG, "onResume called");
videoView.seekTo(stopPosition);
videoView.start(); //Or use resume() if it doesn't work. I'm not sure
}
original post
Buffering videos with VideoView
I've found the answer. Add a ProgressBar over the top of the VideoView and do the following:
mPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mSpinner.setVisibility(View.GONE);
}
});
Detect if a VideoVIew is buffering
Since API level 17, you can now access the InfoListener from the MediaPlayer:
final MediaPlayer.OnInfoListener onInfoToPlayStateListener = new MediaPlayer.OnInfoListener() {
@Override
public boolean onInfo(MediaPlayer mp, int what, int extra) {
switch (what) {
case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START: {
mProgressBar.setVisibility(View.GONE);
return true;
}
case MediaPlayer.MEDIA_INFO_BUFFERING_START: {
mProgressBar.setVisibility(View.VISIBLE);
return true;
}
case MediaPlayer.MEDIA_INFO_BUFFERING_END: {
mProgressBar.setVisibility(View.GONE);
return true;
}
}
return false;
}
});
mVideoView.setOnInfoListener(onInfoToPlayStateListener);
Related Topics
Should I Use Getapplicationcontext or Activity.This in a Long Running Asynctask
How to Take Pictures from The Camera Without Preview When My App Starts
Margins of a Linearlayout, Programmatically with Dp
How to Enable Internal App Sharing for Android
Android Getting Exact Scroll Position in Listview
How to Hide The Soft-Key Bar on Android Phone
Set Visibility of Progress Bar Gone on Completion of Image Loading Using Glide Library
Error: Error Parsing Xml: Not Well-Formed (Invalid Token) ...
What Is The Different Between Explicit and Implicit Activity Call in Android
Supporting Amazon and Android Market (Google Play) Links Inside Application
View Pager + Imageview +Pinch Zoom + Rotation
Camera Preview Is in Portrait Mode But Image Captured Is Rotated
Exception When Opening Parse Push Notification
How to Create Listview Inside Dialog
Custom Filtering Arrayadapter in Listview