AgentWeb icon indicating copy to clipboard operation
AgentWeb copied to clipboard

全屏播放activity横竖屏问题

Open DarkSherlock opened this issue 6 years ago • 0 comments

VideoImpl里结束全屏播放时,将其activity设为竖屏。 这里因为有些项目是平板项目,结束全屏播放的时候也应该保持横屏,所以这里建议作者坐下判断,播放结束后应该保持播放前actvity的横竖屏方向,或者暴露更简便的方法给使用者去做配置。 我看源码,作者其实现在已经做了判断有无重写onShowCustomView和onHideCustomView,所以这里其实也是可以做修改配置,只要将VideoImpl实现的onShowCustomView和onHideCustomView方法复制出来在WebChromeClient中去实现,在fragment中处理加上下面这三个方法就好了 public boolean isVideoState() { return mMoiveView != null; }

public boolean event() {

    if (isVideoState()) {
        mWebChromeClient.onHideCustomView();
        return true;
    } else {
        return false;
    }

}

@Override
public boolean onFragmentKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        return event();
    }
    return mAgentWeb.handleKeyEvent(keyCode, event);
}

DarkSherlock avatar Apr 11 '18 06:04 DarkSherlock