Android VideoView播放视频,提示加载框ProgressBar的问题?
专业在线博彩导航
专业在线博彩导航
当前位置 : 专业在线博彩导航 > 网上赌博新址

Android VideoView播放视频,提示加载框ProgressBar的问题?

我用VideoView播放视频,因为是加载网络视频么,等一会才能加载出来,我想加个加载框ProgressBar来提醒用户等待,我利用Handle每隔半秒就检测视频是否isPlaying中,但是没效果,网上也有用setOnInfoListener这个接口来控制,但是我试过了 没反应。有哪位大神做过类似的程序吗?可否告知一下?谢谢
这是我的代码:

public class PlayVideoActivity extends CommonActivity
{


    @BindR.id.playVideo_vv
    VideoView playVideoVv;
    @BindR.id.pb
    ProgressBar pb;

    private String videoPath;
    @Override
    protected void onCreateBundle savedInstanceState
    {
        super.onCreatesavedInstanceState;
        setContentViewR.layout.playvideoactivity;
        ButterKnife.bindthis;
        initView;
    }

    Handler handler=new Handler;
    Runnable runnable=new Runnable
    {
        @Override
        public void run
        {
            if playVideoVv.isPlaying
            {
                pb.setVisibilityView.GONE;
            }else{
                pb.setVisibilityView.VISIBLE;
            }
            handler.postDelayedrunnable,500;
        }
    };

    private void initView
    {
        pb.setVisibilityView.VISIBLE;
        videoPath=getIntent.getStringExtra"videoPath";
        playVideoVv.setVideoPathvideoPath;
        MediaController mediaController = new MediaControllerthis,false;
        // 设置VideView与MediaController建立关联
        playVideoVv.setMediaControllermediaController;
        // 设置MediaController与VideView建立关联
        mediaController.setMediaPlayerplayVideoVv;
        // 让VideoView获取焦点
        playVideoVv.requestFocus;
        playVideoVv.start;
    }

}

你为什么不用 onpreparedlistener

没看到你的线程调用代码

栏目列表

广告位

专业在线博彩导航