饺子视频loading时home键退到后台还在播放的问题

当进入视频就播放时,当在loading时,退出到后台,当视频加载出来还能听到播放声音
1,是因为当onpause时调用 goOnPlayOnPause()方法,但是,loading过程中当前状态为.CURRENT_STATE_PREPARING。
没有停止所以, 判断当 player.currentState == Jzvd.CURRENT_STATE_PREPARING时,走
releaseAllVideos();。此时做个标记,当resume回来时,重新加载视频。

onPause()时

@Override
    protected void onPause() {
        super.onPause();
            if (null != myJzvdStd) {
                Jzvd player = JzvdMgr.getCurrentJzvd();
                if (player != null && player.currentState == Jzvd.CURRENT_STATE_PREPARING) {
                    statepause = 2;
                    myJzvdStd.releaseAllVideos();
                } else {
                     statepause = 0;
                    myJzvdStd.clearSavedProgress(this, null);
                    myJzvdStd.goOnPlayOnPause();
                }
            }
    }

onResume时,重新播放

 @Override
    protected void onResume() {
        super.onResume();
            if (null != myJzvdStd) {
                Jzvd player = JzvdMgr.getCurrentJzvd();
                if (player != null) {
                    statepause = 0;
                    myJzvdStd.goOnPlayOnResume();
                } else {
                    if (statepause == 2) {
                        statepause = 0;
                        playViodeView();
                    }
                }
            }
    }

你可能感兴趣的:(饺子视频loading时home键退到后台还在播放的问题)