Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第一次End后,因生命周期导致的崩溃问题 #113

Closed
mingchaogui opened this issue May 7, 2018 · 8 comments
Closed

第一次End后,因生命周期导致的崩溃问题 #113

mingchaogui opened this issue May 7, 2018 · 8 comments

Comments

@mingchaogui
Copy link

mingchaogui commented May 7, 2018

在第一次播放完成后,isEnd会被置为true,并且永远不会再被置为false(即使重新播放)。如此,在onPause后再次onResume时,不会再去创建player。这样就导致了无法继续播放,甚至于应用崩溃的问题。

    /***
     * 页面恢复处理
     */
    public void onResume() {
        boolean is = (Util.SDK_INT <= Build.VERSION_CODES.M || null == player) && isLoad && !isEnd;
        if (is) {
            createPlayers();
        }
    }
@yangchaojiang
Copy link
Owner

会的。
重新播放调用这个方法的
image

@mingchaogui
Copy link
Author

你按照我的办法测试一下。先播放至结尾。然后按Home键转入后台,再切换回前台。此时点击重新播放会导致APP崩溃。

@yangchaojiang
Copy link
Owner

播放结束奇后,切换后台是吧

@yangchaojiang
Copy link
Owner

版本2.170 demo没有问题哦,请问你使用版本是

@mingchaogui
Copy link
Author

明白了,Demo用的是ManualPlayer,而我指的是ExoUserPlayer。刚测试过,Demo也存在问题的。

@yangchaojiang
Copy link
Owner

把本2.1.74 已修复,谢谢支持:bowtie::bowtie::bowtie:

@mingchaogui
Copy link
Author

mingchaogui commented May 9, 2018

谢谢及时修复。建议把竖屏手势改成可选,再开放LongPress事件的监听。

    private View.OnTouchListener listener = new View.OnTouchListener() {
        @SuppressLint("ClickableViewAccessibility")
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (!controllerHideOnTouch) {
                return false;
            } else if (getPlayerViewListener().isLock()) {
                return false;
            } else if (boolean && !VideoPlayUtils.isLand(activity)) {// 这里改成可配置
                return false;
            }
            if (gestureDetector != null && gestureDetector.onTouchEvent(event)) {
                return true;
            }
            // 处理手势结束
            switch (event.getAction() & MotionEvent.ACTION_MASK) {
                case MotionEvent.ACTION_UP:
                    endGesture();
                    break;
                default:
            }
            return false;
        }
    };
    private class PlayerGestureListener extends GestureDetector.SimpleOnGestureListener {
            @Override
            public void onLongPress(MotionEvent e) {
                super.onLongPress(e);

                // 这里触发LongPress的回调
                onLongPressListener.onLongPress();
            }
    }

@yangchaojiang
Copy link
Owner

以后版本考虑开放。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants