如何播放视频之前显示进度条进度条、视频

由网友(宇宙无敌小二逼)分享简介:我想播放视频前,显示进度对话框。我想下面的链接比如播放视频。i want to show the progress dialog before playing video. i tried below link example for playing video.http://davanum.word$p$pss.c...

我想播放视频前,显示进度对话框。我想下面的链接比如播放视频。

i want to show the progress dialog before playing video. i tried below link example for playing video.

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();
    }
});
阅读全文

相关推荐

最新文章