Android “网络视图视频事件”;onShowCustomView“;正在全屏播放,但当我回到小屏幕时,listner不起作用

Android “网络视图视频事件”;onShowCustomView“;正在全屏播放,但当我回到小屏幕时,listner不起作用,android,nativescript,Android,Nativescript,webview视频事件“onShowCustomView”全屏启动,但当我回到小屏幕时,listner无法工作 当我全屏播放的时候。两种功能 onShowCustomView和onHideCustomView协同工作。当我试图回到小屏幕。函数的单位被调用 function onWebViewLoaded1(webargs, url) { var page = webargs.object.page; var webview = webargs.object;

webview视频事件“onShowCustomView”全屏启动,但当我回到小屏幕时,listner无法工作

当我全屏播放的时候。两种功能

onShowCustomView和onHideCustomView协同工作。当我试图回到小屏幕。函数的单位被调用

function onWebViewLoaded1(webargs, url) { 
    var page = webargs.object.page; 
    var webview = webargs.object;    
    var customViewContainer = view.getViewById(webview, 'singleimgpopup');
    var viewr = view;


var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var MyWebChromeClient = /** @class */ (function (_super) {
    __extends(MyWebChromeClient, _super);
    function MyWebChromeClient() {

        var _this = _super.call(this) || this;
        return global.__native(_this);
    }
    MyWebChromeClient.prototype.onStop = function(){
        console.log("this");
    }
    MyWebChromeClient.prototype.onShowCustomView = function (view, callback) { 

         // Store the view and its callback for later (to kill it properly)
        if(this.mCustomView != null){
            callback.onCustomViewHidden(); return
        }
       this.mCustomView = view;
     //  webview.setVisibility(View.GONE);
       this.mCustomViewCallback = callback;
       console.log('fullscreen');
    };
    MyWebChromeClient.prototype.onHideCustomView = function () { 
         console.log("this2");
        _super.prototype.onHideCustomView.call(this);
        _super.prototype.mCustomView = null;
    };
    return MyWebChromeClient;
}(android.webkit.WebChromeClient));



    webview.android.getSettings().setJavaScriptEnabled(true);
    webview.android.getSettings().setAppCacheEnabled(true);
    webview.android.getSettings().setBuiltInZoomControls(true); 
    webview.android.getSettings().setSaveFormData(true);
     let myWebChromeClient = new MyWebChromeClient();
    webview.android.setWebChromeClient(myWebChromeClient); 

    // console.log("1=====================url",url);
    // webview.android.loadUrl(url); 
}
上面的方法可以工作,但我可以console.log(“放置全屏”)。 但是 当我点击下面给出的图标时,我无法在“退出全屏”上捕捉实例/事件/列表。我如何知道是否有人点击了下面给出的图标


这是nativescript videoplayer全屏按钮的代码。您需要更新videoplayer.android.js中的代码。有关详细信息,请询问我

var viewx=android.view.view; const view\u n=require(“tns核心模块/ui/core/view”)


我不确定将自定义视图添加到容器的确切位置。你能共用一个操场吗?
  var isFullScreen="";
        var fullscreenx = android.widget.MediaController.extend({
        init:function(context){
            ;
        },
        setAnchorView:function(view) {

            this.super.setAnchorView(view);

            //image button for full screen to be added to media controller
            var fullScreen = new      android.widget.ImageButton(this.super.getContext());

            var params = new FrameLayout.LayoutParams(80,80);
            params.gravity = Gravity.RIGHT;
            // params.layout_width = 'wrap_content';
            // params.layout_height = 'match_parent'; MATCH_PARENT
            //fullScreen.style="background-color:#000000; background-image: url('~/images/info.png'); background-repeat:no-repeat;background-size: 40 40;background-position:center center;";
            params.rightMargin = 80; 
      var x = this.super.getContext().getResources().getIdentifier("minimizescreen", "drawable", 
      this.super.getContext().getPackageName() );
      var y = this.super.getContext().getResources().getIdentifier("fullscreen", "drawable", 
      this.super.getContext().getPackageName() );

           // fullScreen.setBackgroundResource("@drawable/icon");

           this.addView(fullScreen, params);

            //fullscreen indicator from intent
         //   isFullScreen =  view.getContext().getIntent().
                                 //   getStringExtra("fullScreenInd");

            if(isFullScreen=="y"){
                 fullScreen.setImageResource(x);
                //fullScreen.setBackgroundResource(R.drawable.buttonOff);
                //fullScreen.setImageResource(this.getContext().getResources().getDrawable(android.support.customtabs.R.drawable.icon));
                // console.log('android.R.drawable.ic_fullscreen_exit=============',android.support.customtabs.R.drawable(), android.support.customtabs.R.drawable.abc_ic_star_black_16dp());
            }else{
                 fullScreen.setImageResource(y);
                //fullScreen.setBackgroundResource(R.drawable.buttonOn);
      //fullScreen.setImageResource(this.getContext().getResources().getDrawable(android.support.customtabs.R.drawable.icon));
                // console.log('android.R.drawable.ic_fullscreen=============',android.support.customtabs.R.drawable, android.support.customtabs.R.drawable.abc_popup_background_mtrl_mult());
            }

                var completionListener = new  android.view.View.OnClickListener({
                    onClick: function(v) {
                                if(isFullScreen=="y"){
                                    isFullScreen ="";
                                    var nativeVideoPlayer12 = frame.topmost().getViewById("nativeVideoPlayer12");
                                    var currenttime12 =  nativeVideoPlayer12.getCurrentTime();
                                    const navEntryWithContext = {
                                            moduleName: "home/videosingle",
                                            context: {
                                                url: url,
                                                currenttime:currenttime12,
                                                data:breadcrumvar[breadcrumvar.length-1]
                                            }
                                        };

                                    frame.topmost().navigate(navEntryWithContext);    
                                    console.log('Video small screen');
                                }else{ 
                                    isFullScreen ="y";
                                    console.log('Video fullscreen');
                                     var nativeVideoPlayer = frame.topmost().getViewById("nativeVideoPlayer");
                                       console.log(nativeVideoPlayer.getCurrentTime() ,nativeVideoPlayer.src);
                                       var url = nativeVideoPlayer.src;
                                       var currenttime =  nativeVideoPlayer.getCurrentTime();
                                       const navEntryWithContext = {
                                            moduleName: "home/v",
                                            context: {
                                                url: url,
                                                currenttime:currenttime,
                                                data:frame.topmost().navigationContext
                                            }
                                        };

                                        frame.topmost().navigate(navEntryWithContext);
                                }
                    }
                });
                fullScreen.setOnClickListener(completionListener);
        }
    });