如何播放视频之前显示进度条 [英] how to show the progress bar before playing the video
问题描述
我想播放视频前,显示进度对话框。我想下面的链接比如播放视频。
i want to show the progress dialog before playing video. i tried below link example for playing video.
<一个href="http://davanum.word$p$pss.com/2009/12/04/android-%E2%80%93-videomusic-player-sample-take-2/">http://davanum.word$p$pss.com/2009/12/04/android-%E2%80%93-videomusic-player-sample-take-2/
它的工作原理,但它需要更多的时间来播放视频,所以我想展示一个进度对话框之前启动视频。所以请电话我如何播放视频之前显示进度对话框。
it works but it takes more time to take for playing video so i want to show a progress dialog before start the video. so please tel me how to show the progress dialog before playing the video.
感谢你。
最好的问候。
推荐答案
首先,声明进度对话框
private static ProgressDialog progressDialog;
那么,在的onCreate,呼吁runOnUiThread之前,启动对话框
Then, in onCreate, before calling runOnUiThread, start the dialog
progressDialog = ProgressDialog.show(this, "", "Loading...", true);
在的playVideo,设置在preparedListener,将关闭该对话框当视频是准备玩
In playVideo, set a OnPreparedListener that will dismiss the dialog when the video is ready to play
mVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer arg0) {
progressDialog.dismiss();
mVideoView.start();
}
});
这篇关于如何播放视频之前显示进度条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!