Java Code Examples for com.tencent.smtt.export.external.interfaces.IX5WebChromeClient#CustomViewCallback

The following examples show how to use com.tencent.smtt.export.external.interfaces.IX5WebChromeClient#CustomViewCallback . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: VideoWebChromeClient.java    From YCWebView with Apache License 2.0 6 votes vote down vote up
/**
 *  通知应用当前页进入了全屏模式,此时应用必须显示一个包含网页内容的自定义View
 * 播放网络视频时全屏会被调用的方法,播放视频切换为横屏
 * @param view                              view
 * @param callback                          callback
 */
@SuppressLint("SourceLockedOrientationActivity")
@Override
public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback callback) {
    X5LogUtils.i("--Video-----onShowCustomView-------");
    if (isShowCustomVideo){
        if (context instanceof Activity){
            X5LogUtils.i("--Video-----onShowCustomView----展示视频---");
            Activity activity = (Activity) context;
            activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
            // 如果一个视图已经存在,那么立刻终止并新建一个
            if (customView != null) {
                callback.onCustomViewHidden();
                return;
            }
            fullViewAddView(view);
            customView = view;
            customViewCallback = callback;
        }
    }
}
 
Example 2
Source File: MyX5WebChromeClient.java    From ByWebView with Apache License 2.0 6 votes vote down vote up
/**
 * 播放网络视频时全屏会被调用的方法
 */
@Override
public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback callback) {
    mIWebPageView.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    mIWebPageView.hindWebView();
    // 如果一个视图已经存在,那么立刻终止并新建一个
    if (mXCustomView != null) {
        callback.onCustomViewHidden();
        return;
    }

    mIWebPageView.fullViewAddView(view);
    mXCustomView = view;
    mXCustomViewCallback = callback;
    mIWebPageView.showVideoFullView();
}
 
Example 3
Source File: WebChromeClientWrapper.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback callback) {
    if (this.mRealWebChromeClient != null){
        this.mRealWebChromeClient.onShowCustomView(view, callback);
        return ;
    }
    super.onShowCustomView(view,callback);
}
 
Example 4
Source File: WebChromeClientWrapper.java    From AgentWebX5 with Apache License 2.0 5 votes vote down vote up
public void onShowCustomView(View view, int requestedOrientation,
                             IX5WebChromeClient.CustomViewCallback callback) {
    if (this.mRealWebChromeClient != null){
        this.mRealWebChromeClient.onShowCustomView(view, requestedOrientation, callback);
        return;
    }
    super.onShowCustomView(view,requestedOrientation,callback);
}
 
Example 5
Source File: X5WebChromeClient.java    From cordova-plugin-x5-webview with Apache License 2.0 5 votes vote down vote up
public void onShowCustomView(View view,final IX5WebChromeClient.CustomViewCallback callback) {
    // IX5WebChromeClient.CustomViewCallback casts to webkit.WebChromeClient.CustomViewCallback
    // By Jeremy on 2017/5/18.
    parentEngine.getCordovaWebView().showCustomView(view, new android.webkit.WebChromeClient.CustomViewCallback() {
        @Override
        public void onCustomViewHidden() {
            callback.onCustomViewHidden();
        }
    });
}
 
Example 6
Source File: VideoChromeClient.java    From YCWebView with Apache License 2.0 5 votes vote down vote up
/**
 *  通知应用当前页进入了全屏模式,此时应用必须显示一个包含网页内容的自定义View
 * 播放网络视频时全屏会被调用的方法,播放视频切换为横屏
 * @param view                              view
 * @param customViewCallback                callback
 */
@Override
public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback) {
    if (mIVideo != null) {
        mIVideo.onShowCustomView(view, customViewCallback);
    } else {
        super.onShowCustomView(view, customViewCallback);
    }
}
 
Example 7
Source File: VideoPlayerImpl.java    From YCWebView with Apache License 2.0 4 votes vote down vote up
@SuppressLint("SourceLockedOrientationActivity")
@Override
public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback callback) {
    if (isShowCustomVideo){
        if (!X5WebUtils.isActivityAlive(mActivity)) {
            return;
        }
        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
        // 保存当前屏幕的状态
    /*Window mWindow = mActivity.getWindow();
    Pair<Integer, Integer> mPair;
    if ((mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
                WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        mFlags.add(mPair);
    }
    if ((mWindow.getAttributes().flags & WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED) == 0) {
        mPair = new Pair<>(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, 0);
        mWindow.setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED,
                WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED);
        mFlags.add(mPair);
    }*/

        // 如果一个视图已经存在,那么立刻终止并新建一个
        if (mMovieView != null) {
            callback.onCustomViewHidden();
            return;
        }
        if (mWebView != null) {
            mWebView.setVisibility(View.GONE);
            if (mListener!=null){
                mListener.hindWebView();
            }
        }
        //添加view到decorView容齐中
        fullViewAddView(view);
        this.mCallback = callback;
        this.mMovieView = view;
        if (mListener!=null){
            mListener.showVideoFullView();
        }
    }
}
 
Example 8
Source File: InterVideo.java    From YCWebView with Apache License 2.0 2 votes vote down vote up
/**
 * 通知应用当前页进入了全屏模式,此时应用必须显示一个包含网页内容的自定义View
 * 播放网络视频时全屏会被调用的方法,播放视频切换为横屏
 * @param view                              view
 * @param callback                          callback
 */
void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback callback);
 
Example 9
Source File: WebChromeClientListener.java    From JsBridge with MIT License 2 votes vote down vote up
@Override
public void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback) {

}
 
Example 10
Source File: WebChromeClientListener.java    From JsBridge with MIT License 2 votes vote down vote up
@Override
public void onShowCustomView(View view, int requestedOrientation, IX5WebChromeClient.CustomViewCallback customViewCallback) {

}
 
Example 11
Source File: IVideo.java    From AgentWebX5 with Apache License 2.0 votes vote down vote up
void onShowCustomView(View view,IX5WebChromeClient.CustomViewCallback callback); 
Example 12
Source File: OnWebChromeClientListener.java    From JsBridge with MIT License votes vote down vote up
void onShowCustomView(View view, IX5WebChromeClient.CustomViewCallback customViewCallback); 
Example 13
Source File: OnWebChromeClientListener.java    From JsBridge with MIT License votes vote down vote up
void onShowCustomView(View view, int requestedOrientation, IX5WebChromeClient.CustomViewCallback customViewCallback);