예제 #1
0
        public void DisplayAdvertising() //funcion que muestra la publicidad, es un layout inflado
        {
            try
            {
                var layout = VideoViewInstance(); //devuelve la vista con el video incorporado

                _displayParam = new WindowManagerLayoutParams(
                    WindowManagerLayoutParams.MatchParent,
                    WindowManagerLayoutParams.MatchParent,
                    WindowManagerTypes.Phone,
                    WindowManagerFlags.Fullscreen, Format.Transparent);
                _displayParam.Gravity = GravityFlags.Center;

                if (transparentLayout != null)
                {
                    _windowManager.RemoveViewImmediate(transparentLayout);
                }

                _windowManager.AddView(layout, _displayParam);

                mVideoView.Start(); //esto es asincrono

                mVideoView.Prepared += delegate
                {
                    mButton.Visibility = ViewStates.Visible;
                };

                mVideoView.Completion += delegate
                {
                    mVideoView.StopPlayback();
                    mVideoView.SetVideoURI(Android.Net.Uri.Parse(GetVideoUrl.GetUrlBySection(_configuration.GetConfigurationSection())));
                    mVideoView.Start();
                };
            }
            catch (Exception ex)
            {
            }
        }
예제 #2
0
        public View VideoViewInstance()
        {
            LayoutInflater li = LayoutInflater.From(this);

            _advertisingView = li.Inflate(Resource.Layout.advertising_item, null);

            mVideoView         = _advertisingView.FindViewById <VideoView>(Resource.Id.video_view);
            mButton            = _advertisingView.FindViewById <Button>(Resource.Id.btnShop); //boton de comprar
            mButton.Visibility = ViewStates.Gone;

            mButton.Click += delegate //resetea al view invisible para los clicks
            {
                DisplayInvisibleLayout();
            };

            //Android.Net.Uri uri = Android.Net.Uri.Parse("android.resource://" + this.PackageName + "/raw/video.3gp");

            mVideoView.SetVideoURI(Android.Net.Uri.Parse(GetVideoUrl.GetUrlBySection(_configuration.GetConfigurationSection()))); //url del video


            //  mVideoView.RequestFocus();

            return(_advertisingView);
        }