protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(AgoraVideoView.StreamUID) || e.PropertyName == nameof(AgoraVideoView.Mode))
            {
                global::Android.App.Application.SynchronizationContext.Post(_ =>
                {
                    try
                    {
                        if (_callView.IsStatic)
                        {
                            _layout = new FrameLayout(Context)
                            {
                                LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
                            };
                            _videoService = Xamarin.Agora.Full.Forms.AgoraService.Current as AgoraServiceImplementation;

                            SetNativeControl(_layout);
                            _videoService.SetupView(UpdatedHolder());
                        }
                    }
                    catch (Exception ex)
                    {
                        _holder.NativeView?.RemoveAllViews();
                    }
                }, null);
            }
            base.OnElementPropertyChanged(sender, e);
        }
Пример #2
0
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == nameof(AgoraVideoView.StreamUID) || e.PropertyName == nameof(AgoraVideoView.Mode))
     {
         try
         {
             if (_callView.IsStatic)
             {
                 _layout = new UIView(new RectangleF(0, 0, (float)Element.Width, (float)Element.Height))
                 {
                     Hidden = false
                 };
                 _videoService = Xamarin.Agora.Full.Forms.AgoraService.Current as AgoraServiceImplementation;
                 SetNativeControl(_layout);
                 _videoService.SetupView(UpdatedHolder());
             }
         }
         catch (Exception ex)
         {
             Console.WriteLine(ex);
             _holder.NativeView?.RemoveFromSuperview();
         }
     }
     base.OnElementPropertyChanged(sender, e);
 }
        /// <summary>
        /// On the element changed.
        /// </summary>
        /// <param name="e">E.</param>
        protected override void OnElementChanged(global::Xamarin.Forms.Platform.MacOS.ElementChangedEventArgs <global::Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);
            if (e.NewElement == null)
            {
                return;
            }
            _callView = e.NewElement as AgoraVideoView;
            var width  = e.NewElement.Width;
            var height = e.NewElement.Height;

            _layout       = new NSView(new CoreGraphics.CGRect(0, 0, (nfloat)Element.Width, (nfloat)Element.Height)); //(new RectangleF(0, 0, width, height)) { Hidden = false };
            _videoService = Xamarin.Agora.Full.Forms.AgoraService.Current as AgoraServiceImplementation;
            SetNativeControl(_layout);
            _videoService.SetupView(UpdatedHolder());
        }
 /// <summary>
 /// On the element changed.
 /// </summary>
 /// <param name="e">E.</param>
 protected override void OnElementChanged(global::Xamarin.Forms.Platform.Android.ElementChangedEventArgs <global::Xamarin.Forms.View> e)
 {
     base.OnElementChanged(e);
     if (e.NewElement == null)
     {
         return;
     }
     global::Android.App.Application.SynchronizationContext.Post(_ =>
     {
         _callView = e.NewElement as AgoraVideoView;
         _layout   = new FrameLayout(Context)
         {
             LayoutParameters = new FrameLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent)
         };
         _videoService = Xamarin.Agora.Full.Forms.AgoraService.Current as AgoraServiceImplementation;
         SetNativeControl(_layout);
         _videoService.SetupView(UpdatedHolder());
     }, null);
 }