Problems with Acitivity LifeCycle with VideoView playback.
Posted
by Alex Volovoy
on Stack Overflow
See other posts from Stack Overflow
or by Alex Volovoy
Published on 2010-03-17T17:15:10Z
Indexed on
2010/03/17
17:21 UTC
Read the original article
Hit count: 420
Hi all i've ran into another problems with VideoView
.
Then video is playing, and i put device asleep, using hard button, onPause
is called. But it followed by
03-17 11:26:33.779: WARN/ActivityManager(884): Activity pause timeout for HistoryRecord{4359f620 com.package/com.package.VideoViewActivity}
And then i have onStart
/onResume
again and Video starts playing. I've try to move code around onStart
/onStop
- doesn't seems to make difference.
sample code :
public class VideoViewActivity extends Activity {
private String path = "";
private VideoView mVideoView;
private static final String MEDIA_URL = "media_url";
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.videoview);
mVideoView = (VideoView)findViewById(R.id.surface_view);
path = getIntent().getStringExtra(MEDIA_URL);
}
@Override
public void onResume() {
super.onResume();
mVideoView.setVideoPath(path);
mVideoView.setMediaController(new MediaController(this));
mVideoView.requestFocus();
mVideoView.start();
}
@Override
public void onPause() {
super.onPause();
mVideoView.stopPlayback();
mVideoView.setMediaController(null);
}
}
© Stack Overflow or respective owner